kvj / hass_nuki_ng

Better support for Nuki devices in the Home Assistant
MIT License
179 stars 35 forks source link

nuki_ng log entry - AttributeError: 'NoneType' object has no attribute 'get' #195

Open mindgam3s opened 1 week ago

mindgam3s commented 1 week ago

in the logs I can see nuki_ng generating a log entry every 30 seconds

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 453, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 533, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/nuki_ng/sensor.py", line 100, in state
    return self.native_value
           ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nuki_ng/sensor.py", line 96, in native_value
    return self.data.get("bridge_info", {}).get("rssi")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

the integration itself seems to be working fine though.

freddeh commented 2 days ago

I get the same error if I try to call action lock.unlock on lock.nuki_…