Yeah this took me a bit of fiddling to figure out. I managed to also find some z-wave lock documentation which should be consistent among z-wave locks here (useful info is on Page 4).
I decided to use two templates to track the “Action” and the “User” separate. That also allows me to track other statuses that are useful - like the “jammed” state which seems to be a general “something went wrong and the door didn’t lock” state. It is definitely useful - I’ve had the door fail to lock when I pressed the outside button and didn’t notice so I got a notification and went back to lock it manually.
The other thing I found in the documentation is that it definitely should track wireless lock/unlock but I’ve found that it doesn’t actually report that status (as you found).
Anyway here are my templates.
Action
sidedoor_action:
friendly_name: 'Side Door Action'
value_template: >
{% if is_state('sensor.side_door_alarm_type', '22') %}
Manual Unlock
{% elif is_state('sensor.side_door_alarm_type', '21') %}
Manual Lock
{% elif is_state('sensor.side_door_alarm_type', '19') %}
Keypad Unlock
{% elif is_state('sensor.side_door_alarm_type', '18') %}
Keypad Lock
{% elif is_state('sensor.side_door_alarm_type', '25') %}
Wireless Unlock
{% elif is_state('sensor.side_door_alarm_type', '24') %}
Wireless Lock
{% elif is_state('sensor.side_door_alarm_type', '9') %}
Lock Jammed
{% elif is_state('sensor.side_door_alarm_type', '161') %}
Tamper Alarm
{% else %}
Other
{% endif %}
User
sidedoor_code:
friendly_name: 'Side Door Code'
value_template: >
{% if is_state('sensor.side_door_alarm_type', '19') or is_state('sensor.side_door_alarm_type', '18') %}
{% if is_state('sensor.side_door_alarm_level', '1') %}
User1
{% elif is_state('sensor.side_door_alarm_level', '2') %}
User2
{% elif is_state('sensor.side_door_alarm_level', '3') %}
User3
{% elif is_state('sensor.side_door_alarm_level', '4') %}
User4
{% else %}
Unknown
{% endif %}
{% else %}
n/a
{% endif %}
Note the “N/A” which is basically “no code”.
Hopefully you find some of that interesting. I would love to hear if there are any solutions to the wireless lock/unlock but I’m not hopeful.