-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Home assistant 0.111.1 : cannot read nuki state #56
Comments
Thanks for raising this. from pynuki import NukiBridge
nb = NukiBridge.discover()[0]
nb.token = "YOUR_TOKEN"
print(f"locks: {nb.locks}")
print(f"openers: {nb.openers}") |
Fyi 111.0 works |
Anything I can do to help with this? |
That's python. |
Stupid me... ;-) |
How I can run this code from HASSIO?? How I can help you to resolve this problem? |
Doesn't work.
EDIT: Sorry, too fast. But also no success from my homeassistant virutalenv:
|
My bad it should have been: nb = NukiBridge.discover()[0] I updated the original post above. |
|
Try
|
Do I have to enter this when the lock is working or offline? Currently it is online (strange - without any change in the configuration it has been online for at least 24h). Result is
|
So now the lock is offline again. However, the piece of code gives the same result as before.
The reported state is wrong. And trying to operate the lock from HA gives
|
The snippet's purpose is just to provide some basic info about your devices. Nothing more. No need to run it again. |
Don't know if this provides any clue to solve the issue, but operating the lock via python script from the HA instance (in my case a bash session inside the HA container) is working just fine, even while the lock is shown as unavailable in HA the whole time. |
@pschmitt do you think to resolve this problem in pynuki? Or is an HA problem? |
Definitly it's a pynuki problem. In the newest version of HA: 0.113, I downgraded nuki component to vs 0.110.7 (last worked) and together a pynuki to vs 1.3.3. Nuki lock works good again. I think (based on logs of HA), the problem appears during polling the state of nuki lock when nuki bridge is in unstable state (for example overload 503 error). I'm not sure but the problem cause one of these to lines or even both: 82: self._json = {k: v for k, v in data.items() if k != "success"} At vs 1.3.3 of pynuki coresponding lines look that: 97: self._json.update({k: v for k, v in data.items() if k != 'success'}) You keep nuki_id in the _json list. If you've get messed return form the bridge (during unstable state) setting just new value to the list can result in lossing nuki_id information. If you update the list (as was in previous version - 1.3.3) the messed answer from bridge doesn't overwirite nuki_id. |
The fix here resolves the issue in the original post which leads me to believe it is an HA integration problem. The only substantive difference in the lock.py (from the zip) is in line 54 removing an erroneous comma. Using the new lock.py in my HA v0.113 got rid of the "volatized" error in my logs and now the included _LOGGER.warning entries which were the only other change in that file. |
So with 1.3.7 to reproduce this issue: from pynuki import NukiBridge
nb = NukiBridge.discover()[0]
nb.token = "MY_TOKEN"
l = nb.locks[0]
print(l._json)
l.update()
print(l._json)
l.update()
print(l._json)
l.update(aggressive=True)
print(l._json)
# Shit hits the fan here:
l.update(aggressive=True) It turns out the bridge does not return the I must say that I was quite surprised that:
|
Logger: homeassistant.helpers.entity
Source: components/nuki/lock.py:124
First occurred: 11:40:21 (377 occurrences)
Last logged: 14:56:51
Update for lock.porta fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/nuki/lock.py", line 124, in update
self._nuki_device.update(aggressive=level)
File "/usr/local/lib/python3.7/site-packages/pynuki/device.py", line 90, in update
"Failed to update data for lock. "
AssertionError: Failed to update data for lock. Nuki ID None volatized.
The text was updated successfully, but these errors were encountered: