Hi,
I’m a new user and I’m having trouble getting imap to work with Gmail.
I tried to follow the instructions here - I think I did it right.
Here is what I added to configuration.yaml
sensor:
- platform: imap_email_content
server: imap.gmail.com
port: 993
name: email_from_rob
username: !secret gmail_username
password: !secret gmail_password
senders:
- <me>@gmail.com
This is a test example where I’ve used another email address of mine as the sender so that I can test. To be clear, for testing I’m sending from <me>@gmail.com to gmail_username that I have in secrets.yaml
Below is what I get in the log file. Every 30 seconds there are two pairs of “connection lost” and “reconnect succeeded” messages, 1 second apart.
2021-06-09 05:55:59 INFO (SyncWorker_1) [homeassistant.components.imap_email_content.sensor] Connection to imap.gmail.com lost, attempting to reconnect
2021-06-09 05:55:59 INFO (SyncWorker_1) [homeassistant.components.imap_email_content.sensor] Reconnect to imap.gmail.com succeeded, trying last message
2021-06-09 05:56:00 INFO (SyncWorker_5) [homeassistant.components.imap_email_content.sensor] Connection to imap.gmail.com lost, attempting to reconnect
2021-06-09 05:56:00 INFO (SyncWorker_5) [homeassistant.components.imap_email_content.sensor] Reconnect to imap.gmail.com succeeded, trying last message
2021-06-09 05:56:29 INFO (SyncWorker_4) [homeassistant.components.imap_email_content.sensor] Connection to imap.gmail.com lost, attempting to reconnect
2021-06-09 05:56:29 INFO (SyncWorker_4) [homeassistant.components.imap_email_content.sensor] Reconnect to imap.gmail.com succeeded, trying last message
2021-06-09 05:56:30 INFO (SyncWorker_3) [homeassistant.components.imap_email_content.sensor] Connection to imap.gmail.com lost, attempting to reconnect
2021-06-09 05:56:30 INFO (SyncWorker_3) [homeassistant.components.imap_email_content.sensor] Reconnect to imap.gmail.com succeeded, trying last message
I’ve found some reports of similar issues (new user, can’t post link) but not quite the same.
Note in my case I have never been able to get this sensor to update. It’s not related to some specific scenarios about when the email arrives or when HA is reset… I send an email to the monitored address, I confirm it arrived by checking Gmail, but there is no sign of it in HA. The sensor state is always unknown and I never see any of the ‘body’, ‘subject’, etc attributes
From Developer Tools>States:
Other notes:
I am using a Gmail app password.
I haven’t tried specifying a folder, so it should default to Inbox. The emails are staying in the Inbox. I’m not deleting them. The Inbox is not empty.
Using HA OS on Raspberry PI 4. I bought the HW and installed HA last week.
Additional system data:
System Health
version | core-2021.6.2 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
virtualenv | false |
python_version | 3.8.9 |
os_name | Linux |
os_version | 5.4.83-v8 |
arch | aarch64 |
timezone | America/Los_Angeles |
Home Assistant Cloud
logged_in | false |
---|---|
can_reach_cert_server | ok |
can_reach_cloud_auth | ok |
can_reach_cloud | ok |
Home Assistant Supervisor
host_os | Home Assistant OS 5.13 |
---|---|
update_channel | stable |
supervisor_version | supervisor-2021.05.4 |
docker_version | 19.03.15 |
disk_total | 57.8 GB |
disk_used | 2.8 GB |
healthy | true |
supported | true |
board | rpi4-64 |
supervisor_api | ok |
version_api | ok |
installed_addons | Visual Studio Code (3.4.1) |
Lovelace
dashboards | 2 |
---|---|
resources | 0 |
views | 1 |
mode | storage |
Any suggestions for how to fix, or even additional steps I can take to debug, are greatly appreciated - I don’t even know where to go from here.