IMAP integration allows one sensor failure to prevent all IMAP sensors from initialising
See original GitHub issueThe 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:
and continues, failing on the SELECT operation, which triggers an exception. This exception causes async_setup_platform to raise PlatformNotReady:
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
logincall. - 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:
- Created 2 years ago
- Comments:5 (1 by maintainers)

Top Related StackOverflow Question
𝓢𝓽𝓲𝓵𝓵 𝓻𝓮𝓵𝓮𝓿𝓪𝓷𝓽.
Interesting point, I have some issues to check first but I would love to look at this one too.