okay. rename it and created a new automations.yaml and paste this into it:
- id: "nuki_card_callback"
alias: Nuki Card Callback
description: Automation for the Nuki doorlock
mode: queued
max: 10
max_exceeded: warning
trigger:
- platform: homeassistant
id: "trigger_nuki_ha_start"
event: start
- platform: webhook
id: "trigger_nuki_bridge_webhook"
webhook_id: !secret nuki_bridge_webhook
- platform: state
id: "trigger_nuki_bridge_endpoint_list"
entity_id: sensor.nuki_bridge_endpoint_list
condition: []
action:
- choose:
- conditions: >
{{ trigger.id == 'trigger_nuki_ha_start' }}
sequence:
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_callback_url
data:
value: >
{{ states('input_text.nuki_ha_internal_url') | urlencode }}/api/webhook/{{ states('input_text.nuki_bridge_webhook') | urlencode }}
- conditions: >
{{ trigger.id == 'trigger_nuki_bridge_endpoint_list' }}
sequence:
- service: input_number.set_value
target:
entity_id: input_number.nuki_bridge_door_sensor_state
data:
value: >
{{ state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['doorsensorState'] if state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['doorsensorState'] != null }}
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_door_sensor
data:
value: >
{{ (states('input_text.nuki_door_sensor_states') | from_json)[state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['doorsensorState'] | string ] if state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['doorsensorState'] != null }}
- service: input_number.set_value
target:
entity_id: input_number.nuki_bridge_lock_sensor_state
data:
value: >
{{ state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['state'] if state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['state'] != null }}
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_lock_sensor
data:
value: >
{{ (states('input_text.nuki_lock_sensor_states') | from_json)[state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['state'] | string] if state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['state'] != null }}
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_last_activity
data:
value: >
{% if state_attr('sensor.nuki_bridge_endpoint_list', 'lastKnownState')['timestamp'] != null %}
{{ as_timestamp(state_attr('sensor.nuki_bridge_endpoint_list','lastKnownState')['timestamp']) | timestamp_custom("%H:%M:%S (%b %d)") }}
{% endif %}
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_trigger_id
data:
value: >
{{ trigger.id }}
- conditions: >
{{ trigger.id == 'trigger_nuki_bridge_webhook' }}
sequence:
- service: input_number.set_value
target:
entity_id: input_number.nuki_bridge_door_sensor_state
data:
value: >
{{ trigger.json.doorsensorState | int }}
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_door_sensor
data:
value: >
{{ (states('input_text.nuki_door_sensor_states') | from_json)[trigger.json.doorsensorState | string] }}
- service: input_number.set_value
target:
entity_id: input_number.nuki_bridge_lock_sensor_state
data:
value: >
{{ trigger.json.state | int }}
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_lock_sensor
data:
value: >
{{ (states('input_text.nuki_lock_sensor_states') | from_json)[trigger.json.state | string] }}
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_last_activity
data:
value: >
{{ as_timestamp(now()) | timestamp_custom("%H:%M:%S (%b %d)") }}
- service: input_text.set_value
target:
entity_id: input_text.nuki_bridge_trigger_id
data:
value: >
{{ trigger.id }}
- service: homeassistant.update_entity
target:
entity_id: binary_sensor.nuki_door_sensor_state
- service: homeassistant.update_entity
target:
entity_id: lock.nuki_lock_action
- service: script.turn_on
target:
entity_id: script.nuki_bridge_polling_queue
refresh your automations, clear the log, fingers crossed that there is an automation called Nuki Card Callback
and if so run it.
ps
if I am doing this I this in my log:
Means the automation is working as it should.