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
71.66k stars 29.95k forks source link

Shelly devices suddenly offline after 2024.9.0 #125465

Open wessa66 opened 2 weeks ago

wessa66 commented 2 weeks ago

The problem

Suddenly after 2024.9.0, my some (3 out 32) of the shelly devices doesn´t get online

Attached debug log from one of my devices shelly dimmer 2 on firmware 20230913-114008/v1.14.0-gcb84623 and now I don´t want to downgrade as there was a major DB update done or is that possible to do?

What version of Home Assistant Core has the issue?

2024.9.0

What was the last working version of Home Assistant Core?

2024.8.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

shelly

Link to integration documentation on our website

No response

Diagnostics information

Document.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 2 weeks ago

Hey there @balloob, @bieniu, @thecode, @chemelli74, @bdraco, mind taking a look at this issue as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `shelly` 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 shelly` 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)


shelly documentation shelly source (message by IssueLinks)

kryanth commented 1 week ago

I'm seeing this in my logs when attempting to send shelly commands :

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:245 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 6:49:25 PM (1 occurrences) Last logged: 6:49:25 PM

[547282077728] Unexpected exception Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1073, in _wrap_create_connection sock = await aiohappyeyeballs.start_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection raise first_exception File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 81, in start_connection sock = await _connect_sock( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 166, in _connect_sock await loop.sock_connect(sock, address) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.1.15', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aioshelly/block_device/device.py", line 319, in http_request resp: ClientResponse = await self.aiohttp_session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 657, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 564, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 975, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1088, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.15:80 ssl:default [Connect call failed ('192.168.1.15', 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 337, in set_state return await self.block.set_state(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aioshelly/block_device/device.py", line 551, in set_state return await self.device.http_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aioshelly/block_device/device.py", line 350, in http_request return await self.http_request(method, path, params, retry=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aioshelly/block_device/device.py", line 355, in http_request raise self._last_error from err aioshelly.exceptions.DeviceConnectionError: Cannot connect to host 192.168.1.15:80 ssl:default [Connect call failed ('192.168.1.15', 80)]

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 245, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/shelly/switch.py", line 270, in async_turn_off self.control_result = await self.set_state(turn="off") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 340, in set_state raise HomeAssistantError( homeassistant.exceptions.HomeAssistantError: Setting state for entity shelly1-58BF25D83E2A failed, state: {'turn': 'off'}, error: DeviceConnectionError(ClientConnectorError(ConnectionKey(host='192.168.1.15', port=80, is_ssl=False, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=-4145887780870897253), OSError(113, "Connect call failed ('192.168.1.15', 80)")))

kryanth commented 1 week ago

My Shelly's are online, have not had previous issues, and I've had to fall back to using the Shelly app for these. It's a little intermittent with them but mostly not working, and only since the upgrade to 9.0 / 9.1

wessa66 commented 1 week ago

I downgraded to 2024.8.3 now they are online again , but I was forced to move them to another Access point

ekalle-swe commented 1 week ago

My devices seams to be online but you can't control any entities. If you flick a switch that is off to on, it will revert to off in a few second and the Shelly app will not show any action. Devices hasn't changed state for 4 days, according to developer tools/state This goes for ALL my Shelly devices. Only devices that are working is the add-ons. The switches on the shelly that the add-on are attached to are not working. If I use the Shelly app, everything works alright but home assistant will not recognise any change of state, when controled from the app. This bug must be prio-1 as it renders all shelly useless.

ekalle-swe commented 1 week ago

Ahhh!

I think it was 9.1 that messed things up and it has do with network access, probably. A ha version upgrade does not do a reboot, only a restart. Only haos upgrades does a reboot. I tested to restart so many times, with no change. As a last test I did a reboot. A bit of a defeat. All Linux reboots with uptime less then 365days is. Anyway. After rebooting the os, shelly works again.

kryanth commented 1 week ago

Rebooting sometimes helps but the problem seems somewhat intermittent and I think maybe some update to aiohttp has impacted them. Still a problem here.

bieniu commented 1 week ago

@wessa66 Please check if the problem occurs if you restart HA to safe mode. If so, please attach a longer log, a log that describes only 30 seconds is not representative.

I was forced to move them to another Access point

So it could be a network issue and not integration related?

@kryanth @ekalle-swe Open post is about DeviceConnectionTimeoutError in log, your errors/behavior are completely different. Please open separate issue, attach debug log for Shelly integration and diagnostics file.

Thanks

wessa66 commented 1 week ago

@wessa66 Please check if the problem occurs if you restart HA to safe mode. If so, please attach a longer log, a log that describes only 30 seconds is not representative.

I was forced to move them to another Access point

So it could be a network issue and not integration related?

@kryanth @ekalle-swe Open post is about DeviceConnectionTimeoutError in log, your errors/behavior are completely different. Please open separate issue, attach debug log for Shelly integration and diagnostics file.

Thanks

Hi will try this on Friday as I´m out and travling at the moment (doesn´t want to interupt my prod environment remotely) and need to upgrade to 2024.9.1 again as I downgraded it to 2024.8.3.

teslarro commented 1 week ago

@wessa66 Please check if the problem occurs if you restart HA to safe mode. If so, please attach a longer log, a log that describes only 30 seconds is not representative.

I was forced to move them to another Access point

So it could be a network issue and not integration related? @kryanth @ekalle-swe Open post is about DeviceConnectionTimeoutError in log, your errors/behavior are completely different. Please open separate issue, attach debug log for Shelly integration and diagnostics file. Thanks

Hi will try this on Friday as I´m out and travling at the moment (doesn´t want to interupt my prod environment remotely) and need to upgrade to 2024.9.1 again as I downgraded it to 2024.8.3.

Same for me... tried to start 2024.9.1 in safe mode, but no chance adding a Shelly1 (neither with mcast nor unicast)

T81 commented 1 week ago

Some issues here too. Shelly Tough BLU buttons stopped working. Unpaired one and after pairing it again it is missing the button entity

thecode commented 1 week ago

Some issues here too. Shelly Tough BLU buttons stopped working. Unpaired one and after pairing it again it is missing the button entity

BLU button is part of the BTHome integration, not Shelly integration, please create an issue for BTHome

T81 commented 5 days ago

Some issues here too. Shelly Tough BLU buttons stopped working. Unpaired one and after pairing it again it is missing the button entity

BLU button is part of the BTHome integration, not Shelly integration, please create an issue for BTHome

Right. I commented there about that. I also have issues with Shelly Plus 1, which is also not connecting. I reload the device, it connects for a minute or so and then disconnects. It seems something broke Shelly integration both wifi and Bluetooth

wessa66 commented 5 days ago

Hi I have rebooted the system (not in safe mode) with 2024.9.1 and what I can see I doesn´t have any problems at the moment(what I can see), however I have attached my log from a reboot with shellydebug enabled, currently I have eight shelly devices offline (this is done on purpose)

home-assistant_shelly_2024-09-16T06-40-29.216Z.log

axute commented 5 days ago

Same issue here, also with 2024.9.1 and also now with 2024.9.2.

Everything on the web interface is literally dead, and the API can no longer be used either. I suspect that the reboot works - if the device has not completely disappeared in HA - via the CioT interface, I think. I did a reset with a device that was accessible, set everything up again, after it was in HA, it was only online for 3 minutes, then it was dead. The physical buttons on the Shelly still work, but nothing works in HA, the device cannot be configured.

I am currently in the process of converting my Shelly's to ESP Home. It would be a shame if it really is due to the Shelly integration.

By the way, no problems with ESPHome firmware, on the contrary. Some of the 4 year old devices are working perfectly again. (Shelly1 gen1, Shelly 2.5 gen1)

wessa66 commented 4 days ago

Hi now I upgraded to 2024.9.2 and three of my shelly was not avail/offline , so I started i safe mode and had debugging on in Shelly, attached is the log Tried to downgrade with "ha core update --version 2024.8.3" but this didn´t work as those shelly devices was deleted from "core.config_entries" so I rolled back a snapshot (running in VmWare) and they worked for 5 minutes then they was not responsive as they where unplugged.

I got them to work under 2024.8.3 by unplugging them for approx 60 sec and then connected them again

home-assistant_shelly_2024-09-17T06-30-18.031Z.log

thecode commented 4 days ago

@wessa66 from your previous comments:

Suddenly after 2024.9.0, my some (3 out 32) of the shelly devices doesn´t get online I downgraded to 2024.8.3 now they are online again , but I was forced to move them to another Access point I got them to work under 2024.8.3 by unplugging them for approx 60 sec and then connected them again

Are these the same 3 devices all the time? Why do you need to reconnect or unplug the devices if the problem is in Home Assistant? When you are on 2024.8.3 all the devices work correctly?

The attached log show that 9 different devices has communication errors, HA retry to connect to them without success. Can you download the diagnostics from the device card in Home Assistant and attach it in a comment.

Thanks

davidrpfarinha commented 4 days ago

config_entry-shelly-1257ef6ba924e01540a792e8261aa820.json Having a similar issue. Since 2024.9.0, I started to notice that these two Shellys keep getting "disconnected" from HA. image What is odd, is that there is no pattern at all. Tried to restart them, but nothing change. image

I've enabled the debug logs, and will attached them whenever I see any other drop in connection

thecode commented 4 days ago

Having a similar issue.

@davidrpfarinha This is a different issue, please create a new issue

davidrpfarinha commented 4 days ago

Having a similar issue.

@davidrpfarinha This is a different issue, please create a new issue

Thanks for the heads-up, @thecode. I thought the original issue was for the device disconnected.