Auto Door Lock without an Open/Close Sensor

I have played with a couple different Smart Apps, but I don’t have coding experience or an open/close sensor. I have a Schlage Camelot, and I know I can turn on auto-lock within the device, but the only built-in setting is for 30 seconds. I want to change this to a longer period of time before it will auto-lock. All the SmartApps I’ve seen though, require me to put in a door contact sensor. How can I just have it lock after 5 minutes without checking with a contact sensor?

maybe this? https://github.com/mikelupo/SmartThingsPublic/blob/master/smartapps/rboy/lock-single-user-code-management.src/lock-single-user-code-management.groovy

It is worth adding a contact sensor (really cheap on Monoprice for a basic Z-Wave one…).

Without one, a not uncommon thing to happen if you leave home without locking the door would be if the door were to left or blow open and the lock deadbolt would then be thrown into empty air… Actually looking the door “open” and preventing a helpful neighbor from easily closing it (within turning the bolt on the inside of the door, etc.).

Doors with connected / automated deadbolts are one of the most important places to install contact sensors, ironically.

It looks like this just lets you add or delete user codes?

Yeah, I plan to get one later. It will just be at least a month.

Well then, another workaround is to install a “Virtual Contact” (i.e., “Simulated Contact”) Sensor into your Account. You can set it to always indicate the Door is closed.

I hacked the standard ST door lock code to remove the “unlock” functionality and “door contact sensor” requirements.

Here is an example app:

Ideally, I would like to see simple functions/apps like this run locally on the hub but currently SmartLighting is the only local app.

Hi. Would you be able to add an optional field for a Door Contact Sensor to be closed before the timer triger to lock is activated? I dont want to use the auto door lock that is in the official smart things app because it has a requirement field for unlock delay which is causing problems.

Fan,
It sounds like you want the official smart app (w/ door contact) but want to disable the “unlock delay” function.
Just comment out the unlock feature and publish in the IDE. It is the first if statement in the doorHandler event.

Example:
def doorHandler(evt){
// if ((contact.latestValue(“contact”) == “open”) && (evt.value == “locked”)) { // If the door is open and a person locks the door then…
// def delay = (secondsLater) // runIn uses seconds
// runIn( delay, unlockDoor ) // …schedule (in minutes) to unlock… We don’t want the door to be closed while the lock is engaged.
// }
// else
if ((contact.latestValue(“contact”) == “open”) && (evt.value == “unlocked”)) { // If the door is open and a person unlocks it then…

You could also remove the selection or make it optional:
section(“Automatically unlock the door when open…”) {
input “secondsLater”, “number”, title: “Delay (in seconds):”, required: true
}

1 Like

Ah thank you. Reading all of that is like reading a foreign language but I think I got it now with your help. Thanks very much!

I know this is an old topic but figured this might help anyone else looking for this solution. The code above doesn’t seem to handle disabling push notifications. Even when it was set to off notifications were still being sent. I updated the code below to correct this issue.