Here’s the templates.yaml file, in which you will find ALL the sensors, triggered and state sensors:
- trigger:
- platform: event
event_type: event_template_reloaded
- platform: homeassistant
event: start
- platform: webhook
webhook_id: !secret nuki_bridge_webhook
binary_sensor:
- name: "Nuki Door State"
unique_id: nuki_door_state
device_class: door
state: >
{% if trigger.platform == 'webhook' %}
{{ trigger.json.doorsensorState == 3 }}
{% else %}
{{ is_state('sensor.nuki_door_sensor_state', 'open') }}
{% endif %}
icon: >
{% if trigger.platform == 'webhook' %}
{% set my_state = {1: 'deactivated', 2: 'closed', 3: 'open', 4: 'unknown', 5: 'calibrating'} %}
{% set trigdoor = my_state[trigger.json.doorsensorState] %}
{% set my_state = {0: 'uncalibrated', 1: 'locked', 2:'unlocking', 3: 'unlocked', 4: 'locking', 5: 'unlatched', 6: "unlocked (lock ‘n’ go)", 7: 'unlatching', 254: 'motor blocked', 255: 'undefined'} %}
{% set triglock = my_state[trigger.json.state] %}
{% else %}
{% set trigdoor = sensor.nuki_door_sensor_state %}
{% set triglock = sensor.nuki_lock_sensor_state %}
{% endif %}
{% if (trigdoor == 'open') %}
mdi:door-open
{% elif trigdoor == 'closed' and triglock == 'locked' %}
mdi:door-closed-lock
{% elif trigdoor == 'closed' and triglock == 'unlocked' %}
mdi:door-closed
{% else %}
mdi:alert-box-outline
{% endif %}
availability: >
{% if trigger.platform == 'webhook' %}
{{ trigger.json.doorsensorState != None }}
{% else %}
{{ (states('sensor.nuki_door_sensor_state') >= 1) and (states('sensor.nuki_door_sensor_state') <= 5) }}
{% endif %}
attributes:
nuki_id: >
{% if trigger.platform == 'webhook' %}
{{ trigger.json.nukiId }}
{% else %}
{{ sensor.nuki_id }}
{% endif %}
door_state: >
{% set my_state = {1: 'deactivated', 2: 'closed', 3: 'open', 4: 'unknown', 5: 'calibrating'} %}
{% if trigger.platform == 'webhook' %}
{{ my_state[trigger.json.doorsensorState] }}
{% else %}
{{ sensor.nuki_door_sensor_state }}
{% endif %}
lock_state: >
{% set my_state = {0: 'uncalibrated', 1: 'locked', 2:'unlocking', 3: 'unlocked', 4: 'locking', 5: 'unlatched', 6: "unlocked (lock ‘n’ go)", 7: 'unlatching', 254: 'motor blocked', 255: 'undefined'} %}
{% if trigger.platform == 'webhook' %}
{{ my_state[trigger.json.state] }}
{% else %}
{{ sensor.nuki_lock_sensor_state }}
{% endif %}
lock_battery: >
{% if trigger.platform == 'webhook' %}
{{ trigger.json.batteryChargeState }}%
{% else %}
{{ sensor.nuki_id }}
{% endif %}
lock_battery_critical: >
{% if trigger.platform == 'webhook' %}
{{ is_state('trigger.json.batteryCritical', 'True') }}
{% else %}
{{ sensor.nuki_lock_battery_critical }}
{% endif %}
keypad_battery_critical: >
{% if trigger.platform == 'webhook' %}
{{ is_state('trigger.json.keypadbatteryCritical', 'True') }}
{% else %}
{{ sensor.nuki_keypad_battery_critical }}
{% endif %}
last_update: "{{ strptime(as_timestamp(now()) | timestamp_local, '%Y%m%d %H:%M:%S') }}"
trigger: '{{ trigger.platform }}'
- sensor:
- name: "Nuki Bridge Host"
state: !secret nuki_bridge_host
- name: "Nuki Bridge Port"
state: !secret nuki_bridge_port
- name: "Nuki Bridge Token"
state: !secret nuki_bridge_token
- name: "Nuki Device Name"
state: "{{ state_attr('sensor.nuki_endpoint_info','scanResults')[0]['name'] }}"
icon: mdi:alpha
- name: "Nuki Bridge FW Version"
state: "{{ state_attr('sensor.nuki_endpoint_info','versions')['firmwareVersion'] }}"
icon: mdi:numeric
- name: "Nuki Bridge wifi FW Version"
state: "{{ state_attr('sensor.nuki_endpoint_info','versions')['wifiFirmwareVersion'] }}"
icon: mdi:numeric
- name: "Nuki Bridge<->Lock BT RSSI"
unique_id: nuki_bridge_bt_rssi
device_class: "signal_strength"
unit_of_measurement: "dB"
icon: mdi:signal-distance-variant
state: "{{ state_attr('sensor.nuki_endpoint_info','scanResults')[0]['rssi'] }}"
- name: "Nuki Bridge WiFi Connected"
unique_id: nuki_bridge_wlan
icon: mdi:wifi-cog
state: "{{ state_attr('sensor.nuki_endpoint_info','wlanConnected') }}"
- name: "Nuki Bridge Cloud Connected"
unique_id: nuki_bridge_cloud
icon: mdi:server-network
state: "{{ state_attr('sensor.nuki_endpoint_info','serverConnected') }}"
- name: "Nuki Bridge<->Lock BT State"
unique_id: nuki_bridge_bt_state
icon: >-
{% if state_attr('sensor.nuki_endpoint_info','scanResults')[0]['paired'] %}
mdi:bluetooth-connect
{% elif not state_attr('sensor.nuki_endpoint_info','scanResults')[0]['paired'] %}
mdi:bluetooth-off
{% else %}
mdi:bluetooth-audio
{% endif %}
state: >-
{% if state_attr('sensor.nuki_endpoint_info','scanResults')[0]['paired'] %}
connected
{% elif not state_attr('sensor.nuki_endpoint_info','scanResults')[0]['paired'] %}
disconnected
{% else %}
Unknown
{% endif %}
- name: "Nuki ID"
unique_id: nuki_id
icon: mdi:numeric
state: "{{ state_attr('sensor.nuki_endpoint_list','nukiId') }}"
- name: "Nuki Friendly Name"
unique_id: nuki_friendly_name
icon: mdi:numeric
state: "{{ state_attr('sensor.nuki_endpoint_list','name') }}"
- name: "Nuki Door Sensor State"
unique_id: nuki_door_sensor_state
icon: mdi:door
state: >
{% set my_state = {1: 'deactivated', 2: 'closed', 3: 'open', 4: 'unknown', 5: 'calibrating'} %}
{{ my_state[state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['doorsensorState']] }}
- name: "Nuki Lock Sensor State"
unique_id: nuki_lock_sensor_state
icon: mdi:lock
state: >
{% set my_state = {0: 'uncalibrated', 1: 'locked', 2:'unlocking', 3: 'unlocked', 4: 'locking', 5: 'unlatched', 6: "unlocked (lock ‘n’ go)", 7: 'unlatching', 254: 'motor blocked', 255: 'undefined'} %}
{{ my_state[state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['state']] }}
- name: "Nuki Lock FW Version"
unique_id: nuki_lock_fw
icon: mdi:numeric
state: "{{ state_attr('sensor.nuki_endpoint_list','firmwareVersion') }}"
- name: "Nuki Lock Battery Critical State"
unique_id: nuki_lock_battery_critical
icon: mdi:battery-alert-variant-outline
state: "{{ state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryCritical'] }}"
- name: "Nuki Keypad Battery Critical State"
unique_id: nuki_keypad_battery_critical
icon: mdi:battery-alert-variant-outline
state: "{{ state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['keypadBatteryCritical'] }}"
- name: "Nuki Lock Battery Level"
unique_id: nuki_lock_battery_level
device_class: "battery"
unit_of_measurement: "%"
icon: >
{% set battery_level = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryChargeState'] | default(0) | int %}
{% set battery_charging = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryCharging'] %}
{% set battery_round = (battery_level / 10) | int * 10 %}
{% if battery_round >= 100 and not battery_charging %}
mdi:battery
{% elif battery_round >= 100 and battery_charging %}
mdi:battery-charging
{% elif battery_round > 0 and not battery_charging %}
mdi:battery-{{ battery_round }}
{% elif battery_round > 0 and battery_charging %}
mdi:battery-charging-{{ battery_round }}
{% else %}
mdi:battery-alert-variant-outline
{% endif %}
state: >
{% set battery_level = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryChargeState'] | default(0) | int %}
{% if state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryCharging'] %}
{{ battery_level }}
{% else %}
{{ battery_level }}
{% endif %}
- name: "Nuki Last Activity"
unique_id: nuki_lock_last_activity
icon: mdi:clock-check-outline
state: >
{{ (as_timestamp(state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['timestamp'])) | timestamp_custom("%H:%M (%b %d)") }}
You are only missing the template lock sensor, the two rest sensors.
If you want, I can publish the whole code so you can try it and modify it.