Shortly after updating to core-2022.3.5, I am experiencing problems with an IMAP sensor. I only added this sensor ~5 days ago, but it’s been working fine until I updated HA & restarted the server…
Issue: my email sensor entity no longer exists (“entity not available”), looks like it doesn’t get created when HA starts up…
Searching the logs for “IMAP”, there is only one line: a warning, no error:
2022-03-16 16:10:09 WARNING (MainThread) [homeassistant.components.sensor] Platform imap not ready yet: None; Retrying in background in 30 seconds
Normally, that sensor is available within a few minutes of rebooting, tops (I’ve actually never seen it unavailable before - I have a lovelace card that shows it’s status).
However, now it’s been 4 hours and counting. Surely that would be more than enough time? If not, how long would be a reasonable period to wait before considering it “broken”?
No, nothing else in the logs at all (searching for “imap” or “emailsensor”)
Only thing is the one warning (singluar) Platform imap not ready yet: None; Retrying in background in 30 seconds. This warning appears once, after a reboot.
I will try recreate this sensor from scratch now, including generating a new Google Account App Passport…
I deleted the old AppPassword in my Google Account Security Settings, and generated a new App Password.
The pasted the new IMAP App Password into configuration.yaml.
The emailsensor is now working again.
(I’ve checked all my email, searching for any e.g “security check” emails from google, or anything at all, to indicate any form of issue - nothing found. And no messages in the HA logs to indicate what the problem might have been. All I know is it happened just after I updated core to the latest version)
Google is using some fingerprinting tricks to identify a connecting application and thereby prevent unauthorized access. The update to HA might have triggered a different fingerprint.
I looked up IMAP.gmail.com on a website earlier and noticed that it redirected to mail.google.com
I do not know if that is temporary or permanent, but maybe try putting mail.google.com in for now and see if that solves the error.
If it does then the add-on does not handle redirections correctly.
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 an hour). Log:
Logger: homeassistant.components.sensor
Source: /usr/local/lib/python3.9/asyncio/events.py:80
Integration: Sensor (documentation, issues)
First occurred: 8:59:26 PM (2 occurrences)
Last logged: 8:59:44 PM
Setup of sensor platform imap is taking over 10 seconds.
Reverted back to imap.gmail.com, and it appears to be working (the next trigger email is due tomorrow), however, I do see the following warnings in the log:
Logger: homeassistant.components.imap.sensor
Source: components/imap/sensor.py:182
Integration: imap (documentation, issues)
First occurred: 3:43:52 PM (11 occurrences)
Last logged: 8:34:37 PM
Lost imap.gmail.com (will attempt to reconnect)
The lost message might just be that googles server closed the connection due to no activity.
Its just a guess, but I know many servers operate like that to save resources.
Did you figure out the underlying cause? I’ve been seeing this error hundreds of times in the logs since upgrading to Home Assistant 2022.7.0 a few days ago. Running 2022.7.3 now, and the problem is still there.
I see the same - on two different post (IMAP) servers:
2022-07-12T07:03:57.417762950Z 2022-07-12 09:03:57 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform imap is taking over 10 seconds.
2022-07-12T07:03:57.421190052Z 2022-07-12 09:03:57 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform imap is taking over 10 seconds.
It came opgrading to (core) til 2022.7.2 (can remember from what version) and remains in 2022.7.3 - connection to port 993 on the servers work fine from the OS using telnet.
Both sensors just say: entity not available: sensor.xxxxx_gmail.com etc.