home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.71k stars 28.87k forks source link

Waze Travel Time conflicting with SMTP #118654

Open DcR-NL opened 1 month ago

DcR-NL commented 1 month ago

The problem

Whenever I enable Waze Travel Time, my SMTP integration stops working. Does it touch global certificates or SSL settings in any way?

Reproducible for me in this way:

  1. Spin up a new Docker Home Assistant Container (2024.5.5);
  2. Add SMTP notify to config. See example yaml snippet for the complete configuration.yaml I'm using. Obviously, credentials had to be removed to be able to post it here;
  3. Confirm working by using the _notify.mailme service;
  4. Enable the Waze Travel Time integration with origin 52.366986222956314,4.89043329043077, destination 51.924500522056206,4.475371380080934 and region Europe;
  5. Try using the _notify.mailme service again, it fails with Failed to call service notify.mail_me. Unknown error. See added logs.

Solution:

  1. Delete Waze Travel Time integration;
  2. Restart Home Assistant;
  3. Confirm working _notify.mailme service.

What version of Home Assistant Core has the issue?

core-2024.5.5

What was the last working version of Home Assistant Core?

core-2024.5.4

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Waze Travel Time

Link to integration documentation on our website

https://www.home-assistant.io/integrations/waze_travel_time/

Diagnostics information

No response

Example YAML snippet

default_config: 

notify:
  - name: "mail_me"
    platform: smtp
    server: "mail.infomaniak.com"
    port: 465
    encryption: tls
    sender: "MY@USER"
    recipient: "MY@USER"
    username: "MY@USER"
    password: "MY PASSWORD"

Anything in the logs that might be useful for us?

Result of step 5:

2024-06-02 20:25:07.111 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: [SSL] unknown error (_ssl.c:1000)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 275, in _async_notify_message_service
await self.async_send_message(**kwargs)
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 251, in async_send_message
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 224, in send_message
return self._send_email(msg, recipients)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 228, in _send_email
mail = self.connect()
^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 144, in connect
mail = smtplib.SMTP_SSL(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 1022, in __init__
SMTP.__init__(self, host, port, local_hostname, timeout,
File "/usr/local/lib/python3.12/smtplib.py", line 255, in __init__
(code, msg) = self.connect(host, port)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 341, in connect
self.sock = self._get_socket(host, port, self.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 1029, in _get_socket

And when I try to reload the 'SMTP NOTIFY SERVICE' from the developer tools between step 5 and 6, I get:

2024-06-02 20:26:48.157 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform smtp
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 104, in async_setup_platform
notify_service = await hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 103, in get_service
if mail_service.connection_is_valid():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 165, in connection_is_valid
server = self.connect()
^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 144, in connect
mail = smtplib.SMTP_SSL(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 1022, in __init__
SMTP.__init__(self, host, port, local_hostname, timeout,
File "/usr/local/lib/python3.12/smtplib.py", line 255, in __init__
(code, msg) = self.connect(host, port)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 341, in connect
self.sock = self._get_socket(host, port, self.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 1029, in _get_socket
new_socket = self.context.wrap_socket(new_socket,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 1042, in _create
self.do_handshake()
File "/usr/local/lib/python3.12/ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL] unknown error (_ssl.c:1000)
new_socket = self.context.wrap_socket(new_socket,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 1042, in _create
self.do_handshake()
File "/usr/local/lib/python3.12/ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL] unknown error (_ssl.c:1000)
2024-06-02 20:25:07.119 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140189699873984] Error handling message: Unknown error (unknown_error) usr from 192.168.0.10 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 793, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1731, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 503, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 533, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 275, in _async_notify_message_service
await self.async_send_message(**kwargs)
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 251, in async_send_message
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 224, in send_message
return self._send_email(msg, recipients)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 228, in _send_email
mail = self.connect()
^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 144, in connect
mail = smtplib.SMTP_SSL(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 1022, in __init__
SMTP.__init__(self, host, port, local_hostname, timeout,
File "/usr/local/lib/python3.12/smtplib.py", line 255, in __init__
(code, msg) = self.connect(host, port)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 341, in connect
self.sock = self._get_socket(host, port, self.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/smtplib.py", line 1029, in _get_socket
new_socket = self.context.wrap_socket(new_socket,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 1042, in _create
self.do_handshake()
File "/usr/local/lib/python3.12/ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL] unknown error (_ssl.c:1000)

Additional information

No response

home-assistant[bot] commented 1 month ago

Hey there @eifinger, mind taking a look at this issue as it has been labeled with an integration (waze_travel_time) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `waze_travel_time` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign waze_travel_time` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


waze_travel_time documentation waze_travel_time source (message by IssueLinks)

ThinkPadNL commented 1 day ago

How did you found out that the Waze integration was causing the issue? I am having the same error with SMTP (using SMTP2Go as mailhost), but i don't use the Waze integration.

DcR-NL commented 1 day ago

By verifying my SMTP config to be functional in a fresh instance of the official container. Followed by duplicating my original container (copy data/config mount) and playing a little game of integration elimination until SMTP started working again.

ThinkPadNL commented 11 hours ago

When clicking the 'View known issues' link at the SMTP-component, i see that there are multiple issues since March. I think i will switch my remaining automations that were using mail, over to Pushover as that has been working flawlessly for me.