[OBSOLETE] “Home on Code Unlock Too"

I’ve updated my app that sets Hello, Home mode to “Home” when a lock is unlocked with one of a specified list of codes. This can be automatic for ANY code used to unlock the door, or for specific codes only. You can specify the User Name for each code so that is reported as well.

I’ve also integrated the Distress Code functionality found elsewhere in this community (as an option).

I did get a bit carried away with dynamic pages, so things open/close based on your inputs so that you only see the enabled options and their extensions. Thanks to Patrick for the help with the array-that-isn’t-an-array, turns out it was less complicated than I originally thought…

Hope some may find this useful - you can find it in the Shared SmartApps within the IDE, or also here on my GitHub account:

As always, comments and feedback are welcome.



Cool. Thanks for sharing.

Love it- Thanks for Sharing. Hopefully I will come up with something neat like this at some point

Beautiful. Thank you!

Installed OK, but doesn’t seem to be changing the mode for me.

I’ll take a look at it tonight…I did notice that I screwed up and it currently will only run “I’m Back!” if you are in “Away” mode. I’ll fix that soon…

Made a couple of tweaks - see if it works now. (Runs specified Action no matter current location.mode).

Still not working for me. But the older version does.

Hmmm…works fine for me (standard programmer response #3) :wink:

Double-check that you don’t have it set to only work when the house is in Away mode…the app wont run on the event if that is set.

Watch the log for the app in the IDE, and tell me what you see when you unlock the door…

Not sure what you mean by “don’t have it set to only work when the house is in Away mode”. I have it set to run in a mode that’s a version of an away mode, but it’s not the standard away mode.

If you set the option at the bottom of the first Preferences page “Set for specific mode(s)” to “Away”, the SmartApp won’t run unless your location.mode == “Away” - the SmartApp won’t even see the locked/unlocked event. Try setting it to run in All Modes first.

If that doesn’t get it working, then it might be time to uninstall/re-install…

And if that doesn’t work, then I will need to see the contents of the Log when you test unlocking the door…

@storageanarchy I installed a lock tonight and installed your app. Couple of questions.

  1. for the field “how many users” - I put 1 - but it never asked me to identify which code will change mode. In your first post I thought I could identify only certain codes that would change mode? The mode did change for me when I entered ANY of my codes, even though I only put “1”

  2. I’m not sure what Allow unidentified users means? or auto lock unidentified users? Wouldn’t this be where I say certain codes can’t change the mode?

  3. I enabled distress code - but it says (1-1) does that mean the distress code can only be a 1 digit number? I tried a 4 digit number, entered it on the lock and nothing happened in ST to indicate a distress code? Shouldn’t I be telling it what I want it to do if a distress code is entered? like sound the alarm or text someone? Or does the distress code have to be a permissible code that the lock recognizes?

  4. “return to away if none of these are present” - this seems to be a required field because the app won’t install if I leave it blank. My use case for this app was to change mode if I unlocked the door but perhaps my cell phone was dead so presence wouldn’t be detected? Isn’t this the intended use case? Alternatively I would also install multiple instances of your app so that the babysitter could turn on babysitter mode with her app, which ignores my presence, and of course if I entered my code it would turn on home mode for me even though my presence isn’t detected (because of a dead cell phone)

I’m certainly not trying to be critical of your app. Just want to figure out what I’m doing wrong. Thanks!

Typical Z-Wave locks support up to 30 user codes - the “how many” determines the max user code ID you want to use so that you don’t have to go through a page for 30 user codes if you only have 4 set in the lock.

Allow unidentified means to also set home mode for code IDs that you didn’t set user names for - so, if you defined users for code 1-4, but not for 5, and someone opens the lock with code #5, it will still set the Hello Home mode to Home.

The distress code ID must be within the 1-max users that you specify. so if you want to uses code 6 as your Distress Code, then you need to set the How Many Users to 6.

The intended use case for “return to away if NONE of these are present” is to handle the case where someone uses a code to get into the house, then someone else with a presence sensor comes home, and then the original person leaves - you clearly don’t want to set the home to “away” with people still home. But you probably DO want it to set to Home if it was the cleaning people coming in to clean and then leaving while you were away.

Note that the App doesn’t actually deal with the code that is entered on the lock, it refers to the Code ID/Index/Position that is used to open the lock. You have to actually set the pass codes on the lock itself, following the instructions that came with the lock.

I welcome all suggestions for enhancements, and I’m sorry if this wasn’t all clear and intuitive. I’m not a UI guy :smile:

Bummer - found a bug in the SmartThings device handler when used with a Schlage lock - keyed unlock returns “unknown” instead of “unlocked” when you use the key, but not when you use the inside knob.

I’ll need to report this to Support, but I’m out of time this morning…probably can’t finish this until after Labor Day.

ST support informs that the bug must be something in my installation, even though it only happens on a keyed unlock. They tell me to re-install the lock, which I will do at some point.

But in the meantime, I’ve added a little work-around. This shouldn’t be a problem if your lock is working properly, and it should correct the issue should it happen on any other locks. The fix is kinda necessary, because if the “Unknown” event occurs, the lock disappears from the ST Doors & Locks display until you re-lock the device by hand or command…

Anyway, the new code is available in the Shared SmartApps section of the IDE and in my GitHub account ( https://github.com/SANdood/Home-on-Code-Unlock-Too ).

I’m not getting any errors when unlocking with a key. It reports as being unlocked manually in the activity log.

So if I have 4 user codes and I want hello home action on #3 and distress on #4 I don’t see how I can do that and not also get hello home actions on 1 and 2. Is there a way to do this?

Lastly, I saw in another thread that you were going to add hello home options when manually unlocked (key or inside). will that be included in this app? I would like to have that function.

Thanks again for your app!


This might be a tad off topic as I’m new to using “custom” SmartApps, but how do I use this SmartApp on more than one lock?

Changing the simulator settings allows me to pick the door to use, but that’s it. I can’t have two copies of it running simultaneously.

It’s working great for me, so I’d like to use it for all applicable doors.



1 Like

You have a choice not to run the Hello Home actions for any code ID that you do not specify a name for via the “Allow Unspecified Code IDs” toggle - if OFF it won’t run the hello home action for any blank user names in your list.

And yes, this latest version also supports the use of the key to run either the default Hello Home action, or one specific for the key. This is enabled with the “Change Mode on Manual/Keyed Unlock also?” toggle, which will then enable a “Use separate Hello Home action for Manual/Keyed Unlock?”, while will then give you the ability to specify which Action you want for the keyed entry.

You should be able to add multiple instances of this SmartApp on your mobile device.

Then simply select a different lock for each one. You will probably also want to rename each one so that you can keep track of which is which.

Making a single app handle multiple locks will be a little complex, but if there’s enough interest I might tackle it. It would probably require that the lock IDs/names be the same on all of your locks, else the preferences UI will get REALLY complex.

Barry, I think I previously misunderstood what defined an unidentified user. But it’s working great for me now.

The distress signals are showing up in Hello Home and via text. But not as a ST Push notification. I think that would be a big help for anyone who wants to Push to themselves and Text someone else. Lastly, I noticed a typo in “Don’t run Actions OF any of these are present”

Thanks again for your app!