Unstable Status "Unavailable" - Shelly UniPlus - starting with HA 2024.7.0 Update

Hi everybody :slight_smile: ,

since the HA update to 2024.7.0 I am experiencing different behaviour in both of my Shelly PlusUni devices. This results in problems with my automations.
Starting with the HA upgrade, the entities of the devices show in most of the times “unavailable”. Only in the moment the device reports its status data, the HA status switches shortly to the reported value but instantly switches back to “unavailable” again.
Before the HA update, the entity status was kept stable until the entity itself changed its status. See Screenshot - behaviour after the update is in red rectangle.

Can anybody confirm having this behavour as well?
Or do you have a hint, what to change to set it back to the behaviour I had before?

  • I am using HA 2024.7.0 since 3.7.24
  • HA Installation is in a docker container on a x86-64 device.
  • Shelly Firmware (v1.3.3) did not change in this time period.
  • HA binding of Shelly PlusUni as described in [Shelly - Home Assistant] - " Shelly device configuration (generation 2 and 3)" - Outbound WebSocket

Thanks an regards,
Mike

In the log I see error messages like this:

2024-07-05 17:00:47.365 ERROR (MainThread) [homeassistant.components.shelly] Unexpected error fetching PlusUni-Garage data

Traceback (most recent call last):

File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 312, in _async_refresh

self.data = await self._async_update_data()

            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/usr/src/homeassistant/homeassistant/components/shelly/coordinator.py”, line 594, in _async_update_data

if not await self._async_device_connect_task():

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/usr/src/homeassistant/homeassistant/components/shelly/coordinator.py”, line 167, in _async_device_connect_task

await self.device.initialize()

File “/usr/local/lib/python3.12/site-packages/aioshelly/rpc_device/device.py”, line 208, in initialize

self._update_listener(self, RpcUpdateType.INITIALIZED)

File “/usr/src/homeassistant/homeassistant/components/shelly/coordinator.py”, line 680, in _async_handle_update

self.async_set_updated_data(None)

File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 447, in async_set_updated_data

self.async_update_listeners()

File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 165, in async_update_listeners

update_callback()

File “/usr/src/homeassistant/homeassistant/components/shelly/entity.py”, line 372, in _update_callback

self.async_write_ha_state()

File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1007, in async_write_ha_state

self._async_write_ha_state()

File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1133, in _async_write_ha_state

state, attr, capabilities, shadowed_attr = self.__async_calculate_state()

                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1068, in __async_calculate_state

state = self._stringify_state(available)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1013, in _stringify_state

if (state := self.state) is None:

             ^^^^^^^^^^

File “/usr/src/homeassistant/homeassistant/components/sensor/init.py”, line 533, in state

value = self.native_value

        ^^^^^^^^^^^^^^^^^

File “/usr/src/homeassistant/homeassistant/components/shelly/sensor.py”, line 1097, in native_value

return self.attribute_value

       ^^^^^^^^^^^^^^^^^^^^

File “/usr/src/homeassistant/homeassistant/components/shelly/entity.py”, line 519, in attribute_value

self._last_value = self.entity_description.value(

                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/usr/src/homeassistant/homeassistant/components/shelly/sensor.py”, line 998, in

value=lambda status, _: status["freq"],

                        ~~~~~~^^^^^^^^

KeyError: ‘freq’

Similar issue reported here. Looks like a fix is planned.

1 Like

Should be fixed in 2024.7.1

Thanks für the link!
I upgraded to 2024.7.1 and the error is gone :+1:
Thanks to the HA team for the quick reaction!
Regards, Mike