Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in log: "None is not a valid LockStates" #168

Open
poughkeepsee opened this issue Dec 8, 2023 · 1 comment
Open

Error in log: "None is not a valid LockStates" #168

poughkeepsee opened this issue Dec 8, 2023 · 1 comment

Comments

@poughkeepsee
Copy link

I've had this error in my log for months now, and I can't understand the reason or how to fix it. As far as I can tell, the lock is reporting a None state that can't identified/handled by the component. I have a v1 lock + bridge.

Appreciate any help possible. Log entry below.

2023-12-08 19:49:11.565 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 243, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 399, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 479, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 745, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 751, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/nuki_ng/sensor.py", line 141, in state
    return str(self.get_state())
               ^^^^^^^^^^^^^^^^
  File "/config/custom_components/nuki_ng/sensor.py", line 144, in get_state
    lock_state = LockStates(self.last_state.get("state"))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: None is not a valid LockStates
inc-ali added a commit to inc-ali/hass_nuki_ng that referenced this issue Jan 3, 2024
kvj added a commit that referenced this issue Jan 17, 2024
Gracefully mapping value to lock_state (#168)
@sven-debug
Copy link

Dears,

that one is still open. When do you expect to issue an updated version? the integration is still pumping in a load of error messages in my installation like:

`Logger: homeassistant
Source: custom_components/nuki_ng/sensor.py:96
Integration: Nuki Lock (documentation, issues)
First occurred: 12. Februar 2024 um 16:43:40 (714 occurrences)
Last logged: 09:01:09

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 412, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 989, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1110, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1047, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 995, 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'`

Any help highly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants