Open EagleStClair opened 9 hours ago
Hey there @jbouwh, mind taking a look at this issue as it has been labeled with an integration (imap
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
imap documentation imap source (message by IssueLinks)
Not seeing that with my own IMAP sensors:
Not sure what happens. You could turn on debug logging to see the last received message. When there are no unread messages it should not use another filter. Possible you have some old unread messages?
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.
2024-12-02 10:11:01.443 DEBUG (MainThread) [homeassistant.components.imap.coordinator] Finished fetching imap data in 0.342 seconds (success: True)
2024-12-02 10:11:07.148 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 1 FETCH (UID 343 FLAGS (\\Deleted))\r\n'
2024-12-02 10:11:07.148 INFO (MainThread) [aioimaplib.aioimaplib] ignored untagged response : b'1 FETCH (UID 343 FLAGS (\\Deleted))'
2024-12-02 10:11:11.100 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE98889 NOOP\r\n'
2024-12-02 10:11:11.270 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 1 EXPUNGE\r\nPACE98889 OK NOOP completed (took 2 ms)\r\n'
2024-12-02 10:11:11.271 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE98889 OK NOOP completed (took 2 ms)'
2024-12-02 10:11:11.271 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE98890 SEARCH CHARSET utf-8 UnSeen UnDeleted\r\n'
2024-12-02 10:11:11.447 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE98890 OK SEARCH completed (took 2 ms)\r\n'
2024-12-02 10:11:11.447 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE98890 OK SEARCH completed (took 2 ms)'
2024-12-02 10:11:11.448 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE98891 FETCH ms) BODY.PEEK[]\r\n'
2024-12-02 10:11:11.614 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE98891 BAD Parse Error (took 0 ms)\r\n'
2024-12-02 10:11:11.615 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE98891 BAD Parse Error (took 0 ms)'
2024-12-02 10:11:11.615 DEBUG (MainThread) [homeassistant.components.imap.coordinator] Finished fetching imap data in 0.515 seconds (success: True)
When I turn on debug this is what happens when I delete or mark as read the last unread mail in inbox. There is some bad parse error and ingnored untagged response that is not there as long as there is any unread.
2024-12-02 10:11:01.101 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE98887 NOOP\r\n'
2024-12-02 10:11:01.270 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE98887 OK NOOP completed (took 1 ms)\r\n'
2024-12-02 10:11:01.270 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE98887 OK NOOP completed (took 1 ms)'
2024-12-02 10:11:01.270 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE98888 SEARCH CHARSET utf-8 UnSeen UnDeleted\r\n'
2024-12-02 10:11:01.442 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* SEARCH 1\r\nPACE98888 OK SEARCH completed (took 1 ms)\r\n'
2024-12-02 10:11:01.442 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE98888 OK SEARCH completed (took 1 ms)'
2024-12-02 10:11:01.443 DEBUG (MainThread) [homeassistant.components.imap.coordinator] Finished fetching imap data in 0.342 seconds (success: True)
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. As soon as I delete or mark as read the last unread email in the inbox the error message (first code snippet) shows up and state goes to 5.
Can you turn on debug level logging on homeassistant.components.imap
then supply logging with on item unread, then the second part of the logging where the items has been read?
It might be the search command is not processed correctly or its response is not interpreted correctly. It is assumed that a list of UID's is returned. The length off this list is considered the number of messages. May be the reponse is different and 5 other elements (may be words) are returned.
Can you turn on debug level logging on
homeassistant.components.imap
then supply logging with on item unread, then the second part of the logging where the items has been read?
Isn't that what I added before? Or am I misunderstanding?
2024-12-02 13:27:58.100 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101254 NOOP\r\n'
2024-12-02 13:27:58.268 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE101254 OK NOOP completed (took 1 ms)\r\n'
2024-12-02 13:27:58.268 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101254 OK NOOP completed (took 1 ms)'
2024-12-02 13:27:58.269 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101255 SEARCH CHARSET utf-8 UnSeen UnDeleted\r\n'
2024-12-02 13:27:58.333 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 2 FETCH (UID 349 FLAGS ())\r\n'
2024-12-02 13:27:58.334 INFO (MainThread) [aioimaplib.aioimaplib] ignored untagged response : b'2 FETCH (UID 349 FLAGS ())'
2024-12-02 13:27:58.383 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 2 FETCH (UID 349 FLAGS ())\r\n'
2024-12-02 13:27:58.384 INFO (MainThread) [aioimaplib.aioimaplib] ignored untagged response : b'2 FETCH (UID 349 FLAGS ())'
2024-12-02 13:27:58.441 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* SEARCH 2\r\nPACE101255 OK SEARCH completed (took 3 ms)\r\n'
2024-12-02 13:27:58.441 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101255 OK SEARCH completed (took 3 ms)'
2024-12-02 13:27:58.442 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101256 FETCH 2 BODY.PEEK[]\r\n'
2024-12-02 13:27:58.468 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 2 FETCH (UID 349 FLAGS ())\r\n'
2024-12-02 13:27:58.468 INFO (MainThread) [aioimaplib.aioimaplib] ignored untagged response : b'2 FETCH (UID 349 FLAGS ())'
2024-12-02 13:27:58.772 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 2 FETCH (BODY[] {12377}\r\nReturn-path: <010201938752a454-a3985506-a146-4a78-bb6a-4538fab27142-000000@aws-ses.verisure.com>\r\nOriginal-recipient: rfc822;REDACTED@icloud.com\r\nReceived: from p00-icloudmta-smtpin-us-central-1n-100-percent-11 by p103-mailgateway-smtp-7548596999-tvwrq (mailgateway 2429B41)\r\n\twith SMTP id 11f979e6-79d7-4492-958b-c74588070a72 \r\n\tfor <REDACTED@icloud.com>; Mon, 2 Dec 2024 12:22:49 GMT\r\nX-ICLOUD-MAIL-BWL: 1\r\nX-Apple-MoveToFolder: INBOX \r\nX-Apple-Action: WL/INBOX\r\nX-Apple-UUID: 11f979e6-79d7-4492-958b-c74588070a72\r\nReceived: from a3-4.smtp-out.eu-west-1.amazonses.com (a3-4.smtp-out.eu-west-1.amazonses.com [54.240.3.4])\r\n\tby p00-icloudmta-smtpin-us-central-1n-100-percent-11.p00-icloudmta-smtpin-vip.icloud-mail-production.svc.kube.us-central-1n.k8s.cloud.apple.com (Postfix) with ESMTPS id F22C5C0670F\r\n\tfor <REDACTED@icloud.com>; Mon, 2 Dec 2024 12:22:42 +0000 (UTC)\r\nX-ICL-Info: GAtbRFYDBVFFSlVESwQEUVUKE0oWX1gHVQoPB0UFAkxHTVZZSx4CQhAdW0dJAARSREBVT08FBANBTFJaGQMPWkBMVkFVUQdWQ1RSFk8IGwAXTwdaTAUFWhMYBEVPAQJQWElWR0gABiIUDhVaC1VFTAMcFB4LRUQHWxoJGlhWUl8DHBQeC0VEB1saCRpYQlVfEBgBGx1DQgEZGA8FOFlVDhoMAlkbX1tCHRwKGEVRBU9BVxUaDEAbDQANSBINHUEHBg1LRlZRWwMPFggEHUMYARoURgcMQgsDRlRSWQtdQhJYFhMDVlVDTwIcFQNVARgDGBgcGBZDUxFbGgkaWFRSXwMcFB4LRUQHWxoJGkNRWwMPFggEHUMYARoURhoRVAteRUhWRUgBD1FNTlNFGQQDVlgYVU5ABQNSQ1QHRkwGG1YUTl5aGlIAA1hNU0RAVlcAR05XQ0odBlJFSVZHOFVDTwIcFQNVARgDGBgcGBZDUxFbGgkaRg==\r\nX-ICL-Score: 3.33303333423\r\nAuthentication-Results: bimi.icloud.com; bimi=none\r\nX-ARC-Info: policy=fail; arc=none\r\nAuthentication-Results: arc.icloud.com; arc=none\r\nAuthentication-Results: dmarc.icloud.com; dmarc=pass header.from=verisure.com\r\nX-DMARC-Policy: v=DMARC1; p=reject; rua=mailto:dmarc_rua@emaildefense.proofpoint.com; ruf=mailto:dmarc_ruf@emaildefense.proofpoint.com;fo=1\r\nX-DMARC-Info: pass=pass; dmarc-policy=reject; s=r1; d=r1; pdomain=verisure.com\r\nAuthentication-Results: dkim-verifier.icloud.com;\r\n\tdkim=pass (1024-bit key) header.d=verisure.com header.i=@verisure.com header.b=kbNnj4Cq\r\nAuthentication-Results: dkim-verifier.icloud.com;\r\n\tdkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b=Uchri0j3\r\nAuthentication-Results: spf.icloud.com; spf=pass (spf.icloud.com: domain of 010201938752a454-a3985506-a146-4a78-bb6a-4538fab27142-000000@aws-ses.verisure.com designates 54.240.3.4 as permitted sender) smtp.mailfrom=010201938752a454-a3985506-a146-4a78-bb6a-4538fab27142-000000@aws-ses.verisure.com\r\nReceived-SPF: pass (spf.icloud.com: domain of 010201938752a454-a3985506-a146-4a78-bb6a-4538fab27142-000000@aws-ses.verisure.com designates 54.240.3.4 as permitted sender) receiver=spf.icloud.com; client-ip=54.240.3.4; helo=a3-4.smtp-out.eu-west-1.amazonses.com; envelope-from=010201938752a454-a3985506-a146-4a78-bb6a-4538fab27142-000000@aws-ses.verisure.com\r\nDKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;\r\n\ts=3yt544ffglpcwye6h6aqnsje5ljfufmk; d=verisure.com; t=1733142160;\r\n\th=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding;\r\n\tbh=kdYjOo1yfe3mfUDTFkdECkueJiyjxFK5azv/1y0X5KM=;\r\n\tb=kbNnj4CqOWvo7gXNkux/e4wB5OLRVdLerhB59CxQm+JacMacJT/OM+3TGCp8BNQu\r\n\tLai6IU/1GsHOLCChy48iUaqvBXj7C6774KsyYjg6KfoEDvloNeJ1dCO+QhCYgMKT877\r\n\tlA839nmdv++VziPfjl8xtIGum5eMwmmwEIMcae2c=\r\nDKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;\r\n\ts=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1733142160;\r\n\th=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Feedback-ID;\r\n\tbh=kdYjOo1yfe3mfUDTFkdECkueJiyjxFK5azv/1y0X5KM=;\r\n\tb=Uchri0j3U6fJs1fLh88/6tHbOlbFtbESTrO+w54Xv0rOElGOhNovPoFfP0BY4NEO\r\n\tdun2Yrwfb+3AHEcHjv/wuk/pq4LYCS4+VjhA+dqiTYvXrIRVw1tXeU1wWYBJw/SSewS\r\n\ts9y/vzHVRFClmAD3KLn66f+dAby2rq4lx1UCLAgs=\r\nDate: Mon, 2 Dec 2024 12:22:40 +0000\r\nFrom: Verisure <no-reply@verisure.com>\r\nTo: REDACTED@icloud.com\r\nMessage-ID: <010201938752a454-a3985506-a146-4a78-bb6a-4538fab27142-000000@eu-west-1.amazonses.com>\r\nSubject: =?UTF-8?Q?Uppl=C3=A5st_inifr=C3=A5n?=\r\nMIME-Version: 1.0\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Transfer-Encoding'
2024-12-02 13:27:58.774 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b': quoted-printable\r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jS278E8k4:22 a=3urWGuTZa-U-TZ_dHwj2:22 a=_r3JdlzVTz_TzSp0BUuH:22 a=4RA0bdID1wfY3PaYaTkR:22\r\n\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.=\r\nw3.org/TR/html4/loose.dtd">\r\n\r\n<html>\r\n <head>\r\n <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8=\r\n" />\r\n <link\r\n href=3D"https://fonts.googleapis.com/css?family=3DFira+Sans"\r\n rel=3D"stylesheet"\r\n />\r\n <title></title>\r\n <style>\r\n body {\r\n background: #ffffff;\r\n -webkit-text-size-adjust: none;\r\n }\r\n\r\n h1 {\r\n color: #292929 !important;\r\n font-size: 24px;\r\n font-weight: normal;\r\n }\r\n\r\n h2 {\r\n font-size: 14px;\r\n font-weight: 500;\r\n line-height: 20px;\r\n color: #292929 !important;\r\n }\r\n\r\n a {\r\n color: #ff0033 !important;\r\n text-decoration: none;\r\n }\r\n\r\n td {\r\n padding: 0 16px;\r\n }\r\n\r\n * {\r\n margin: 0;\r\n }\r\n\r\n .main-table {\r\n width: 100%;\r\n max-width: 620px;\r\n margin: 0 auto;\r\n border: 0;\r\n font-family: \'Fira Sans\', sans-serif !important;\r\n color: #7f7f7f !important;\r\n font-size: 14px;\r\n line-height: 24px;\r\n }\r\n\r\n /* im class used by Gmail to mark text in a thread - defaults to purp=\r\nle color */\r\n .im {\r\n color: #7f7f7f !important;\r\n }\r\n\r\n .footer-table {\r\n width: 100%;\r\n max-width: 620px;\r\n margin: 0 auto;\r\n border: 0;\r\n font-family: \'Fira Sans\', sans-serif !important;\r\n color: #7f7f7f !important;\r\n font-size: 12px;\r\n line-height: 24px;\r\n background-color: #efefef;\r\n }\r\n\r\n .button {\r\n border-radius: 3px;\r\n background: white;\r\n height: 40px;\r\n color: #ff0033 !important;\r\n border: 1px solid #dfdfdf;\r\n padding: 0 16px;\r\n text-decoration: none;\r\n display: inline-block;\r\n line-height: 40px;\r\n }\r\n\r\n .button:hover,\r\n .button:active,\r\n .button:focus {\r\n background: #e9e9e9 !important;\r\n }\r\n\r\n @media only screen and (max-device-width: 480px) {\r\n table[class=3D\'table\'],\r\n td[class=3D\'cell\'] {\r\n max-width: 300px !important;\r\n }\r\n table[class=3D\'wide\'],\r\n img[class=3D\'wide\'],\r\n td[class=3D\'wide\'] {\r\n display: none !important;\r\n }\r\n }\r\n </style>\r\n </head>\r\n <body>\r\n <table class=3D"main-table" cellspacing=3D"0">\r\n <!-- LOGO -->\r\n <tr>\r\n <td style=3D"padding-top: 32px;">\r\n <img\r\n src=3D"https://mypages.verisure.com/img/email/verisure_logo_tra=\r\nnsparent.png"\r\n alt=3D"Verisure"\r\n title=3D"Verisure"\r\n id=3D"verisure"\r\n height=3D"40"\r\n />\r\n </td>\r\n </tr>\r\n\r\n <!-- TITLE -->\r\n <tr>\r\n <td>\r\n <h1\r\n style=3D"margin-top:42px; margin-bottom: 21px; color: #292929;=\r\n font-size: 24px; font-weight: normal;"\r\n >\r\n Uppl=C3=A5st inifr=C3=A5n\r\n </h1>\r\n </td>\r\n </tr>\r\n <!-- GREETING -->\r\n <tr>\r\n <td>\r\n <p style=3D"margin-bottom: 21px;">\r\n=09=09=09=09 Groventr=C3=A9 - Grankullegatan 60\r\n </p>\r\n </td>\r\n </tr>\r\n <!-- EMAIL CONTENT -->\r\n <tr>\r\n <td>\r\n Smart l=C3=A5s Groventr=C3=A9, Grankullegatan l=C3=A5stes upp med=\r\n vred fr=C3=A5n insidan.\r\n </td>\r\n </tr>\r\n <!-- SENDER TEXT-->\r\n <tr>\r\n <td>\r\n <p style=3D"margin-bottom: 21px; margin-top:21px">\r\n V=C3=A4nliga h=C3=A4lsningar\r\n <br/>\r\n Verisure\r\n </p>\r\n </td>\r\n </tr>\r\n <!-- FINAL NOTE-->\r\n </table>\r\n\r\n <!-- FOOTER -->\r\n <table class=3D"footer-table" cellspacing=3D"0">\r\n <tr>\r\n <td\r\n valign=3D"top"\r\n style=3D"padding: 16px; box-sizing: border-box; width: 100%;"\r\n >\r\n <h2>Kundtj=C3=A4nst</h2>\r\n <a style=3D"display: block;" href=3D"tel:020724365">\r\n <img\r\n src=3D"https://mypages.verisure.com/img/email/IC_Phone.png"\r\n alt=3D"phone"\r\n height=3D"12"\r\n style=3D"margin-right: 8px; vertical-align: middle; width: 12=\r\npx;"\r\n />\r\n 020-724365\r\n </a>\r\n <h2 style=3D"margin-top: 16px;">\r\n Snabbl=C3=A4nkar\r\n </h2>\r\n <a\r\n style=3D"display:block;"\r\n href=3D"https://www.verisure.se/"\r\n target=3D"_blank"\r\n >Hemsida</a\r\n >\r\n <a\r\n style=3D"display:block;"\r\n href=3D"https://mypages.verisure.com/se/"\r\n target=3D"_blank"\r\n >Mina Sidor</a\r\n >\r\n </td>\r\n <td style=3D"vertical-align: top; padding:16px; text-align: right;"=\r\n>\r\n <a\r\n style=3D"display:block; margin-bottom: 8px;"\r\n href=3D"https://itunes.apple.com/se/app/verisure/id423747572?mt=\r\n=3D8"\r\n >\r\n <img\r\n src=3D"https://mypages.verisure.com/img/appstores/apple_se.pn=\r\ng"\r\n alt=3D"App store"\r\n width=3D"96"\r\n style=3D"max-height: 40px"\r\n />\r\n </a>\r\n <a\r\n style=3D"display:block; margin-bottom: 8px;"\r\n href=3D"https://play.google.com/store/apps/details?id=3Dcom.sdi=\r\n.mobile.android.verisure"\r\n >\r\n <img\r\n src=3D"https://mypages.verisure.com/img/appstores/google_se.p=\r\nng"\r\n alt=3D"Google Play"\r\n width=3D"96"\r\n style=3D"max-height: 40px"\r\n />\r\n </a>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=3D"2">\r\n <hr style=3D"border:1px solid #DFDFDF; " />\r\n <p style=3D"margin-top:12px;margin-bottom: 16px;">\r\n © 2024 Samtliga r=C3=A4ttigheter tillh=C3=B6r Verisure\r\n </p>\r\n </td>\r\n </tr>\r\n </table>\r\n </body>\r\n</html>\r\n)\r\nPACE101256 OK FETCH completed (took 164 ms)\r\n'
2024-12-02 13:27:58.775 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101256 OK FETCH completed (took 164 ms)'
2024-12-02 13:27:58.777 DEBUG (MainThread) [homeassistant.components.imap.coordinator] Message with id 2 (<010201938752a454-a3985506-a146-4a78-bb6a-4538fab27142-000000@eu-west-1.amazonses.com>) processed, sender: no-reply@verisure.com, subject: Upplåst inifrån, initial: False
2024-12-02 13:27:58.778 DEBUG (MainThread) [homeassistant.components.imap.coordinator] Finished fetching imap data in 0.677 seconds (success: True)
2024-12-02 13:28:09.101 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101257 NOOP\r\n'
2024-12-02 13:28:09.271 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE101257 OK NOOP completed (took 1 ms)\r\n'
2024-12-02 13:28:09.271 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101257 OK NOOP completed (took 1 ms)'
2024-12-02 13:28:09.272 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101258 SEARCH CHARSET utf-8 UnSeen UnDeleted\r\n'
2024-12-02 13:28:09.442 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* SEARCH 2\r\nPACE101258 OK SEARCH completed (took 2 ms)\r\n'
2024-12-02 13:28:09.442 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101258 OK SEARCH completed (took 2 ms)'
2024-12-02 13:28:09.443 DEBUG (MainThread) [homeassistant.components.imap.coordinator] Finished fetching imap data in 0.342 seconds (success: True)
2024-12-02 13:28:19.101 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101259 NOOP\r\n'
2024-12-02 13:28:19.292 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE101259 OK NOOP completed (took 12 ms)\r\n'
2024-12-02 13:28:19.292 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101259 OK NOOP completed (took 12 ms)'
2024-12-02 13:28:19.293 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101260 SEARCH CHARSET utf-8 UnSeen UnDeleted\r\n'
2024-12-02 13:28:19.464 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* SEARCH 2\r\nPACE101260 OK SEARCH completed (took 1 ms)\r\n'
2024-12-02 13:28:19.464 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101260 OK SEARCH completed (took 1 ms)'
2024-12-02 13:28:19.465 DEBUG (MainThread) [homeassistant.components.imap.coordinator] Finished fetching imap data in 0.364 seconds (success: True)
2024-12-02 13:28:24.180 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 2 FETCH (UID 349 FLAGS (\\Seen))\r\n'
2024-12-02 13:28:24.180 INFO (MainThread) [aioimaplib.aioimaplib] ignored untagged response : b'2 FETCH (UID 349 FLAGS (\\Seen))'
2024-12-02 13:28:24.223 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 2 FETCH (UID 349 FLAGS (\\Seen))\r\n'
2024-12-02 13:28:24.223 INFO (MainThread) [aioimaplib.aioimaplib] ignored untagged response : b'2 FETCH (UID 349 FLAGS (\\Seen))'
2024-12-02 13:28:24.591 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'* 2 FETCH (UID 349 FLAGS (\\Seen))\r\n'
2024-12-02 13:28:24.591 INFO (MainThread) [aioimaplib.aioimaplib] ignored untagged response : b'2 FETCH (UID 349 FLAGS (\\Seen))'
2024-12-02 13:28:29.101 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101261 NOOP\r\n'
2024-12-02 13:28:29.283 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE101261 OK NOOP completed (took 8 ms)\r\n'
2024-12-02 13:28:29.283 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101261 OK NOOP completed (took 8 ms)'
2024-12-02 13:28:29.283 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101262 SEARCH CHARSET utf-8 UnSeen UnDeleted\r\n'
2024-12-02 13:28:29.453 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE101262 OK SEARCH completed (took 1 ms)\r\n'
2024-12-02 13:28:29.453 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101262 OK SEARCH completed (took 1 ms)'
2024-12-02 13:28:29.453 DEBUG (MainThread) [aioimaplib.aioimaplib] Sending : b'PACE101263 FETCH ms) BODY.PEEK[]\r\n'
2024-12-02 13:28:29.621 DEBUG (MainThread) [aioimaplib.aioimaplib] Received : b'PACE101263 BAD Parse Error (took 0 ms)\r\n'
2024-12-02 13:28:29.622 DEBUG (MainThread) [aioimaplib.aioimaplib] tagged status b'PACE101263 BAD Parse Error (took 0 ms)'
2024-12-02 13:28:29.622 DEBUG (MainThread) [homeassistant.components.imap.coordinator] Finished fetching imap data in 0.521 seconds (success: True)
Here is the debug log when an unread message is found and then when it is marked as read. The sensor then goes from 1 to 5 when there is no unread message anymore.
From what point in the logging was the last message marked as read?
It seems it tries to fetch ms)
instead of a uid.
In response: PACE101262 OK SEARCH completed (took 1 ms)
It seems to be a last part of a response
From what point in the logging was the last message marked as read?
From the INFO-messages I would say, last 15 lines. Where the bad parse lines show up.
Seem my edited last response: https://github.com/home-assistant/core/issues/132042#issuecomment-2511455874
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.
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