core: 2022.7.x causes issue with IMAP sensor

The problem

Log errors and sensor not created

What version of Home Assistant Core has the issue?

2022.7.0b5

What was the last working version of Home Assistant Core?

2022.6.x

What type of installation are you running?

Home Assistant Supervised

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

# Alarm Emails
# - platform: imap
#   name: Alarm Triggers
#   server: imap.gmail.com
#   port: 993
#   username: !secret outlooksyncuser
#   password: !secret outlooksyncpass
#   folder: inbox
#   search: !secret alarmnotification

Anything in the logs that might be useful for us?

2022-07-06 11:27:01 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1119, in _create_connection_transport
    await waiter
  File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 637, in _on_handshake_complete
    raise handshake_exc
  File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 682, in _process_write_backlog
    ssldata = self._sslpipe.do_handshake(
  File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 116, in do_handshake
    self._sslobj = self._context.wrap_bio(
  File "/usr/local/lib/python3.10/ssl.py", line 527, in wrap_bio
    return self.sslobject_class._create(
  File "/usr/local/lib/python3.10/ssl.py", line 866, in _create
    sslobj = context._wrap_bio(
ssl.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:801)

No error when I disable imap sensor in config and restart

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 8
  • Comments: 43 (8 by maintainers)

Most upvoted comments

I’ve pinged the author of the library, asking him if he would consider bumping/releasing the library with just that fix. 🙏

OK I fixed this until they get around to fixing it upstream. It’s here as a custom component if anyone else wants to try it. https://github.com/DavidFW1960/home-assistant/tree/master/custom_components/imap

This seems to be a problem in the dependency. I’ve created an issue upstream:

https://github.com/bamthomas/aioimaplib/issues/78

Am I setting this up incorrectl

Looks like it. You need to download those 5 files into config/custom_components/imap directory

The upstream aioimaplib has released a fixed 1.0.1 version so this can be resolved for Home Assistant now by a version bump.

(The email content integration is unrelated to this one and any problems there are separate issues.)

There is a text editor you can use on your mac. Or you can use gitzip to download the folder. You need to click on the raw button when you open the file and select all and copy/paste to a local file

Really odd, I couldn’t get the correct file sizes using raw or GitZip, but it’s working now anyway, thank you.

It’s likely just some spaces or blank lines at the end. Also check which line terminations you are using. Linux is generally only LF not CRLF so that is probably the difference.

Sorry for the extremely dumb question but how do I download the folder from https://github.com/DavidFW1960/home-assistant/tree/master/custom_components/imap I very rarely use GitHub but when I have, there has always been a download zip file if I remember correctly

You can go to the parent page ( https://github.com/DavidFW1960/home-assistant ) and download the zip file. From there you can then just extract the IMAP folder.

Sounds like you’re copying some junk. Click on RAW to see just the code

Upstream fix merged but HA 2022.8.0b1 still hasn’t merged yet

We can’t as upstream did indeed merge it, but hasn’t released anything yet. Hence, we have nothing to change or merge on our end and are awaiting upstream.

No its not HACS compliant and there will be no updates. Its just a stopgap till its fixed upstream and rolled into core

got it, thanks for your great work

because thecode bumps aioimaplib to 1.0.0 (https://github.com/home-assistant/core/pull/74393), i though maybe he can help us. i have no other malice.

I’m not sure why you ping/pull people into this issue @scxs535. Please don’t do that.

Mentioning people for getting attention to an issue, can come across as demanding (even when that is not your intention). So please, don’t do that. We have a bot active that handles that automatically (if appropriate and needed).

Thanks 👍

…/Frenck

@thecode could you please check this? Thanks