I am also supporting a binding and the idea of a cloud free Nuki installation.
Would be great if Nuki Dev Team would provide their Nuki Web as on premise installable solution.
Nuki Web with IFTTT integration is a no-go for at least the typical front-door use case in a Smart Home (you would hand over a virtual key to your front-door to the Nuki Cloud Server and indirectly the ability to unlock the door to IFTTT.
Also there is a security process issue (from my perspective) with their password reset implementation - so once you have access to email account or unencrypted email network traffic you can take over the door.
So proper integration with openHAB is the preferable solution.
There was a question regarding Token and NukiID:
Token from App when setting the bridge to developer mode (=API activation). Nuki ID can easily be requested then via Browser and command sent to the Bridge using the Token.
Maybe there is another way to retrieve ID via App, this is how I did it.
This reads the last known state of the lock from the bridge and not from the lock directly. So it does not drain the battery on the lock. On the web browser this works like a charm. But the item is not updated at all. I wonder why.
Number WohnungsTuerStatus {http="<[http://192.168.xx.xx:8080/list?token=xxx:30000:JSONPATH($[0].lastKnownState.state)]"}
Switch WohnungsTuerSchloss <lock> {http=">[ON:GET:http://192.168.xx.xx:8080/lockaction?token=xxx&nukiid=xxx&action=2] >[OFF:GET:http://192.168.xx.xx:8080/lockaction?token=xxx&nukiid=xxx&action=1]"}
Rules:
rule "Nuki Haustuer"
when
Item WohnungsTuerStatus received update
then
if (WohnungsTuerStatus.state == 1) {
WohnungsTuerSchloss.postUpdate(ON)
} else {
WohnungsTuerSchloss.postUpdate(OFF)
}
end
Here are my final items and rules - Meanwhile (API version 1.5) it is possible to retrieve the RSSI signal strengths of the locks. As it is easier to use with icons and such I decided to create a rule to translate “BatteryCritical” into Battery levels of either 20% or 80% and also to translate RSSI into signal level between 0 and 5 - This fits nicely with the Nuki Lock widget I posted here:
Nuki.items (replace xxx with your token and yyy with your lock ID, in case of multiple locks you also need to change the [0] below):
Number EGFrontdoorLockStatus { http="<[http://EGTec1NukiBridge:8080/list?token=xxx:30000:JSONPATH($[0].lastKnownState.state)]"}
Switch EGFrontdoorLock <lock> { http=">[ON:GET:http://EGTec1NukiBridge:8080/lockaction?token=xxx&nukiid=yyy&action=2] >[OFF:GET:http://EGTec1NukiBridge:8080/lockaction?token=xxx&nukiid=yyy&action=1]"}
String EGFrontdoorLockBatteryCritical { http="<[http://EGTec1NukiBridge:8080/list?token=xxx:30000:JSONPATH($[0].lastKnownState.batteryCritical)]"}
Number EGFrontdoorLockBattery <battery>
Number EGFrontdoorLockRSSI { http="<[http://EGTec1NukiBridge:8080/info?token=xxx:30000:JSONPATH($.scanResults.[0].rssi)]"}
Number EGFrontdoorLockSignal <signal>
Nuki.rules:
rule "Nuki EGFrontdoorLock"
when
Item EGFrontdoorLockStatus received update
then
if (EGFrontdoorLockStatus.state == 1) {
EGFrontdoorLock.postUpdate(ON)
} else {
EGFrontdoorLock.postUpdate(OFF)
}
end
rule "Nuki EGFrontdoorLockBattery"
when
Item EGFrontdoorLockBatteryCritical received update
then
if( EGFrontdoorLockBatteryCritical.state == 'true' ){
EGFrontdoorLockBattery.postUpdate(10)
} else {
EGFrontdoorLockBattery.postUpdate(80)
}
end
rule "Nuki EGFrontdoorLockSignal"
when
Item EGFrontdoorLockRSSI received update
then
var Number RSSI = EGFrontdoorLockRSSI.state
var Number Signal = RSSI / 20 + 5
EGFrontdoorLockSignal.postUpdate( Signal )
end
I define a rule with a cron timer which checks every minute the Last State of the Nuki:
rule "Nuki abholen"
when
Time cron "0 0/1 * * * ?" // every minute
then
var String var1= sendHttpGetRequest("http://xxx:8080/list?token=yyy")
var String value = transform("JSONPATH", "$[0].lastKnownState.stateName", var1)
postUpdate(nuki_status, value)
end
your item looks good to me, i think it should work. I had sometimes weird behaviour when having german umlauts in the items file, but this was like ages ago. http binding is installed i guess ?
i update every 30 seconds, however think of changing that to a longer period and also use the webhooks which are described somewhere - that way the lock sends any changes in status directly to openhab, and for battery/RFFI status as well as “doublecheck” 5 min should be ok. reason is I’m pushing tons of updates to openhab using http for other stuff, i guess someday my network will be congested or openhab cant cope with it anymore
Yes - but if you use my nuki-proxy python script (linked here) you can use the callback URLs with openHAB. I have been using this for a few months and now that the bridge firmware has had a few bugs ironed out, it is working very very well.
Fair enough - for anyone else interested I would recommend supervisor for running these sorts of little scripts/processes. Very easy to install/setup and monitor.
Does anyone have a how-to for Nuki with webhook so that a Nuki event could even trigger other actions?
I currently have implemented the Setup from Max w/o the Widget and have Nuki connected to Amazon Alexa with an echo dot and hue emulation (limited to locking the door at night when I tell Alexa to switch off home (all lights, plugs, sonos and now also ensuring that the door is locked with just one spoken command).