How to Determine Which User Code Unlocked Door


1) Give a description of the problem
I cannot get webCore to limit the disarming of my security system to only when a specific code unlocks the door.

2) What is the expected behaviour?
When user #5 opens the door using the correct code, the security system should disarm. webCore has no problem disarming the system. That’s not the issue.

3) What is happening/not happening?
Even though I think I’ve limited the webCore code to trigger only when user #5 opens the door, the system is disarmed even if the door is opened from the inside. I cannot figure out how to limit the disarm activation to only one user code.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full

If a solution is found for your question then please mark the post as the solution.


your phone # is visible just so you know…


I haven’t use my locks for this purpose but i can suggest a workaround.

You can use a different code from inside-out vs outsude-in.


Shoot. I meant to block that out. Thanks.


Are you saying use a code to get out? If so, the locks only have codes on one side. There is just a dead-bolt handle on the inside. Thanks.


i’m trying to understand this part.

You don’t enter any code going from inside-out (because you don’t have a panel) you use handle bar,
and this action disarms the system??


For my Kwikset lock, this shows up under the IDE:


Creating a quick piston, I see these options:

I guess see what options you have, and try to figure out how to determine which code unlocked your door.


I’ve never worked with locks but looking at other pistons I think you’ve actually simply tested if the lock has been unlocked by anybody or by any method and the details of what actually happened is carried in the event. So the code is $args.usedCode and there is a type argument to say if the keypad was used.


ST notifications will tell me which code unlocked the door. I’m just not sure how to read that code in WC.

[EDIT] I found a DTH online and found this in the coding:

case 6: // Unlocked with keypad
if (cmd.eventParameter || cmd.alarmLevel) {
codeID = readCodeSlotId(cmd)
codeName = getCodeName(lockCodes, codeID)
map.descriptionText = “Unlocked by “$codeName”” = [ codeId: codeID as String, usedCode: codeID, codeName: codeName, method: “keypad” ]

Is there anyone here that knows how to edit a DTH and could add the functionality of displaying the code in WC?


Damn…nvmd…found it:

This piston works perfectly.


Yes. These are Kwikset deadbolts (910s maybe?). If I turn the deadbolt handle on the inside, it fires the piston. Now, when I was testing this at one, I did select more users, so maybe that’s why it did it. Regardless, it fires when the deadbolt is opened form the inside and I get the text that the piston disarmed the system. I obviously don’t want just any unlocking of the door to fire the piston. Just if it’s unlocked using a user code. Thanks.


Thanks for checking all this out. Maybe I just haven’t figured out under Lock (after Physical devices in one of your screenshots) which code is the correct one. I thought I read somewhere that maybe they are listed one off from the actual number. In other words, 5 in my setup is 6 when I select something in webCore. I’ll experiment some more…


I think that’s probably the case. I just need to figure out where to use that argument. Thanks.


You can look on here to see which model you have:

You could add the line
If Security Door Lock’s lock #1 gets unlocked
Then disarm system

[EDIT] Oops…you already have that. Your piston should run as written. Perhaps you have another piston running (that you’ve forgotten about) that is disarming the system when a door is unlocked? This tells me you might:

That said, if the lock is manually unlocked from the inside, there’s no real way of determining who unlocked it. You can only do that if they unlock the door from the outside with the code.


I see,
and you are sure no other piston and/or automation is involved with this lock right? (just to be sure)

Since mines are Schlage, i can’t properly test.
Apperantly the piston is getting triggered not with #5 but instead just with UNLOCKED.

All i can suggest is try all available code related options as @Mebejedi suggested and posted a picture.


There is no other Piston. This is my first experiment. Also, when I unlock from the inside, I get a text that the Piston turned off the alarm. I’ll keep experimenting. Thanks.


Yeah, I think it’s triggering somehow with Unlock. There is no other Piston. When I unlock from the inside I get the text that the Piston disarmed the system, so it has to be triggered by unlock. Thanks b


Ok, when I get home today, I will copy your piston and see if I get the same results with mine.

Do me a favor, though. I would like you to unlock your door manually, and then step outside and try all your combinations. Then screenshot the “Recent Activity” for the lock in ST so we can see what’s registering.


Will do when I also get home today. Thanks.


@davidag02 gave me a code idea over on Reddit: This is literally all you need to do: I am trying this, although I modified it to this:

Still doesn’t seem to be working, though. At least I’m not getting the Push notification, so I don’t know that the Piston is running, although I think I saw a notice somewhere that the Piston ran.

Here is a screenshot of one of the logs in IDE showing the UserCode execution.

Is there some way to export the user log into a file rather than just sending screenshots? There are a lot of SmartThings Apps running and a lot of entries.

The one thing that didn’t happen was that opening the door by the deadbolt handle did not seem to trigger anything. Of course, it didn’t run correctly using the code, either. However, LUM should have turned off the alarm if webCore didn’t, and that didn’t happen. I think there’s just a long delay before commands are sent to the alarm to turn it off (latency issue?).

Anyway, thanks.