I’m trying to script my own version of Nuki support into OpenHAB without using the OpenHAB Nuki Binding as its not proving reliable and I have a question about callback.
According to the documentation
The new lock state will be sent to the callback url by executing a POST request and posting a JSON list in the following format:
{“nukiId”: 11, “deviceType”: 0, “mode”: 2, “state”: 1, “stateName”: “locked”, “batteryCritical”: false}
I’ve created a string Item “NukiCallbackTest” in OpenHAB and added the following callback.
The URL I’ve set is the individual item in the REST interface, so a post to the callback address I’ve set is the same as updating the item from within openhab.
Items can be changed directly via the REST interface. The item always remains blank
Have a look here - https://github.com/sumnerboy12/nukiproxy. I had a similar problem and solved it with this little proxy server. I have since updated this locally to use MQTT rather than direct connection to openHAB but the principle is the same.
Thanks Ben, are you happy with your MQTT solution? I haven’t looked into this further other than creating a rule that mainly works around the problem. I only use the OpenHAB Nuki binding for state updates and I ignore the lock state when making locking decisions. I’ve also stopped querying the lock from a rule as the bridge seems to get stroppy if it receives more than one query at once.
Yes relatively happy. I do seem to miss the odd event, but I think this is likely down to the bluetooth connection between the lock/bridge. Not 100% reliable unfortunately. But sending lock/unlock requests seem very reliable.