Report Unlock code used



I think my lock has a tamper on it but have to set it manually from the lock and im not sure if that would matter or not


I’m a little late to this thread but here goes.

I have a Schalge BE469 Z-Wave lock. My end goal was to know who came in the front door so I could turn on the appropriate lights when guests came in after close up. We run a small B&B hotel. I started with the Piston from @Dan_Fox and started to make some adjustments. It did not account for empty slots when a code is deleted and I was getting errors in the array. So I added that and then spent 3 days beating my head on the wall, because it was not reliable. I also did away with the array as I discovered I could get the same data from the $args and I don’t really need the String array for any further processing. Then I finally realized that the problem is always when Code 1 is used. Code 0 as discussed, is for any manual unlock (would be nice to know the difference between a key on the outside and the thumb latch on the inside…but I digress). My personal access code happened to be in Slot 1 and the piston worked fine with everyone but me. You can ignore the Push notifications. I will clean them up later. I finally deleted my code and put one of the default codes back in Slot 1 and then re-added myself. So now the DefaultA code in Slot 1 has the problem.

Notice that Unlocked By = null…It should have been DefaultA

I wrote another short piston to:
On Lock events:
Log info to Console

It actually shows the correct name:


So what gives??? I originally had UnlockedBy defined as String but changed it to Dynamic and the result was the same. So why does logging to console show it correctly but when pulling the same $arg.codeName in my piston it comes in as “null”.

The lock actually has 2 default codes if you do a factory reset but they were cleared before when I was playing with another lock SmartApp and DTH. I manually added one of them back in after deleting my own personal code. So is there something special about this slot? What am I missing.

Thanks all.


Did you ever figure it out? I’m also looking for a compatible announcement/notification for the schlage lock.


I’m trying to use a similar piece of code to get the code name of the code that was used to unlock the door. When I look at the IDE, there is no $args.codeName defined.
“lockName”: “Front Door Lock”,
“codeId”: “3”,
“method”: “keypad”,
“usedCode”: 3

I can get the array of lock codes and names by:
Set Variable {LockCodes} = {[Front Door Lock : lockCodes]}
(expression) LockCodes »»» (dynamic) {“1”:“Doe”,“2”:“Cory”,“3”:“Jamie”,“4”:“LM”,“5”:“Janet”,“6”:“Zoe”,“8”:“Antonio”,“9”:“Jake”,“7”:“Judy”}

If $args.userCode is 3, how do I return the string “Jamie”?
How do I tell if LockCodes is “not found”, so I can initialize it? I do not want to initialize it on every event. {isEmpty(LockCodes)} returns false.


I am also trying to set something up but I can get this piston to fire. Can anyone help me out.


Been away from the forums for a while as everything has been mostly working well. Here is the piston I ended up with that works well for controling lights based on who came in the door and to make an announcement on my Google Home speaker.

Combined with this piston that figures out if anyone is in a bedroom based on active codes in the lock. This runs every time there is a change in the lock codes.