Nuki Access Log MQTT

Hi,

I connected my nuki 5 pro successfully with my MQTT broker and home assistant and everything is working fine. However, I would love to see by which device (e. g., keypad) the lock has been opened, which I can find in the logs. However, it won’t tell me via MQTT. Do I have to add it to home assistant with the (alternative) Nuki integration and if so, where do I find the (thread connected) IP addresses of my nuki and the access token? I don’t want to connect via the Nuki web as I would like this to be limited to my local network.

Help would be very much appreciated!

The information on who (type and id) caused the lock action is exposed at the /lockActionEvent topic.
But you would need to manually add this to Home Assistant and parse the data.
Some example values can be found in the documentation available here.

1 Like

Thank you Marc, that was a very good starting point!

I used this to define some sensors in Home Assistant which allow me to use these for further automations. Since this might help some of you, please find them below:

# Sensor Nuki (wer hat geöffnet)    
mqtt:
  sensor:
  - name: NukiLockAction
    state_topic: nuki/45650E9F/lockActionEvent
    value_template: >-
      {% set code = value.split(',')[0] %}
      {% if code == '3' %}Tür geöffnet
      {% elif code == '2' %}abgeschlossen
      {% elif code == '1' %}aufgeschlossen
      {% else %}{{ code }}{% endif %}
    unique_id: nuki_lockaction_45650e9f
    force_update: true
    device:
      identifiers: ["Nuki - MQTT-Status"]

  - name: NukiTrigger
    state_topic: nuki/45650E9F/lockActionEvent
    value_template: >-
      {% set code = value.split(',')[1] %}
      {% if code == '0' %}System / Bluetooth
      {% elif code == '1' %}reserviert
      {% elif code == '2' %}Button
      {% elif code == '3' %}Automatisch (z. B. Zeitschaltung)
      {% elif code == '6' %}Automatisches Schließen
      {% elif code == '171' %}Homekit / Matter
      {% elif code == '172' %}MQTT
      {% else %}{{ code }}{% endif %}
    unique_id: nuki_trigger_45650e9f
    force_update: true
    device:
      identifiers: ["Nuki - MQTT-Status"]

  - name: NukiAuthID
    state_topic: nuki/45650E9F/lockActionEvent
    value_template: >-
      {% set code = value.split(',')[2] %}
      {% if code == '1234' %}User1
      {% elif code == '2345' %}User2
      {% elif code == '3456' %}Keypad
      {% else %}{{ code }}{% endif %}
    unique_id: nuki_authid_45650e9f
    force_update: true
    device:
      identifiers: ["Nuki - MQTT-Status"]

  - name: NukiCodeID
    state_topic: nuki/45650E9F/lockActionEvent
    value_template: >-
      {% set code = value.split(',')[3] %}
      {% if code == '8192' %}Keypad
      {% else %}kein Keypad{% endif %}
    unique_id: nuki_codeid_45650e9f
    force_update: true
    device:
      identifiers: ["Nuki - MQTT-Status"]

  - name: NukiAutounlock
    state_topic: nuki/45650E9F/lockActionEvent
    value_template: >-
      {% set code = value.split(',')[4] %}
      {% if code == '0' %}Öffnung ohne Keypad
      {% elif code == '1' %}Code
      {% elif code == '2' %}Fingerabdruck
      {% else %}kein automatisches Öffnen{% endif %}
    unique_id: nuki_autounlock_45650e9f
    force_update: true
    device:
      identifiers: ["Nuki - MQTT-Status"]
2 Likes

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.