-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Imap sensor defaults to state 5 when no emails found #132042
Comments
Hey there @jbouwh, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) imap documentation |
Sorry I forgot to mention that I also have another sensor with the same integration for my gmail, there I don't see the same behavior so I suppose it has to do with icloud email somehow. No I can't find any old unread emails, not in inbox and not in any other folder either.
When I turn on debug this is what happens when I delete or mark as read the last unread mail in inbox.
|
Hmm, that is weird. What email provider do you use, is there a way I can test / reproduce this? |
The ones that gives this issue is Apple iCloud. I also have gmail but that one works perfectly fine. It behaves like this as soon as I have 0 unread in inbox, and has been doing so since I set it up. |
Right, so the debug logging with the search error is when there are no message on an imap icloud sensor |
exactly, the second code snip (without errors) is where I do have an unread email, no errors and repeating over and over. |
Can you turn on debug level logging on |
It might be the search command is not processed correctly or its response is not interpreted correctly. |
Isn't that what I added before? Or am I misunderstanding?
Here is the debug log when an unread message is found and then when it is marked as read. |
From what point in the logging was the last message marked as read? |
It seems it tries to fetch In response: |
From the INFO-messages I would say, last 15 lines. Where the bad parse lines show up. |
Seem my edited last response: #132042 (comment) |
Hello, I did attempt to reproduce it on Gmail, but I didn't got issue. iCloud Mail should be used to test it. |
It seems the search response does not have an empty line where the UID's are expected. In stead the status line was assumed to provide the UID's, but this is wrong. Not sure iCloud is following the RFC https://datatracker.ietf.org/doc/html/rfc3501#section-7.2.5 though. |
That is because Gmail does not have this issue, neither other known services and neither opensource implementations like Dovecot (which I use myself). |
The problem
I have a imap sensor setup with default options:
imap account is an icloud email. Whenever the mailbox is empty or all emails are read the state is 5 for some reason. When there is an unread email in the inbox it seems to work reliably.
Not a major issue since I use events to trigger automation but for use of the sensor to trigger automation when above 0 or increasing or some other trigger it would not work.
What version of Home Assistant Core has the issue?
2024.11.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
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
No response
The text was updated successfully, but these errors were encountered: