The problem
After restarting HA some Shelly devices appear sporadically unconnected. All devices types are affected, be it Shelly1 oder 2.5. What helps is to force them to reconnect (yes, they are already connected and can be pinged via terminal) them to my wifi (in my Unifi controller add-on) and reload the integration afterwards. As this affects all device types and after every particular restart of HA different devices appear unconnected I am putting it down to an issue with the integration. I cannot say exactly when the issue occurred first but what I am sure about is that it started during the 2022.12 cycle.
Logger: homeassistant.components.websocket_api.http.connection
Source: components/shelly/entity.py:349
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 08:25:54 (11 occurrences)
Last logged: 09:02:11
[547177164672] Setting state for entity Rollo Wohnzimmer failed, state: {'go': 'open'}, error: DeviceConnectionError()
[547177164672] Setting state for entity Rollo Küche failed, state: {'go': 'to_pos', 'roller_pos': 100}, error: DeviceConnectionError()
[547177164672] Setting state for entity Rollo Schlafzimmer failed, state: {'go': 'open'}, error: DeviceConnectionError()
[547177164672] Setting state for entity Rollo Bad failed, state: {'go': 'open'}, error: DeviceConnectionError()
[547559197904] Setting state for entity Lenes Rollo failed, state: {'go': 'open'}, error: DeviceConnectionError()
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
return await fut
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.0.84', 80)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aioshelly/block_device.py", line 259, in http_request
resp: ClientResponse = await self.aiohttp_session.request(
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.84:80 ssl:default [Connect call failed ('192.168.0.84', 80)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 346, in set_state
return await self.block.set_state(**kwargs)
File "/usr/local/lib/python3.10/site-packages/aioshelly/block_device.py", line 481, in set_state
return await self.device.http_request(
File "/usr/local/lib/python3.10/site-packages/aioshelly/block_device.py", line 276, in http_request
raise DeviceConnectionError from err
aioshelly.exceptions.DeviceConnectionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1745, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1782, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/shelly/cover.py", line 123, in async_open_cover
self.control_result = await self.set_state(go="open")
File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 349, in set_state
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Setting state for entity Rollo Küche failed, state: {'go': 'open'}, error: DeviceConnectionError()
What version of Home Assistant Core has the issue?
2022.12.8
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
Shelly
Link to integration documentation on our website
https://www.home-assistant.io/integrations/shelly/
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
integration: shelly