You need a username/password to allow access to the broker, modify the MQTT broker thing parameters accordingly
You can use a different MQTT broker name (“mosquitto” in the string “mqtt:broker:mosquitto”)
You need to set up your lock with the Nuki app.
You need to enable MQTT with the Nuki app for your lock.
Notes
This gives you the simple three commands in the sitemap: Unlock, Lock and Unlatch/Open. You can use the item to do what you want, if you a different solution as an interface to your lock.
The transform map is necessary to give the indication of the lock’s state in the sitemap. The action (command) side does not use the name numbers as the state (what is the lock actually doing).
This could be improved upon by using the error codes that the lock can give to display an error message.
You need to supply your Nuki Lock ID. The Nuki App will display it within the lock’s setting.
You do not need to register an account with Nuki or have some cloud thing. Everything is local!
items/mqtt.items
Number door_lockAction "Door" <keyring> { channel = "mqtt:topic:door:lockAction"[profile="transform:MAP", function="nuki30pro.map"] }
Number door_battery "Door" <battery> (gBattery) { channel = "mqtt:topic:door:battery" }
You can get a lot more of information from the mqtt api, for example subscribe to the lockActionEvent channel and then split the data into different items (sorry, transformation maps in German):
rule "Split Nuki Lock Action Events"
when
Item Nuki_V_Action_LockAction changed
then
val String NukiLockAction = Nuki_V_Action_LockAction.state.toString.split(",").get(0)
val String NukiTrigger = Nuki_V_Action_LockAction.state.toString.split(",").get(1)
val String NukiAuthID = Nuki_V_Action_LockAction.state.toString.split(",").get(2)
val String NukiCodeID = Nuki_V_Action_LockAction.state.toString.split(",").get(3)
val String NukiAutoUnlock = Nuki_V_Action_LockAction.state.toString.split(",").get(4)
Nuki_V_Action_LockAction_LockAction.postUpdate(NukiLockAction)
Nuki_V_Action_LockAction_NukiTrigger.postUpdate(NukiTrigger)
Nuki_V_Action_LockAction_NukiAuthID.postUpdate(NukiAuthID)
Nuki_V_Action_LockAction_NukiCodeID.postUpdate(NukiCodeID)
Nuki_V_Action_LockAction_NukiAutoUnlock.postUpdate(NukiAutoUnlock)
end
nuki_lockaction.map:
1=aufgeschlossen
2=abgeschlossen
3=geöffnet
4=lock'n'go
5=lock'n'go mit öffnen
6=2 x abgeschlossen
80=Fernbedienung
90=Lock Button ohne weitere Aktion
NULL=unbekannt
-=unbekannt
UNDEF=unbekannt