How to Execute Action if Door Opened with Specific Code

I have Kwikset locks. I control them with the SmartThings Hub. I use the Rboy Apps DTH. I also use the Rboy LUM app as well. I control my lock as well using ShartTools and Tasker depending upon a geofence location. I am trying to write a Rule, though, in the SharpTools Rule engine that will perform an action if a specific code is used to unlock the door. Is this possible? If so, how? I can’t figure out which Attribute to check. See the partial list in the screenshot below. I can select the “lock” attribute and trigger an action whenever the lock is unlocked, but that means it would work if I unlocked the lock from inside as well as using a code. I just want it to trigger on a specific code. Thoughts? Thanks.


It depends on what the device handler reports - especially since this is a custom device handler.

RBoy support is usually pretty helpful, so you might reach out to them and ask if any of the attributes report which code/user was used to unlock the door.

Reading through the RBoy description for the Lock User Manager, it sounds like that SmartApp has some built-in features that integrate well with their ‘Universal Enhanced Z-wave Lock’ handler:

Configure independent rules based how the user locked/unlocked the door (external keypad, inside/outside, remotely, manually, rfid, bluetooth etc) (requires the use of the Universal Enhanced Z-Wave Lock device handler)

I wonder if their Lock User Manager could be used here? Either to directly trigger whatever action you’re looking for or maybe to trigger something like a virtual switch that you could use as a proxy for triggering your rule in SharpTools.

Reading through the Universal Enhanced Z-wave Lock thread, it sounds RBoy’s handler exposes the usedCode / method via the data parameter. We don’t currently expose the data parameter and looking through the docs for the new SmartThings API, it doesn’t seem like the new API exposes that information.

One other thing I would add is that you can review what values each of the attributes are reporting by viewing the device details in

  1. Open your User Page
  2. Tap the … next to your desired location
  3. Tap your desired device

You should see the values for each attribute under the Attribute Values table. Note that grayed out values don’t have event subscriptions which means their values may be stale or outdated… but it should at least give you an idea of what kind of values are reported:

This approach is especially helpful for custom device handlers. For devices using standard capabilities, you can refer to the SmartThings Capabilities documentation for reference.

Thanks for the ideas. The reason I’m trying to find a way to do this in SharpTools is that LUM doesn’t always turn the alarm off (see my other posts about latency). LUM is great. Allows me to reset the SHM status when the lock is opened with a specific code. I also can run a SmartThings routine. Most of the time this turns off the alarm. However, because of latency, it sometimes doesn’t always work. I figured out that I can send an “off” command directly from SharpTools/Tasker. I assume that this might be quicker (but one never knows, right?). So, I wanted to try to see if I could grab the code used in SharpTools/Tasker and then issue the “off” command. I’ll keep poking around. Thanks.

1 Like

By the way, I’m also experimenting with this in webCore. I think I can do it there as well. Now I’m messing with webCore to see if I can set the alarm to home or away rather than just off. I think I can do home or away with SharpTools/Tasker. However, in webCore I only see “away(…)” in the list of commands available. I’m trying to figure out if I can manually edit the line of code in webCore to try “home()”, but no luck so far. This is just an FYI and nothing for you to worry about. :wink: Thanks.

1 Like

Any chance you have an idea on how to have a yale lock do something in particular when a specific unlock code is entered? I’ve tried lockcodes but not sure what to enter into the “input string value” section.
These are the values under attributes:
lockCodes 3/28/2020, 5:56:17 PM {“1”:“Code 1”,“2”:“Code 2”,“3”:“Code 3”,“4”:“Code 4”,“5”:“Code 5”,“6”:“Code 6”,“7”:“Code 7”}

I’ve tried 1, “1”, Code 1, “Code 1”. Just not sure what it’s looking for or where to find the answer

@Jeremy_Buras, I hope you don’t mind me merging your posts into this related topic. The SmartThings official lock device handler doesn’t report what code was used to unlock as attribute but only in data and we currently don’t support using info from data as trigger. RBoy’s enhanced z-wave lock device handler is a pretty popular community developed device handler that may support what you need.

See the earlier post from @Josh in this thread that you can use a Virtual Switch(VS) as a proxy to trigger a rule. Ex: In the Lock User Manage, turn a VS on when a code is used to unlock, and in Rule Engine, create a rule that to be triggered when this VS is turned on, and do whatever you wanted to do in the Flow, and turn this VS back to off in the end of rule.

1 Like

RBoys sounds like what i need. and I’ll work on the VS. THANKS!!