openHAB Integration

@stephan1 If you have issue with the openhab integration itself - and not a Nuki Smart Lock in general - you have to contact the developer of the integration.

Dear Mr.Lendl,

i am using Nuki with openHAB 2.5 and generally speaking i am satisfied. I use it via openHAB binding, as well as API HTTP JSON at the moment (just to compare results and actions). But there are three issues i want to get rid of:

a) When working with the API (http://myIP:8080/lockState?nukiId=1234567&token=abcdefgh) i do get a JSON response with its state, see the following image. Thats fine. But while locking or opening, or in some undefined intervals in between, i get HTTP 503 Errors and others in my openHAB logfile

2020-02-20 13:55:30.025 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation ‘JSONPATH($.state)’ threw an exception. [response=HTTP 503 Unavailable]
org.openhab.core.transform.TransformationException: Invalid path ‘$.state’ in ‘HTTP 503 Unavailable’

As well as another API error like:

2020-02-20 14:14:39.089 [vent.ItemStateChangedEvent] - Nuki_Status changed from 1 to {“success”: false}
2020-02-20 14:14:39.089 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ‘{“success”: false}’ with the file ‘nukilockstates.map’ : Target value not found in map for ‘{“success”: false}’

But manually looking at the API JSON, it says:

{
“mode”: 2,
“state”: 1,
“stateName”: “locked”,
“batteryCritical”: true,
“success”: true
}

Why is that and can it be fixed?

b) When working with the official openHAB binding (which i would prefer), the lock state does not get updated. When i click “lock door now”, the state changes to “locking” but never succeeds to “locked”. It always stays in its moving state so to say, with no confirmation result

Unbenannt-1

c) My Nuki battery gets drained within 2 weeks of operation. Maybe it is because of one of these faults a) or b)?

Thank you for your kind help!

ad a) This sounds like some issue with calling the HTTP API while the Bridge is busy and not retrying correctly.
{“success”: false} is no device state, but a response to an (failed) action.

ad b) As this integration was not done by us I can not tell you why it does not update the correct state. We suggest to do this via callbacks, but as said I am not sure if and how this is implemented.

ad c) Yes, this could be due to an integration constantly polling the Smart Lock directly and so keeping it awake and drawing battery for the BLE-connection. Typically if /lockSate is called in very short intervalls (instead of using callbacks or /list) - see also https://developer.nuki.io/page/nuki-bridge-http-api-1-10/4#heading--lockstate

Dear Mr. Lendl,

Thank you for your reply.
ad a) So this is a general Nuki issue, that the bridge does not deliver API data while being busy - or is it just in my case?

ad b) I will ask the developer of the openHAB binding, alright. The official documentation says it works with callbacks (https://www.openhab.org/addons/bindings/nuki/) but while using it exactly like that, it might not work actually

ad c) But let me get things right in my understanding: my JSON API call is directed to the bridge, right? So why does calling the bridge draw battery from the smartlock? Or is the bridge itself calling then the smartlock for actual status every time?

Hi…I have entryway/window sensors with homematic just as lights and will add a caution. I am intrigued to get a keen lock, for example, NUKI. I will probably have the caution killed once I go into my home by utilizing the NUKI brilliant lock application. Is it conceivable with openHAB to impart a sign when NUKI opens the entryway so that homematic will kill alert and turn on lights?