# Configuration example for Nuki 3.0 Pro Lock working with the MQTT API (no bridge)

**URL:** <https://community.openhab.org/t/configuration-example-for-nuki-3-0-pro-lock-working-with-the-mqtt-api-no-bridge/147828>\
**Category:** Solutions\
**Created:** [July 16, 2023, 8:56am UTC](https://community.openhab.org/t/configuration-example-for-nuki-3-0-pro-lock-working-with-the-mqtt-api-no-bridge/147828 "2023-07-16T08:56:44Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![stue](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@stue](https://community.openhab.org/u/stue)\
**Post date:** [January 31, 2024, 9:47pm UTC](https://community.openhab.org/t/configuration-example-for-nuki-3-0-pro-lock-working-with-the-mqtt-api-no-bridge/147828/8 "2024-01-31T21:47:52Z")

</div>

got it 🙂 thank you, for your help

for other, who may be interested: here are my steps

**//1. - configure NUKI** Smartlock without NUKI bridge  
install and configure Smartlock  
activate MQTT  
lookup ID for MQTT-channel (on your mqtt broker)  
 → in my case on a RasPi  
`mosquitto_sub -v -h localhost -p 1883 -t 'nuki/#'`  
initiate a publish via APP or just press the button on your smartlock  
mqtt result:

> nuki/12A345B5/timestamp

→ 12A345B5 is your ID

**//2. - create Thing** (Web-UI)  
openhab → Things → + → MQTT-Binding → Generic MQTT Thing

```auto
Unique ID: <myNUKIlock>
Identifier: mqtt:topic:<myNUKIlock>
Label: <myNUKIlock>
Bridge: MQTT Connection to local MQTT Broker (has to be configured already)

```

…Create Thing

**//3. -** configure Thing - **set Channels** (Web-UI)  
openhab → Things → myNUKIlock → Code  
paste following code:

```auto
channels:
  - id: connected
    channelTypeUID: mqtt:switch
    label: connected
    description: null
    configuration:
      stateTopic: nuki/12A345B5/connected
      off: "false"
      on: "true"
  - id: devicetype
    channelTypeUID: mqtt:number
    label: devicetype
    description: null
    configuration:
      stateTopic: nuki/12A345B5/deviceType
  - id: name
    channelTypeUID: mqtt:string
    label: name
    description: null
    configuration:
      stateTopic: nuki/12A345B5/name
  - id: serverconnected
    channelTypeUID: mqtt:switch
    label: serverconnected
    description: null
    configuration:
      stateTopic: nuki/12A345B5/serverConnected
      off: "false"
      on: "true"
  - id: state
    channelTypeUID: mqtt:number
    label: state
    description: null
    configuration:
      stateTopic: nuki/12A345B5/state
  - id: mode
    channelTypeUID: mqtt:number
    label: mode
    description: null
    configuration:
      stateTopic: nuki/12A345B5/mode
  - id: battcritic
    channelTypeUID: mqtt:switch
    label: battcritic
    description: null
    configuration:
      stateTopic: nuki/12A345B5/batteryCritical
      off: "false"
      on: "true"
  - id: battcharge
    channelTypeUID: mqtt:number
    label: battcharge
    description: null
    configuration:
      stateTopic: nuki/12A345B5/batteryChargeState
  - id: battcharging
    channelTypeUID: mqtt:switch
    label: battcharging
    description: null
    configuration:
      stateTopic: nuki/12A345B5/batteryCharging
      off: "false"
      on: "true"
  - id: lastseen
    channelTypeUID: mqtt:datetime
    label: lastseen
    description: null
    configuration:
      stateTopic: nuki/12A345B5/timestamp
  - id: lock
    channelTypeUID: mqtt:switch
    label: lock
    description: null
    configuration:
      commandTopic: nuki/12A345B5/lock
      off: "false"
      on: "true"
  - id: unlock
    channelTypeUID: mqtt:switch
    label: unlock
    description: null
    configuration:
      commandTopic: nuki/12A345B5/unlock
      off: "false"
      on: "true"
  - id: lockaction
    channelTypeUID: mqtt:string
    label: lockaction
    description: null
    configuration:
      commandTopic: nuki/12A345B5/lockAction
  - id: firmware
    channelTypeUID: mqtt:string
    label: firmware
    description: null
    configuration:
      stateTopic: nuki/12A345B5/firmware
  - id: actionevent
    channelTypeUID: mqtt:string
    label: actionevent
    description: null
    configuration:
      stateTopic: nuki/12A345B5/lockActionEvent
  - id: doorsensor
    channelTypeUID: mqtt:number
    label: doorsensor
    description: null
    configuration:
      stateTopic: nuki/12A345B5/doorsensorState

```

`replace 12A345B5 with your ID from step 1`

**//4. - generate items** (Web-UI/VSC)  
method1 (VSC):  
create NUKI.items in VSC  
paste following code

method2: (Web-UI)  
openhab → Things → myNUKIlock → Channels → Add Points to Model → Expert Mode  
paste following code

```auto
Group <myNUKIlock> "<myNUKIlock>"
Switch <myNUKIlock>_connected "connected" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:connected" }       
Number <myNUKIlock>_devicetype "devicetype" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:devicetype" }      
String <myNUKIlock>_name "name" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:name" }            
Switch <myNUKIlock>_serverconnected "serverconnected" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:serverconnected" } 
Number <myNUKIlock>_state "state" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:state" ,stateDescription=" "[options="0=nicht kalibriert,1=Verriegelt,2=schließt auf,3=Entriegelt,4=schließt ab,5=Offen,6=lock'n'go,7=kann geöffnet werden,254=Motor blockiert,255=Undefiniert"]}
Number <myNUKIlock>_mode "mode" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:mode" }            
Switch <myNUKIlock>_battcritic "battcritic" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:battcritic" }      
Number <myNUKIlock>_battcharge "battcharge" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:battcharge" }      
Switch <myNUKIlock>_battcharging "battcharging" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:battcharging" }    
DateTime <myNUKIlock>_lastseen "lastseen" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:lastseen" }        
Switch <myNUKIlock>_lock "lock" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:lock" }            
Switch <myNUKIlock>_unlock "unlock" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:unlock" }          
String <myNUKIlock>_lockaction "lockaction" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:lockaction" ,stateDescription=" "[options="1=aufschließen,2=abschließen,3=öffnen,4=lock'n'go,5=lock'n'go mit öffnen,6=2 x abschließen,NULL=unbekannt"]}      
String <myNUKIlock>_firmware "firmware" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:firmware" }        
//String <myNUKIlock>_actionevent "actionevent" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:actionevent" }     
//Number <myNUKIlock>_doorsensor "doorsensor" (<myNUKIlock>) ["Point"] { channel="<mqtt:topic:yourMQTTbroker:myNUKIlockUID>:doorsensor" }

```

```auto
maybe replace <myNUKIlock> with your desired Name
maybe replace <mqtt:topic:yourMQTTbroker:myNUKIlockUID> with UID/Identifier from thing created in step 2
maybe translate the German stateDescription

```

**//5. - Button Example** (Web-UI)  
openhab → Pages → + → Add Label-Card

```auto
component: oh-label-card
config:
  action: options
  actionItem: <myNUKIlock>_lockaction
  item: <myNUKIlock>_state
  title: <myNUKIlock>

```

---

_[View the full topic](https://community.openhab.org/t/configuration-example-for-nuki-3-0-pro-lock-working-with-the-mqtt-api-no-bridge/147828)._
