I’ve just migrated from ZWave to ZWave-JS which was surprisingly quick and easy. I am however struggling with the complexity of the automations now that my door lock no longer has attributes and everything is done through events. I found a blueprint here but it inserts quote marks around the code: section so the !secrets is not read correctly as shown below. I don’t know how to fix that because if I remove the quote marks in the blueprint, the blueprint does not load when HA starts. Manually editing the completed automation gets the automation working but kills editing all automations (error 500).
OK, I’m getting close. I have this now but HA keeps spitting out automation errors stating Invalid config for [automation]: Unexpected value for condition: '{{ trigger.event.data.parameters{"userId": 6} }}'. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone @ data['condition'][0]['conditions'][0]. Got None. (See ?, line ?)
I’ve tried all variations but can’t seem to crack it. I know it’ll be just a dot somewhere so if anyone could chime in, that would be great.
Cracked it! Couldn’t find anyone with this code on the forums so this might come in handy for anyone wanting to unset their alarm with a valid user code. I’m sure there will be a way to use else/if to add all users but for now, it’s working for me so I’m happy.
automation:
- id: 7cc1ff4e-a762-4925-a28f-80945d432057
alias: '[Lock] Unset alarm when Pete enters his code'
description: Auto unset for user in slot 2.
trigger:
- platform: event
event_type: zwave_js_notification
condition:
- condition: template
value_template: '{{ trigger.event.data.parameters["userId"] == 2 }}'
- condition: not
conditions:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: 'disarmed'
action:
- service: alarm_control_panel.alarm_disarm
data:
code: !secret alarm_pincode2
target:
entity_id: alarm_control_panel.home_alarm