core icon indicating copy to clipboard operation
core copied to clipboard

Shelly plus 1PM connectivity issues with FW version >1.0.0

Open easter-blok opened this issue 1 year ago • 35 comments

The problem

Since the Shelly Plus 1PM's received the new 1.x.x FW updates I am having constant connectivity issues with the devices in Home Assistant. They sporadically become unavailable. I did search forums but haven't found anything on this topic. Until now I reverted back to the old legacy 0.14.x FW, but with the latest HA Core 2024.01 release the devices don't work any more with the old FW, I saw messages like this in the home-assistant.log:

File "/usr/local/lib/python3.11/site-packages/aioshelly/common.py", line 103, in get_info raise fw_error aioshelly.exceptions.FirmwareUnsupported: {'name': None, 'id': 'shellyplus1pm-441793a6a668', 'mac': '441793A6A668', 'model': 'SNSW-001P16EU', 'gen': 2, 'fw_id': '20230308-091612/0.14.1-g22a4cb7', 'ver': '0.14.1', 'app': 'Plus1PM', 'auth_en': False, 'auth_domain': None} 2024-01-04 08:06:04.654 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry shellyplus1pm-b48a0a21c90c for shelly

So I updated to the lates 1.1.0 FW but the device still becomes unavailable every now and then.

After some debugging I suspect this is a Home Assistant integration issues, since even when the device is Unavailable in HA it still works and is online in the Shelly App. After rebooting the device in the dedicated Shelly app they again appear in Home Assistant. Please could you have a look at this and help me to further debug this issue?

I just have this issue with the Plus 1PM's I also have a shelly pro 3em I haven't encountered any issue with this device.

What version of Home Assistant Core has the issue?

core-2024.1.0

What was the last working version of Home Assistant Core?

core-2023.12.x

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

config_entry-shelly-6d52ca9a1b9686e606cffa2f8e98d547.json.txt config_entry-shelly-4f19f1c90b2fe1e244b8e7f85a3a9d30.json.txt home-assistant_shelly_2024-01-05T07-31-05.344Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

This I found in the home-assistant.log

2024-01-04 15:37:10.187 ERROR (MainThread) [homeassistant.components.shelly] Unexpected error fetching shellyplus1pm-441793a6a668 data: Already initializing
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/shelly/coordinator.py", line 529, in _async_update_data
    await self.device.initialize()
  File "/usr/local/lib/python3.11/site-packages/aioshelly/rpc_device/device.py", line 142, in initialize
    raise RuntimeError("Already initializing")
RuntimeError: Already initializing
2024-01-04 15:45:00.370 WARNING (MainThread) [homeassistant.helpers.entity_component] Forced update failed. Entity binary_sensor.latitude_longitude_protection_window not found.
2024-01-04 15:45:00.371 WARNING (MainThread) [homeassistant.helpers.entity_component] Forced update failed. Entity sensor.latitude_longitude_current_uv_index not found.
2024-01-04 15:51:18.187 ERROR (MainThread) [homeassistant.components.shelly] Unexpected error fetching shellyplus1pm-441793a6a668 data: Already initializing
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/shelly/coordinator.py", line 529, in _async_update_data
    await self.device.initialize()
  File "/usr/local/lib/python3.11/site-packages/aioshelly/rpc_device/device.py", line 142, in initialize
    raise RuntimeError("Already initializing")
RuntimeError: Already initializing

Additional information

In the attached log, for example there is a disconnect at 2024-01-05 07:28:29 and at 2024-01-05 08:11:25 the same device miraculously appears again.

easter-blok avatar Jan 05 '24 07:01 easter-blok

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)

home-assistant[bot] avatar Jan 05 '24 07:01 home-assistant[bot]

I have the same issue, after 2024.01 update most of my shelly devices are offline. All available in shelly app, but in HA they dont work anymore. Thought - maybe shelly FW need to update, so updated all devices to newest firmware, but still - they are offline in HA. As I noticed, most of them not - PRO devices (Shelly 1L, Shelly 1, Shelly 2.5...) Screenshot_1 For example shelly 2.5 for controlling the blinds. image

artismiezitis avatar Jan 06 '24 08:01 artismiezitis

Same issue for me, all devices are the latest firmware versions 1.14. It seems to be affecting older devices (Shelly 1), my Shelly 2PM is working fine.

willbeeching avatar Jan 06 '24 09:01 willbeeching

Last HA update i received few minutes ago - fixed the issue! Everything is back online. Thank You.

artismiezitis avatar Jan 06 '24 14:01 artismiezitis

Issue still persists after HA Core update 2024.1.2. I still see the same sporadical dissapearing disappearing of all my Shelly plus 1PM devices, although in the Shelly app they are online. Please if you could advise how to debug this further or if you need more information from me to fix this issue in the integration. Thank you.

easter-blok avatar Jan 06 '24 23:01 easter-blok

Please provide fresh log after updating to 2024.1.2

chemelli74 avatar Jan 07 '24 01:01 chemelli74

Same for me. HA 2024.1.2 (Plus1PM 1.1.0):

Logger: homeassistant.components.shelly
Source: helpers/update_coordinator.py:300
Integration: Shelly (documentation, issues)
First occurred: 6. Januar 2024 um 18:02:27 (6 occurrences)
Last logged: 06:42:06

Unexpected error fetching ShellyPlus1PM-Waschmaschine data: Already initializing
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/shelly/coordinator.py", line 533, in _async_update_data
    await self.device.initialize()
  File "/usr/local/lib/python3.11/site-packages/aioshelly/rpc_device/device.py", line 142, in initialize
    raise RuntimeError("Already initializing")
RuntimeError: Already initializing

But I am not sure, what could be the root-cause of these problems. UDM-Pro shows Plus1PM as connected to WLAN with "Experience = Excellent" while Shelly-UI is not reachable. So the apperance in HA also could be a symptom not the cause.

Sometimes, if I force the Shelly to reconnect (via Unifi-Controller-UI), the Shelly comes up again (Shelly-UI and HA), but not everytime - maybe just coincidence... All non-Plus are working fine. I've got 3 1PlusPM and could see this problem only occure to 2 of them.

SmilyHM avatar Jan 07 '24 10:01 SmilyHM

Are you using static or dhcp assigned IPs ?

chemelli74 avatar Jan 07 '24 14:01 chemelli74

Hi Simone, I use dhcp? Do you think changing to static IP would help the situation? I can certainly try that...

Attached is a new log (sorry pretty long, but I just turned debug mode on and had to do other stuff). At 2024-01-07 02:14:37 (line 595) there is again a disappear error. Then the same device appears again at 09:04:42 (line 1261). this is the device with this device ID: shellyplus1pm-441793a84adc.

There are more of these errors, since I have 6 devices running. Some produced it, some don't. I don't see any pattern here, but that's just probably me...

Thanks a million for looking at it.

home-assistant_shelly_2024-01-07T18-01-43.825Z.log

easter-blok avatar Jan 07 '24 18:01 easter-blok

easter-blok is using DHCP an I'm using static IP, so the difference (dhcp / static) seems not to cause the problem.

I started a latency-test a few hours ago (UniFi network-app / UDM-Pro). The device is online (wlan) and connected. Shelly-UI won't load, HA shows unavailable. Latency (ping) is like 5 times timeout, ping between 20 and 300, 3x timeout, and so on. Don't know, if this is a helpfull information for you...

SmilyHM avatar Jan 07 '24 18:01 SmilyHM

easter-blok is using DHCP an I'm using static IP, so the difference (dhcp / static) seems not to cause the problem.

I asked about static or dhcp address because of possible IP conflicts.

I started a latency-test a few hours ago (UniFi network-app / UDM-Pro). The device is online (wlan) and connected. Shelly-UI won't load, HA shows unavailable. Latency (ping) is like 5 times timeout, ping between 20 and 300, 3x timeout, and so on. Don't know, if this is a helpfull information for you...

If Shelly Web UI doesn't load then the issue is related to network and not to HA. Sorry I cannot help more, but you need to investigate your specific environment. I can only suggest to double check that both the AP and Shelly device have the latest firmware.

chemelli74 avatar Jan 07 '24 20:01 chemelli74

Ah, alright! Now I got it^^ For my side there are no IP conflichts. Just wanted to say, that there also could be an issue with latest Shelly-Firmware, not HA or HA-Shelly-integration since all other Shelly are doing well. Maybe also a problem with UniFi - if easter-blok is on UniFi too. For UniFi-network a new release was a few days ago. Unfortunately I can't say, when the problem began (network-app-update or HA 2024.01.01) :-/

SmilyHM avatar Jan 07 '24 21:01 SmilyHM

For me these connection issues started when the 1.x.x FW started to roll out. I like to use the latest and greatest so back months ago I updated to the first 1.0.0 FW, and noticed after a short time that there are some issues with the Plus 1PM's in HA. So I rolled back to 0.14.1 FW, and until the HA Core release 2024.1.0 I kept the old FW for the Plus 1PM's. With 2024.1.0 however the 0.14.1 FW was not supported any more so I was forced to upgrade the FW. Sadly I noticed the stability issue is still there... :( So I would be happy with the old stable FW, but I am forced into using the new.... :( Issue is I control my heating system with this, so I this is pretty bad for me. That's why I opened this ticket. Until now I thought this is something to do with HA since the Shelly app always worked, if I reboot the Plus 1PM devices in the shelly app (there they always seem to be online) they come back online in HA. So this is why I suspect this is something HA related.

easter-blok avatar Jan 07 '24 21:01 easter-blok

OK, so as SmilyHM says the dynamic/static IP is not the issue/solution. I assigned static IP's on my network to all the Plus 1Pm's around 8 o'clock, not it is 10PM and I have the first device becoming unavailable :( In the Shelly App the device is still available I can turn it on and off. After a reboot in the shelly App 1-2 minutes later the device appears in HA also. The web UI for the device is accessible.

easter-blok avatar Jan 07 '24 21:01 easter-blok

@SmilyHM sorry the dumb question but what's UniFi-Network? My Shelly Plus 1PM's are connected to my home wifi network. I use a Asus router.

easter-blok avatar Jan 07 '24 21:01 easter-blok

OK, so as SmilyHM says the dynamic/static IP is not the issue/solution. I assigned static IP's on my network to all the Plus 1Pm's around 8 o'clock, not it is 10PM and I have the first device becoming unavailable :( In the Shelly App the device is still available I can turn it on and off. After a reboot in the shelly App 1-2 minutes later the device appears in HA also. The web UI for the device is accessible.

Please enable Debug logging for Shelly integration, wait for the device to become unavailable and for available again, disable debug and attach the log.

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

Thanks

thecode avatar Jan 07 '24 21:01 thecode

Maybe this issue is then actually a combination of the new Shelly FW and HA Integration?

@thecode I already attached two of these logs a bit higher above. One with HA core 2024.1.0 (https://github.com/home-assistant/core/files/13839287/home-assistant_shelly_2024-01-05T07-31-05.344Z.log) and the other with the lates 2024.1.2 (https://github.com/home-assistant/core/files/13854469/home-assistant_shelly_2024-01-07T18-01-43.825Z.log).

easter-blok avatar Jan 07 '24 21:01 easter-blok

Maybe this issue is then actually a combination of the new Shelly FW and HA Integration?

You might be right. I initially updated HA and my Shelly H&T devices failed to load due to the firmware version being too low. I rolled HA back and all good again.

Updated the FW on my H&Ts and then I get issues with connectivity in HA version 2023.4 no other changes to the H&Ts

DavidNZ27 avatar Jan 07 '24 22:01 DavidNZ27

@DavidNZ27 not related to this issue

thecode avatar Jan 07 '24 22:01 thecode

Are you still looking for more information on this issue? I have a Shelly Plus1PM + as ShellyPlus1 attached to it (using this for the 5 temp sensors I can attach to the combo). These sensors have been unavailable since upgrading to HA 2024.x . I can access both fine via the individual IP web interface. I have rebooted both with no change. I can provide logging info if needed, but thought I'd ask first.

cflansbaum avatar Jan 09 '24 13:01 cflansbaum

I noticed that both my Shelly units (Shelly Plus1PM + as ShellyPlus1 (Shelly Plus1PM + as ShellyPlus1) had 0.12.0 version firmware and so updated those to the 1.1.0 current version. I reloaded the integrations and everything is working now - so (at least for me) it seems to be that this issue is related to older shelly firmware...

cflansbaum avatar Jan 09 '24 14:01 cflansbaum

I currently have a few Plus1 running 0.14.x. Seeing as 1.0.0 has been released ~4 months ago, dropping support for 0.14.x seems premature. This is especially problematic, as 0.14.x Shelly stock firmware doesn't have any way to update the firmware on networks isolated from the internet.

Fully disclosure from me: I don't know the Shelly API, so it's possible that change was necessary. However, the integration should at least leave a repair request. Currently understanding the issue requires reading a stack trace in a debug log, which is way beyond most users' knowledge (and even there the minimum version isn't reported):

2024-01-15 00:31:02.120 DEBUG (MainThread) [homeassistant.components.shelly] Setting up online RPC device <censored>
2024-01-15 00:31:02.169 DEBUG (MainThread) [aioshelly.common] host 10.141.31.14: error: FirmwareUnsupported({'name': '<censored>', 'id': 'shellyplus1-<censored>', 'mac': '<censored>', 'model': 'SNSW-001X16EU', 'gen': 2, 'fw_id': '20230308-091529/0.14.1-g22a4cb7', 'ver': '0.14.1', 'app': 'Plus1', 'auth_en': True, 'auth_domain': 'shellyplus1-<censored>'})
2024-01-15 00:31:02.169 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry <censored> for shelly
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/shelly/__init__.py", line 129, in async_setup_entry
    return await _async_setup_rpc_entry(hass, entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/shelly/__init__.py", line 279, in _async_setup_rpc_entry
    await device.initialize()
  File "/usr/local/lib/python3.11/site-packages/aioshelly/rpc_device/device.py", line 148, in initialize
    self._shelly = await get_info(
                   ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aioshelly/common.py", line 105, in get_info
    raise fw_error
aioshelly.exceptions.FirmwareUnsupported: {'name': '<censored>', 'id': 'shellyplus1-<censored>', 'mac': '<censored>', 'model': 'SNSW-001X16EU', 'gen': 2, 'fw_id': '20230308-091529/0.14.1-g22a4cb7', 'ver': '0.14.1', 'app': 'Plus1', 'auth_en': True, 'auth_domain': 'shellyplus1-<censored>'}

For linking purposes: I came here from https://github.com/home-assistant/core/issues/107275 which is the first result in Google when searching for terms from the log.

kiler129 avatar Jan 15 '24 06:01 kiler129

Hi, I do have the same issue randomly with a Shelly Plus 1PM. Here is my log from last night :

Logger: homeassistant.components.shelly Source: helpers/update_coordinator.py:300 Integration: Shelly (documentation, issues) First occurred: 02:22:00 (1 occurrences) Last logged: 02:22:00 Unexpected error fetching shellyplus1pm-80646fe62c88 data: Already initializing Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/shelly/coordinator.py", line 533, in _async_update_data await self.device.initialize() File "/usr/local/lib/python3.11/site-packages/aioshelly/rpc_device/device.py", line 142, in initialize raise RuntimeError("Already initializing") RuntimeError: Already initializing

This Plus1Pm runs the latest available firmware (1.1.0) and I run all the latest updates on Home Assitant.

I use this device to control a heater. I use an automation on Home Assistant for it. When it needs to turn on the heater, no problem. But sometimes, when the automation says "Turn Off", the device is not accepting the order and comes the following message on the logs : Deviceconnection Error.

So I try then to turn off through the Shelly App and it can't turn off also, I have the message "Something went wrong". I then go back on HA and turn off the device, then it's ok.

But when I check the logs of my network, the shelly never seem to loose the signal...

This also happens on my Shelly EM controling my water heater, but never on my Shelly 2.5 controling my VMC.

Thanks

joretapo1 avatar Jan 15 '24 11:01 joretapo1

However, the integration should at least leave a repair request. Currently understanding the issue requires reading a stack trace in a debug log, which is way beyond most users' knowledge (and even there the minimum version isn't reported):

Hi @joretapo1, you are totally right and I'm working on it.

chemelli74 avatar Jan 15 '24 12:01 chemelli74

However, the integration should at least leave a repair request. Currently understanding the issue requires reading a stack trace in a debug log, which is way beyond most users' knowledge (and even there the minimum version isn't reported):

Hi @joretapo1, you are totally right and I'm working on it.

Thanks Simone @chemelli74

During the time you find a solution to all this, do you suggest we turn off our automations and use of the Shelly devices or can we still use it dealing with those randoms issues ?

joretapo1 avatar Jan 15 '24 12:01 joretapo1

Simone @chemelli74

Here are 2 new logs for you if that could help, regarding the "DeviceConnectionError", on the Shelly EM. The same issue comes wether through a script or an automation, on this EM device or on the Plus 1PM :

Logger: homeassistant.components.script.declenchement_ballon_ecs Source: helpers/script.py:1792 Integration: Script (documentation, issues) First occurred: 14:00:30 (1 occurrences) Last logged: 14:00:30 Déclenchement Ballon ECS: Error executing script. Error for call_service at pos 3: Setting state for entity shellyem-485519D79A77 failed, state: {'turn': 'off'}, error: DeviceConnectionError()

and

Logger: homeassistant Source: components/shelly/entity.py:351 First occurred: 14:00:30 (1 occurrences) Last logged: 14:00:30 Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 287, in http_request resp: ClientResponse = await self.aiohttp_session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 601, in _request await resp.start(conn) File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 965, in start message, payload = await protocol.read() # type: ignore[union-attr] ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer 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 348, in set_state return await self.block.set_state(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 510, in set_state return await self.device.http_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 304, 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/script/__init__.py", line 594, in _async_run return await self.script.async_run(script_vars, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1587, in async_run return await asyncio.shield(run.async_run()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 479, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 502, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/shelly/switch.py", line 269, in async_turn_off self.control_result = await self.set_state(turn="off") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 351, in set_state raise HomeAssistantError( homeassistant.exceptions.HomeAssistantError: Setting state for entity shellyem-485519D79A77 failed, state: {'turn': 'off'}, error: DeviceConnectionError()

joretapo1 avatar Jan 15 '24 13:01 joretapo1

... and to conclude the different ways the error appears, here is the log when manually turning off the switch button. 1 time through HA, 1 time through Shelly mobile App and the last time through HA (this one turned off the switch) :

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:238 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 15:04:23 (3 occurrences) Last logged: 15:05:05 [140566684789952] Setting state for entity shellyem-485519D79A77 failed, state: {'turn': 'off'}, error: DeviceConnectionError() Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 287, in http_request resp: ClientResponse = await self.aiohttp_session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 601, in _request await resp.start(conn) File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 965, in start message, payload = await protocol.read() # type: ignore[union-attr] ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer 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 348, in set_state return await self.block.set_state(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 510, in set_state return await self.device.http_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 304, 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 238, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/shelly/switch.py", line 269, in async_turn_off self.control_result = await self.set_state(turn="off") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 351, in set_state raise HomeAssistantError( homeassistant.exceptions.HomeAssistantError: Setting state for entity shellyem-485519D79A77 failed, state: {'turn': 'off'}, error: DeviceConnectionError()

joretapo1 avatar Jan 15 '24 14:01 joretapo1

Hi + sry for my absense the last few days!

I can't reproduce it. Had problems since my last post (device never came up again). So I placed an UniFi-AP near to the Shelly (basement - befor without AP in basement) and pressed the reboot-switch (only reboot - not factory reset). Since that time all of the plus1pm are 24/7 reachable. UniFi-Controller showed befor "wlan-experience = excellent" --> maybe Shelly got problems with up2date-firmware and weak wifi-signal or "errorhandling" in case of weak wifi-signal / temp wifi-loss? Other Shelly devices (in basement / shelly 2.5 / shelly-plugS / shelly flood) had no problems befor (without the new AP).

best regards Sascha

SmilyHM avatar Jan 15 '24 15:01 SmilyHM

I’m not sure if this is related but over the past couple of weeks I’ve had 2 events where a device triggered in a scene hasn’t responded to the command, (2 different devices) and has been a couple of weeks between incidents. I haven’t noticed any “unavailable” behaviour on the devices and both have a solid network connection. This has only happed since putting the Shelly devices on the latest firmware in order to comply with the latest HA releases.

Trying to figure out if this is a Shelly Firmware issue or a HA issue?

Current HA Version 2024.1.2 Shelly Devices With Issue - Dimmer 2 Shelly Firmware - v1.14.0

HA Log:-

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:238 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 24 January 2024 at 08:49:46 (1 occurrences) Last logged: 24 January 2024 at 08:49:46

[139786287031488] Setting state for entity shellydimmer2-E0980695B8EC failed, state: {'turn': 'off'}, error: DeviceConnectionError() Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.1.202', 80)

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

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 287, in http_request resp: ClientResponse = await self.aiohttp_session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 574, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 911, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1235, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1000, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.202:80 ssl:default [Connect call failed ('192.168.1.202', 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 348, in set_state return await self.block.set_state(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 545, in set_state return await self.device.http_request("get", path, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioshelly/block_device/device.py", line 304, 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 238, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/scene/init.py", line 114, in _async_activate await self.async_activate(**kwargs) File "/usr/src/homeassistant/homeassistant/components/homeassistant/scene.py", line 371, in async_activate await async_reproduce_state( File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 67, in async_reproduce_state await asyncio.gather( File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 61, in worker await platform.async_reproduce_states( File "/usr/src/homeassistant/homeassistant/components/light/reproduce_state.py", line 158, in async_reproduce_states await asyncio.gather( File "/usr/src/homeassistant/homeassistant/components/light/reproduce_state.py", line 145, in _async_reproduce_state await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 635, in async_handle_light_off_service await light.async_turn_off(**filter_turn_off_params(light, params)) File "/usr/src/homeassistant/homeassistant/components/shelly/light.py", line 357, in async_turn_off self.control_result = await self.set_state(**params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/shelly/entity.py", line 351, in set_state raise HomeAssistantError( homeassistant.exceptions.HomeAssistantError: Setting state for entity shellydimmer2-E0980695B8EC failed, state: {'turn': 'off'}, error: DeviceConnectionError()

proxlx avatar Jan 24 '24 23:01 proxlx

The new firmware is really bad. I didn't have any failures for months. Since I updated a week ago, I already had two instances where my devices silently didn't respond, and one where it did respond but with 4-5s delay.

Given that this is happening to multiple users, the old firmware should be supported again, as I have to either downgrade to 0.9.x or flash Tasmota.

kiler129 avatar Jan 25 '24 00:01 kiler129