Sensor template help

hi,
i’ve just installed the z wave module for my yale door lock and i’m wanting to set up a template to see the state and status of the lock

here is the lock info

ive tried two templates yet they dont read correctly

 - platform: template
  sensors:
      lock_state:
        friendly_name: "Lock State"
        value_template: >
          {% if is_state('lock.assa_abloy_yale_conexis_l1_sd_l1000_ch_locked', 'Locked') %}
            Locked
          {% else %}
            Unlocked
          {% endif %}

and

- platform: template
  sensors:
      lock_use:
        friendly_name: "Lock use"
        value_template: >
          {% if is_state('lock.assa_abloy_yale_conexis_l1_sd_l1000_ch_locked.attributes.lock_status', 'Unlocked by NFC Tag or Card by user 3') %}
            David
          {% elif is_state('lock.assa_abloy_yale_conexis_l1_sd_l1000_ch_locked.attributes.lock_status', 'Unlocked by NFC Tag or Card by user 2') %}
            Vicky
          {% elif is_state('lock.assa_abloy_yale_conexis_l1_sd_l1000_ch_locked.attributes.lock_status', 'Unlocked by Bluetooth') %}
            Bluetooth
          {% elif is_state('lock.assa_abloy_yale_conexis_l1_sd_l1000_ch_locked.attributes.lock_status', 'Auto re-lock') %}
            Auto Lock
          {% else %}
            failed
          {% endif %}

but as you can see their both wrong

can someone please tell me what i’m doing wrong

You’re using is_state but I believe you should be using is_state_attr (see documentation).

{% if is_state_attr('lock.assa_abloy_yale_conexis_l1_sd_l1000_ch_locked', 'lock_status', 'Unlocked by NFC Tag or Card by user 3') %}
  David
1 Like