Automatically Lock after X Minutes in Away Mode

I’m looking for some code (which I’m sure already exists on here somewhere) to allow my Quickset lock to automatically lock after 5 min if in Away mode. I intend to use this when I go on vacation and my dogwalker comes to visit, in case he forgets to lock up after he leaves.

I’m not worried if he needs to unlock again to get out of the house (if he stays longer than 5 min…) I also don’t have any mode changes set to go off based on the lock, only based on my presences. So it should be pretty straightforward.

Right now the lock itself is not set (physically on the dip switches) to automatically lock. I want to do this based on mode through ST.

Can anyone point me in the right direction please?

1 Like

That’s a “core behavior” of Doors & Locks

If your door has both a lock and a contact sensor, you can make it a Door

Then you can use “Lock up when no one is home” Or “Lock up when the door is closed” - both seem to work Ok.

1 Like

It only has a lock. I need a version of that without needing a contact sensor (I don’t really mind if it locks and is open, it would still eventually work when it is closed after he leaves)

Hmm… wonder if you made a generic contact sensor (new device type from template) and set it to “closed” on install -then you could use that contact sensor with your door (add new device, use that device type) - since then the door always reads as closed, it should lock after 5 min.

Not sure if that would work, but you could try it.

As @schettj mentioned the easiest answer is to buy a contact sensor and turn the lock into a door. One of the awesome things about SmartThings is the ability to write custom apps. You could easily tweak the app below to get it to do what you want. Outside of buying hardware or writing your own app, @obycode has a slick rule builder app called smartrules . Any of these will do what you want.

1 Like

I don’t want to spend (even more) money to do something I can with code. Tried Smartrules and it allows me to do this: if door is unlocked while Away is active, then lock back door. But I see no way to delay the action of locking.

Fake contact sensor closed seems to allow me to set it up @schettj Thanks. Ill try it when I get home.

I believe ST requires a Delta to start the closed timer, so it won’t start counting time until there’s been an Open, then a Close, which won’t happen with a virtual.

But you can use the same basic idea for a Man in the Middle protocol with a virtual switch.

Have whatever puts the house into Away mode (the dogwalker’s presence sensor?) also turn on a virtual switch with a “turn off in 15 minutes” parameter.

Then use the Big Switch for Hello Home Phrases to run a Hello Home Phrase based on that virtual switch going off which then locks the door.

Or I’m sure someone could write much simpler and more elegant custom code to do the lock in 15 minutes. :wink: @tslagle13 ?

1 Like

I’m super busy with a impending move but I will try and work something up :slight_smile:


I’m going to run ‘Goodbye’ hours before the dog walker shows up. It will be in a state of Away. During that state if the door is unlocked, and I am not there (so the mode is still in Away), then I want it to lock itself within 5 minutes. I don’t think I could create a new HHA that was automatically triggered by a door unlocking when in Away.

Let me see. I am totally new to the lock scene. Just had the Schage installed exactly two days back. :frowning:

1 Like

Think the ‘Enhances Auto Lock Door’ App via Arnaud will do exactly what you are looking for.
I just found this under a new section in the SmartSetup -> More Menu (or new as far as I’m aware :wink:)

To get this app head to the SmartSetup menu

Then Scroll to the right until you see the ‘More Section’ and then scroll down to the ‘Marketplace Sandbox’ group

Scroll down a little until you see the ‘Enhanced Auto Lock Door’ click that and than click install in upper right corner. Setup your preferences from there

Good to know, that does sound promising!

BTW, the Marketplace Sandbox is still in “sneak peek” status, most people don’t have access to those yet, but it should have wide release soon.


Sadly this looks like an oversight by Smartthings. I came here looking for the same solution. I was hoping to replace my MiCasaVerde with a Smartthings but alas, perhaps I won’t. I’m wondering if it’s possible to look into the event log (stream) for each device to determine the # of minutes since unlocked. Each time I unlock my Scalage, I can clearly see that Smartthings has time stamped the event. Therefore, if it’s possible to have a program look at the event log rather than a sensor, then I can see this working. I’m guessing as I’m writing this that Smartthings doesn’t continually poll devices unlike more sophisticated Zwave solutions which might be why they require another sensor. Still trying to figure that out.

Another thought might be a version of the program that looks at time to put the house in a particular mode, and use that program to look at the event log instead. Clearly that program runs continuously, so maybe there’s hope. This is a LOT easier in MiCasaVerde unfortunately…

No question that ST needs a better UI. (They have a team working on it, but no projected timeline yet.) meanwhile, This particular app already exists. :sunglasses: See #3 under Safety and Security, Enhanced Autolock.

No. That doesn’t do it. Requires yet another sensor. Not sure why I can do this basic automation on my Vera Lite but not on my ST.

Ummm… Without a door contact sensor, the Platform has no way of knowing that your door is Closed and thus it could throw the deadbolt onto open air instead of the cavity.

A $20-$30 door contact closed sensor solves this critical step!

(I just installed a Schlage Z-Wave lock, so I’m looking at various use cases, so this example is of interest to me.).

Two different systems with different pluses and minuses.

Vera has quite a good rules engine that runs on a PC.

SmartThings has no rules engine, which sucks. But it does have antennas for both zwave and zigbee. Zigbee antennas are smaller than zwave and typically have longer battery life, so once you’re in a mixed protocol environment you have the ability to use a number of small battery-operated $25 sensors that just aren’t available in a zwave-only system. So the solutions often are different.

But as the saying goes, “my use case is not your use case.” One thing SmartThings truly excels at is the quality and helpfulness of its developer community. :wink:

This particular topic originally described a use case which didn’t specify the number of devices allowed. So the app solution exists. But let’s expand that to your use case: lock after x minutes in away mode while using only the information from a Schlage smart lock, no extra sensors. Is that correct?

(I use my own lock differently: I have it set to autolock, so even if power is out in the house, the door still locks itself. But my use case is not your use case. Anyway, I’m just not familiar enough with the lock data to give you a one device solution myself.)

@garyd9 is an expert on locks (he wrote a very popular lock manager device handler)–maybe he can chime in here. Or @ethayer (another locks expert) who wrote an advanced lock manager smartapp. Or @obycode or @JoeC , who each wrote popular rules engines for SmartThings.

Or of course someone else may have a lock-only suggestion. Hopefully we’ll find one for you.

p.s. One small point: my college major was computer information systems and I worked as a network engineer with mesh networks long before I started adding home automation to my house. Sophisticated zwave controllers do as little polling as possible: it shouldn’t be necessary in a mesh network. Instead, when an event occurs, as long as you store the timestamp, the sophisticated controller should have all the information it needs to run timers or coordinated event checking. But again that usually ties in with a quality rules engine.

(Vera, for example, doesn’t poll at all unless the entire network has been idle for awhile, a sophisticated and sensible technique used to limit the detrimental impact of poll messages on network traffic. Vera also automatically skips polling of most battery-operated “sleepy” devices, another sophisticated technique to improve network Quality of Service. Polling Settings - MiCasaVerde )

in any case, the end user shouldn’t have to worry about exactly how the timer is done, I certainly agree inactivity is often a useful rules trigger!

Not possible because the deadbolt based lock has no way to know that the door is closed (or ajar) without an added contact sensor.

Depends how you use the term “lock.”

The manufacturer descriptions for both Schlage and Yale say the deadbolt can be set to “lock” after a period of time and, as you noted earlier, they don’t check to see if the door is actually closed first. The actuator just moves the deadbolt at that time, even if the door is open.

So within that context, I think it’s fine to say “lock” when we really mean “move the deadbolt to the locked position.”

It’s good to ask whether the use case includes knowing the door is closed, but it’s still up to each person whether they think knowing the door is actually closed first justifies the cost of a second device.

OK… Well, that’s a trivial SmartApp, as always.

As usual, the included Dashboard / Solution SmartApps do a very poor job of covering even trivial permutations of conditions.

Rules writer / engine is essential and ubiquitous in all the competitor’s products.

1 Like