Skip to content

KeyError: 'hub_rssi'ย #69

@dajomas

Description

@dajomas

After a couple of days running sureha, I noticed the following error in the log:

2025-04-17 18:04:52.689 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/helpers/update_coordinator.py", line 268, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/helpers/update_coordinator.py", line 479, in _async_refresh
    self.async_update_listeners()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/helpers/update_coordinator.py", line 178, in async_update_listeners
    update_callback()
    ~~~~~~~~~~~~~~~^^
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/helpers/update_coordinator.py", line 559, in _handle_coordinator_update
    self.async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state
    self._async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
    self.__async_calculate_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/helpers/entity.py", line 1085, in __async_calculate_state
    state = self._stringify_state(available)
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/helpers/entity.py", line 1029, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/srv/Python-3.13.2/HASS-2025.4.1/lib/python3.13/site-packages/homeassistant/components/binary_sensor/__init__.py", line 200, in state
    if (is_on := self.is_on) is None:
                 ^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/sureha/binary_sensor.py", line 256, in is_on
    return bool(self.extra_state_attributes)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/sureha/binary_sensor.py", line 248, in extra_state_attributes
    "hub_rssi": f'{state["signal"]["hub_rssi"]:.2f}',
                   ~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'hub_rssi'

The current state of my cats is also incorrect (in SureHA, they are set to away but they are hovering around my keyboard as I am typing...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions