ZWave-JS question in regards to disarming my alarm [SOLVED]

Hi All,

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).

      - service: alarm_control_panel.alarm_disarm
        data:
          code: '!secret alarm_pincode2'
        target:
          entity_id: alarm_control_panel.home_alarm

This is what I had prior so if anyone can help me translate that to ZWave-JS speak, that would be appreciated.

  - alias: 'Auto Unset Alarm on Successful Unlock'
    id: 7ea37dd6-beb8-4fe1-918a-650a226f5907
    trigger:
      # - platform: template
      #   value_template: "{{ (state_attr('lock.frontdoor_deadbolt', 'lock_status')) == 'Unlocked with Keypad by user 1' }}"
      - platform: template
        value_template: "{{ (state_attr('lock.frontdoor_deadbolt', 'lock_status')) == 'Unlocked with Keypad by user 2' }}"
    condition:
      - condition: state
        entity_id: alarm_control_panel.home_alarm
        state: 'armed_away'
    action:
      - service: alarm_control_panel.alarm_disarm
        data:
          entity_id: alarm_control_panel.home_alarm
          code: !secret alarm_pincode2

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.

    trigger:
      - platform: event
        event_type: zwave_js_notification
    condition: 
      - condition: '{{ 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

My conditions options I’ve tried are:
'{{ trigger.event.data.parameters.["userId"] == 2 }}'
'{{ trigger.event.data.parameters["userId] ==2 }}'
'{{ trigger.event.data.parameters{"userId": 2} }}'
'{{ trigger.event.data.parameters.userId == 2 }}'

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