benzman81 / homebridge-nukiio

Nuki.io support for Homebridge: https://github.com/nfarina/homebridge
GNU General Public License v3.0
42 stars 5 forks source link

Contact Sensor not working #73

Closed firebowl closed 3 years ago

firebowl commented 3 years ago

The contact sensor is detected and also displayed in the log. Unfortunately it is always in the log with the status contactClosed = 'true'.

[5.1.2021, 17:45:25] [NukiBridge] Lock state is isLocked = 'false' (Nuki state '3' ) with battery critical = 'false', battery charging = 'false', battery charge state = '90', contactClosed = 'true' and mode = '2'

In the original Nuki app the sensor is displayed correctly in the log. So in principle the lock detects the opening and closing.

benzman81 commented 3 years ago

In no log entry with contactClosed = 'false' is received, then the plugin cannot do anything about it. Seems like the bridge is not sending the callback for open sensor.

benzman81 commented 3 years ago

maybe you can check the bridge log to see, if a callback is send on door open.

firebowl commented 3 years ago

If I go directly to the web server of the bridge then I see there immediately the status change as soon as I update the page. So in principle, the bridge provides the correct status.

I have different entries in den bridge log:

[{"deviceType": 0, "nukiId": XXX, "name": "Home", "firmwareVersion": "2.9.10", "lastKnownState": {"mode": 2, "state": 3, "stateName": "unlocked", "batteryCritical": false, "batteryCharging": false, "batteryChargeState": 90, "doorsensorState": 2, "doorsensorStateName": "door closed", "timestamp": "2021-01-06T12:53:59+00:00"}}]

and

[{"deviceType": 0, "nukiId": XXX, "name": "Home", "firmwareVersion": "2.9.10", "lastKnownState": {"mode": 2, "state": 3, "stateName": "unlocked", "batteryCritical": false, "batteryCharging": false, "batteryChargeState": 90, "doorsensorState": 3, "doorsensorStateName": "door opened", "timestamp": "2021-01-06T12:57:35+00:00"}}]

I just noticed that sometimes the door is correctly displayed as open. However, it takes forever for this to happen. Likewise, it takes forever for it to show as closed again. To me, it looks like the door has been closed again for a long time before the status change is displayed. This is of course very bad for automating processes such as switching on the light when the door is opened or make it impossible.

benzman81 commented 3 years ago

@firebowl thats why I posted in the other forum that you should test wich the door open for 2 or more minutes and look if the callback will be called. So my guess is, that the problem is the way the bridge works.

firebowl commented 3 years ago

The question is whether the plugin simply queries the web service too infrequently.

benzman81 commented 3 years ago

The plugin doesnt query the state if callbacks are used. At least using "lock_state_mode„ = 1. Even if not, queries would just be made when requesting state via app. There is no polling.

firebowl commented 3 years ago

Then the possibility to query the door sensor is totally useless or only provides the information that you have accidentally left your door open. All other actions are useless because the status has already changed again. Really stupid.

benzman81 commented 3 years ago

@firebowl so just to get it right here: if you open the door and leave it open, is there a callback with correct state and will the sensor be displayed as open? Same the other way around?

firebowl commented 3 years ago

Yes, but it takes so long that I'm afraid one of my cats will escape through the door. ;)

benzman81 commented 3 years ago

My experience is, that the further the bridge away is from the lock, the longer the callback might take. On my lock the delay is about 5s. How long does it take? Is it a fast cat ;-)

firebowl commented 3 years ago

My bridge is about a meter from the lock so not that far. In my last test, it was probably 20 seconds or more. So enough time for my cats ;) Joking aside, even 5 seconds would be too slow. I want to turn on a lamp behind the door when I open it. Even at 5 seconds you would first stand in the dark. :(

benzman81 commented 3 years ago

It helped me a lot follow this instruction:

https://nuki.io/de/hilfe/bridge-de/bridge-fehlerbehebung/verbindung-zwischen-smart-lock-und-bridge-verbessern/

Anyway, because of the delay I deactivated this and use an eve sensor.