ebaauw / homebridge-nb

Homebridge plugin for Nuki Bridge
Apache License 2.0
52 stars 3 forks source link

Nuki Door sensor - no last known state #84

Closed MirkoKas closed 2 years ago

MirkoKas commented 2 years ago

I just replaced my Nuki 2 with a Nuki 3 and added one of these new door sensors. Everything added to HomeKit through the plugin easily.

I recently noticed that the door sensor started to not work anymore within HomeKit.
In the homebridge log I get the message/warning no known last state every heartbeat (20seconds in my case). I already checked with the Nuki app and the status updates here like it should and shows door open / closed but in HomeKit it’s always closed.

I run the newest version of homebridge and this plugin.

MirkoKas commented 2 years ago

Here’s a screen of the log 0D104435-8132-49DD-8889-3C730D6FD332

ebaauw commented 2 years ago

Looks like the connection between the smart lock and Nuki bridge has been lost. The Nuki app connects to the smart lock directly over BLE, so it isn’t affected.

Normally the Nuki bridge caches the smart lock state. Homebridge NB polls the bridge for this cached state, to preserve the smart lock battery. The message means the Nuki bridge doesn’t report a last known state for the smart lock. You might try and Identify the smart lock from HomeKit, so Homebridge NB asks the bridge to connect to the smart lock over BLE, updating the lock state.

If that fails, check the smart lock Connection status in the Nuki app: you should see a direct connection between your phone and the lock, as well as a connection over the Nuki bridge and server. If the latter is missing, try and power cycle the Nuki bridge. If that doesn’t solve the issue, you might have to re-pair the smart lock with the Nuki bridge, making sure they are within BLE range of each other.

MirkoKas commented 2 years ago

As Inwas away from home when I saw your reply I checked the status within the Nuki App and there was a green connection between the lock and the bridge to the server. So I assume the connection between those two are fine. i also did an identity in HomeKit but that didn’t change anything. any other suggestion what could be going on here?

MirkoKas commented 2 years ago

One more thing: I noticed that Eve is showing the status correctly and is counting also correctly how often the door was opened/closed. The homebridge log still shows that it doesn’t have the correct state while it definitely is there.

So it seems it’s more of an error with the log output in homebridge!?

Some screens: FA424850-0CA6-4AC8-A781-90FB9CE319C1

DD90DA49-7D56-4B98-924B-88987781EDD7

C2F5C207-2C5F-47FF-BD66-1181B9AA8283

ebaauw commented 2 years ago

Could you please list the output of nb info and of nb list? Maybe it's a stale entry for the old smart lock?

MirkoKas commented 2 years ago

I think you are right. The sensor that is reporting no state is the old one that is currently offline, but with the wrong name. I renamed this lock within the Nuki App but it seems that the nb plugin still has the old names. Is there a way to trigger an update of the names?

When I replaced the Nuki I first gave the new one a different name and after final replacing steps I renamed the new one to have the name of the old one and gave the older one a completely new name. In the Nuki App everything looks good.

CC69B4D5-E4E3-4B74-AF33-8AD562E152C0 E625CB6B-7C87-4EB2-91C7-84EF8845A5F5

ebaauw commented 2 years ago

I renamed this lock within the Nuki App but it seems that the nb plugin still has the old names.

That’s because the Nuki bridge that still reports the old name, as you can see above.

Is there a way to trigger an update of the names?

No, once an accessory or service has been exposed, their names are managed in HomeKit, and cannot be changed by the accessory itself (i.c. the Homebridge plugin). Changing the name on the Nuki bridge would change the name used by Homebridge NB in the log, though.

MirkoKas commented 2 years ago

Changing the name on the Nuki bridge would change the name used by Homebridge NB in the log, though.

that did the trick. Somehow the bridge didn’t got the new name for one of the locks. The other one was already ok. After renaming that lock again and checking again in the configure of the bridge, all the names were correct. After restarting nb plugin the message is also now gone. So something just got mixed up! Thx for your help.