On startup, HA reports that automations that use the SMTP notification are broken, if the SMTP server is not currently reachable.
On clicking fix, the issue goes away by itself without doing anything.
2024-08-28 22:20:42.438 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform smtp
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/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/local/lib/python3.12/site-packages/homeassistant/components/smtp/notify.py", line 103, in get_service
if mail_service.connection_is_valid():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/components/smtp/notify.py", line 165, in connection_is_valid
server = self.connect()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/components/smtp/notify.py", line 151, in connect
mail = smtplib.SMTP(self._server, self._port, timeout=self._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 312, in _get_socket
return socket.create_connection((host, port), timeout,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/socket.py", line 853, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.12/socket.py", line 838, in create_connection
sock.connect(sa)
OSError: [Errno 113] Host is unreachable
In my particular case the SMTP forwarder I use is started in a different docker compose stack, regardless, the notification should not cause errors on startup just because the SMTP server may be down at that particular time.
What version of Home Assistant Core has the issue?
core-2024.8.3
What was the last working version of Home Assistant Core?
2024-08-28 22:20:42.438 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform smtp
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/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/local/lib/python3.12/site-packages/homeassistant/components/smtp/notify.py", line 103, in get_service
if mail_service.connection_is_valid():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/components/smtp/notify.py", line 165, in connection_is_valid
server = self.connect()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/homeassistant/components/smtp/notify.py", line 151, in connect
mail = smtplib.SMTP(self._server, self._port, timeout=self._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 312, in _get_socket
return socket.create_connection((host, port), timeout,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/socket.py", line 853, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.12/socket.py", line 838, in create_connection
sock.connect(sa)
OSError: [Errno 113] Host is unreachable
The problem
On startup, HA reports that automations that use the SMTP notification are broken, if the SMTP server is not currently reachable.
On clicking fix, the issue goes away by itself without doing anything.
Issue had been previously reported and supposedly fixed, but maybe not?
https://github.com/home-assistant/core/pull/27240
In my particular case the SMTP forwarder I use is started in a different docker compose stack, regardless, the notification should not cause errors on startup just because the SMTP server may be down at that particular time.
What version of Home Assistant Core has the issue?
core-2024.8.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Core
Integration causing the issue
smtp
Link to integration documentation on our website
https://www.home-assistant.io/integrations/smtp/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response