So after seeing a lot of posts on here about people not being able to see their Schlage locks’ user codes (this issue focusing specifically on “which code was just used to unlock the front door?” issue), I decided to do a bit of research and poking, and I got it working for my setup.
The way this ends up working, is the lock (once securely paired) will provide an entityname_alarm_level and entityname_alarm_type whenever someone does something with the door. On my Schlage Camelot, model BE469NXCEN, these are how they work:
Alarm_type 18 means the door was locked by pressing the Schlage button.
Alarm_type 21 means the door was locked via the inside thumb turn.
Alarm_type 22 means the door was unlocked via the inside thumb turn
Alarm_type 19 means the door was unlocked via the keypad.
For entries where the Alarm_Type is 19, then the Alarm_Level on that same reading will return which slot the code came from. So, since I used HA to set the codes for my friends to the high-numbered lock slots, they won’t get overwritten if we, say, temporarily enter a code using the keypad method so our neighbor can watch our cat or something. You’ll need to know which codes are assigned to which slots in your lock to progress any further with this.
So, with the following template, I get myself a Sensor that tells me which of my friends unlocked the front door. Then you can just pop that sensor into a view, and then you can call it in a notify script using, with mine as an example,
{{ states.sensor.front_door_last_state.state }}
to send the state.
One issue with this, that I am still working on but also don’t care that much about, is that when HA first restarts, this sensor template will be Unknown, so we have to account for that. Another one is that if you use ZWave to unlock/lock your Schlage, it will not update either of these values, so any automations calling this state will show the most recent value (usually a thumb turn, in my case)
Anyway, I ramble. Here be the template:
- platform: template
sensors:
front_door_last_state:
friendly_name: Front Door Last Code
entity_id:
- sensor.front_door_alarm_type
- sensor.front_door_alarm_level
value_template: >-
{% if is_state('sensor.front_door_alarm_type', '19') %}
{% if is_state('sensor.front_door_alarm_level', '3') %}
Unlocked by Deprecated Group Code
{% elif is_state('sensor.front_door_alarm_level', '1') %}
Unlocked by Us
{% elif is_state('sensor.front_door_alarm_level', '27') %}
Unlocked by Steph
{% elif is_state('sensor.front_door_alarm_level', '25') %}
Unlocked by Rachael
{% elif is_state('sensor.front_door_alarm_level', '26') %}
Unlocked by Kat
{% elif is_state('sensor.front_door_alarm_level', '28') %}
Unlocked by Ruth
{% else %}
Unlocked by an Untracked User Code
{% endif %}
{% elif is_state('sensor.front_door_alarm_type', '18') %}
Locked via Outside Button
{% elif is_state('sensor.front_door_alarm_type', '21') %}
Locked via Thumbturn
{% elif is_state('sensor.front_door_alarm_type', '22') %}
Unlocked via Thumbturn
{% else %}
Unknown due to HA restart
{% endif %}
Hope that helps someone else. I haven’t checked this forum in a month or two but Schlage help was scarce back then and probably still is now.