I have found in forums how to set and delete user codes with automation, but what I am looking for is how to do specific things when a certain user code is used on the ZWave door lock. I have not been able to find anything on this. what is the right way to get this? Node-Red? Unfortunately in the Logbook, there isn’t anything that shows “User Code 2 was used to unlock door”. It just shows lock was unlocked. Has anyone figured this out?
You should have Zwave sensors created when you added the lock. You can use those sensors to determine how the door was unlocked (or locked), and the user code used if it was a keypad unlock. You can also trigger automations on manual lock, manual unlock, z-wave lock, z-wave unlock, etc.
sensor.xxx_access_control = 6 when unlocked with keypad
sensor.xxx_alarm_level = user code used to unlock the door.
You can see the other values for access_control in the Zwave entities documentation
You should be able to use access_control to determine if it is unlocked with keypad then alarm_level to get the user code.
Example automation snippet to trigger on unlock with user code 4
trigger:
- entity_id: lock.front_door_lock
platform: state
to: unlocked
condition:
- condition: state
entity_id: sensor.front_door_lock_access_control
state: '6'
- condition: state
entity_id: sensor.front_door_lock_alarm_level
state: '4'
action:
...
2 Likes