--- - platform: template sensors: lock_01_keycode: friendly_name: 'Lock Last Key Code' value_template: >- {% if states('sensor.lock_01_alarm_level') | int == 0 and states('sensor.lock_01_alarm_type') | int == 19 %} Locked {% elif states('sensor.lock_01_alarm_level') | int == 1 and states('sensor.lock_01_alarm_type') | int == 19 %} Alex {% elif states('sensor.lock_01_alarm_level') | int == 2 and states('sensor.lock_01_alarm_type') | int == 19 %} Tanya {% elif states('sensor.lock_01_alarm_level') | int == 3 and states('sensor.lock_01_alarm_type') | int == 19 %} Maxim {% endif %} - platform: template sensors: lock_01_status: friendly_name: 'Lock Status' value_template: >- {% if states('sensor.lock_01_alarm_type') | int == 17 %} Lock Secured at Keypad – Bolt Jammed (Not fully extended) {% elif states('sensor.lock_01_alarm_type') | int == 18 %} Lock Secured at Keypad – Successful (Fully extended) {% elif states('sensor.lock_01_alarm_type') | int == 21 %} Lock Secured using Keyed cylinder or inside Thumb-Turn {% elif states('sensor.lock_01_alarm_type') | int == 23 %} Lock Secured by Controller – Bolt Jammed (Not fully extended) {% elif states('sensor.lock_01_alarm_type') | int == 24 %} Lock Secured by Controller – Successful (Fully extended) {% elif states('sensor.lock_01_alarm_type') | int == 26 %} Lock Auto Secured – Bolt Jammed (Not fully extended) {% elif states('sensor.lock_01_alarm_type') | int == 27 %} Lock Auto Secured – Successful (Fully extended) {% elif states('sensor.lock_01_alarm_type') | int == 19 %} Lock Un-Secured by User ({{ states('sensor.lock_01_alarm_level') | int }}) at Keypad {% elif states('sensor.lock_01_alarm_type') | int == 22 %} Lock Un-Secured using Keyed Cylinder or inside Thumb-Turn {% elif states('sensor.lock_01_alarm_type') | int == 25 %} Lock Un-Secured by Controller – Successful (Fully retracted) {% elif states('sensor.lock_01_alarm_type') | int == 161 %} Failed User Code attempt at Keypad {% elif states('sensor.lock_01_alarm_type') | int == 167 %} Low Battery Level {% elif states('sensor.lock_01_alarm_type') | int == 168 %} Critical Battery Level {% elif states('sensor.lock_01_alarm_type') | int == 169 %} Battery Level too Low to operate lock {% else %} Unknown State {% endif %}