This is the code that adds a new PIN. I’d investigate that the nodeid matches the zwave nodeid of the lock.
- alias: FrontDoor Add Code
condition:
- condition: state
entity_id: 'binary_sensor.allow_automation'
state: 'on'
trigger:
entity_id: binary_sensor.active_frontdoor_1, binary_sensor.active_frontdoor_2, binary_sensor.active_frontdoor_3, binary_sensor.active_frontdoor_4, binary_sensor.active_frontdoor_5, binary_sensor.active_frontdoor_6
platform: state
to: 'on'
action:
- service: lock.set_usercode
data_template:
node_id: >-
{{states.lock.schlage_allegion_be469zp_connect_smart_deadbolt_locked_frontdoor.attributes.node_id}}
code_slot: >-
{% set object_id = trigger.to_state.object_id %}
{% set index = 17 %}
{% set code_slot = object_id[index:] %}
{{ code_slot }}
usercode: >-
{% set object_id = trigger.to_state.object_id %}
{% set index = 17 %}
{% set code_slot = object_id[index:] %}
{% set codetext = 'frontdoor_pin_' + code_slot | string %}
{% set code = states['input_text'][codetext].state %}
{{ code | string }}
Anytime a Code is Enabled, this fires.