question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IMAP integration allows one sensor failure to prevent all IMAP sensors from initialising

See original GitHub issue

The problem

Given two IMAP sensors:

  - platform: imap
    server: mail.example.com
    username: user1@example.com
    password: abc123
  - platform: imap
    server: mail.example.com$
    username: user2@example.com
    password: def456

Assume that one of the credential pairs is suffering from some sort of temporary failure. The IMAP component ignores the login response:

https://github.com/home-assistant/core/blob/3cde472e43642bd7850d606eb1555695f10af009/homeassistant/components/imap/sensor.py#L128

and continues, failing on the SELECT operation, which triggers an exception. This exception causes async_setup_platform to raise PlatformNotReady:

https://github.com/home-assistant/core/blob/3cde472e43642bd7850d606eb1555695f10af009/homeassistant/components/imap/sensor.py#L68

I’m not very familiar with the internals of Home Assistant but from what I can understand, raising PlatformNotReady results in the initialisation of every IMAP sensor (including ones not suffering from some sort of temporary failure) being postponed. Consequently, no IMAP sensors are initialised (as a result of just one credential pair failing).

I think that:

  • the logging in with username and password should not decide whether the IMAP platform (as a whole) is ready or not.
  • the component should not ignore the result of the login call.
  • the component should probably offer more debug-level logging around the connection process, to assist in determining why something is going wrong.

What version of Home Assistant Core has the issue?

2022.3.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

IMAP

Link to integration documentation on our website

https://www.home-assistant.io/integrations/imap/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

See also #65174, which was automatically (and silently) closed due to inactivity.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Lxcommented, Aug 21, 2022

𝓢𝓽𝓲𝓵𝓵 𝓻𝓮𝓵𝓮𝓿𝓪𝓷𝓽.

0reactions
Quentamecommented, Oct 18, 2022

Interesting point, I have some issues to check first but I would love to look at this one too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with IMAP after update to core-2022.3.5
Changing server to mail.google.com seems to cause immediate failure after a reboot, and the sensor entity never gets created (left it for about ......
Read more >
Manage Sensors and Sensor-Driven Tests - Cisco Content Hub
The Sensor-Driven Tests window is displayed, listing all the sensor-driven tests configured in the system. It provides information such as the test name, ......
Read more >
Preview - Channel - PRTG Network Monitor - Version History
This sensor allows you to send a HTTP request (HEAD, GET or POST) and use ... and IMAP and POP3 including Roundtrip sensors...
Read more >
Sensors | Dagster Docs
Run keys allow you to write sensor evaluation functions that declaratively describe what job runs should exist, and helps you avoid the need...
Read more >
apache-airflow-providers-amazon Documentation
All classes for this provider package are in airflow.providers.amazon python package. Installation¶. You can install this package on top of an existing Airflow ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found