Enhanced Auto Lock Door?!?!?!?!

Maybe I’m missing something… why would I want to set the “automatically unlock door when open”. if the door just opened presumably it is unlocked… i guess if someone then locked it and tried to close it it… but I imagine when the door didn’t close they would try unlocking it before closing it? if I’m following correctly this just means if my contact sensor screws up and shows open smart things will unlock my closed door…

I hope I’m missing somthing


Saves on the dents in the door jam if the doors autolock and then somebody tries to close it with the bolt out.

Yea that really confused the hell out of me too. I got some crazy push notification to the tune of auto locking the door because the closed and open status of the lock that is locked is unlocked… It made no sense, I deleted that sucker quick, I want my dashboard solution modules back…

Why would the bolt be closed if the door is open… This is not an acceptable replacement…

Also considering if you manually lock the door and you have the door set to auto lock after x minutes, it will unlock the locked door. Deleted immediately when I saw that happening.

1 Like

I think that was a behaviour I saw too and was really turned off to it.

has anyone removed the auto unlock code from it by chance? or is there something else others are doing to auto lock?

Been using the code for a month. I’ve had one incident when almost made me take out the unlock feature, but then I had 3 where the feature worked as intended, meaning that the door locked on me with the door open and then unlocked itself, so I didn’t have to. So it’s 1 to 3 for me. When the score changes jn favor of the annoyance, I will make the change in the code.

I’ve had it fail and send me to many crazy push notifications so I gave up and removed the unlock portion. if anyone else is interested here is the modified code. I will mention I am not much of a coder and have no knowledge of groovy at all but it seems to work better than the original for me anyway.

    name: "Non Enhanced Auto Lock Door",
    namespace: "Lock Auto Super Non Enhanced",
    author: "Arnaud",
    description: "Automatically locks a specific door after X minutes when closed  and unlocks it when open after X seconds.",
    category: "Safety & Security",
    iconUrl: "http://www.gharexpert.com/mid/4142010105208.jpg",
    iconX2Url: "http://www.gharexpert.com/mid/4142010105208.jpg"

    section("Select the door lock:") {
        input "lock1", "capability.lock", required: true
    section("Select the door contact sensor:") {
    	input "contact", "capability.contactSensor", required: true
    section("Automatically lock the door when closed...") {
        input "minutesLater", "number", title: "Delay (in minutes):", required: true
    section( "Notifications" ) {
		input "sendPushMessage", "enum", title: "Send a push notification?", metadata:[values:["Yes", "No"]], required: false
		input "phoneNumber", "phone", title: "Enter phone number to send text notification.", required: false

def installed(){

def updated(){

def initialize(){
    log.debug "Settings: ${settings}"
    subscribe(lock1, "lock", doorHandler, [filterEvents: false])
    subscribe(contact, "contact.open", doorHandler)
	subscribe(contact, "contact.closed", doorHandler)

def lockDoor(){
    log.debug "Locking the door."
    log.debug ( "Sending Push Notification..." ) 
    if ( sendPushMessage != "No" ) sendPush( "${lock1} locked after ${contact} was closed for ${minutesLater} minutes!" )
    log.debug("Sending text message...")
    if ( phoneNumber != "0" ) sendSms( phoneNumber, "${lock1} locked after ${contact} was closed for ${minutesLater} minutes!" )

def doorHandler(evt){
	if ((contact.latestValue("contact") == "closed") && (evt.value == "locked")) { // If the door is closed and a person manually locks it then...
        unschedule( lockDoor ) // ...we don't need to lock it later.
    else if ((contact.latestValue("contact") == "closed") && (evt.value == "unlocked")) { // If the door is closed and a person unlocks it then...
        def delay = (minutesLater * 60) // runIn uses seconds
        runIn( delay, lockDoor ) // ...schedule (in minutes) to lock.
    else if ((lock1.latestValue("lock") == "unlocked") && (evt.value == "open")) { // If a person opens an unlocked door...
        unschedule( lockDoor ) // ...we don't need to lock it later.
    else if ((lock1.latestValue("lock") == "unlocked") && (evt.value == "closed")) { // If a person closes an unlocked door...
        def delay = (minutesLater * 60) // runIn uses seconds
        runIn( delay, lockDoor ) // ...schedule (in minutes) to lock.
    else { //Opening or Closing door when locked (in case you have a handle lock)

This app is silly. I’ve had a super short app I wrote that simply waits until you close the door, then sets a timer to lcok the door. A separate timer is started for an unlock. That way if someone manually unlocks, does the code, or a presence sensor misfires, the door will relock in a set time.

I just wish this sort of thing would run locally on the hub. When there are cloud issues, the lock doesn’t always fire. It seems the runIn function is vulnerable. Though it does work 99% of the time on the first attempt, I should probably add in a feature to check the lock status again 5 seconds later. Though if runIn isn’t working, that will be an issue.

Guess I could just trigger something when the door is properly locked. I’ll have to think. Either way, I’m sure as hell not going to have my door unlock when the sensor misfires…hahaha I laughed when I saw that, and canceled the install. Canceling a scheduled lock command if the door is still open makes way more sense.


sounds good! care to share your app?

Yes im interested in this as well

Oh man, I’ve never shared anything before. Let me test it a bit more, then I can give y’all the code.

For some reason in the last few weeks, the scheduling ability of commands has been hit-or-miss. I’ve written some new code in there to help manage that. I still have some work to do though.

May I recommend looking into creating a github account, it’s a better place to share your code than just pasting it into the forum here.

I’ll definitely look into that. I’ve pulled code previously off github before to install smartapps, so I am familiar. Though I do wish I could somehow have my smartapps update when the software is updated in github for tested releases.

Yea, there’s probably some provision to at least send you an email when the developer updates it. I wouldn’t like Auto Update though in case it breaks something that worked fine for me.

Creating a repository is a little confusing, I wish you didn’t have to use ssh or anything to create it.

Personally, I’d like the ABILITY to subscribe to the stable releases of code. Even if I have to vet the code in github/lab or whatever. I just hate having to update the code for all these apps in IDE when someone ELSE makes a change.

I realize you can tie IDE to your own github account now, but that doesn’t help me with other projects.


I got the crazy push notification with this app too, then the deadbolt latched while the door was open.

try copying the code again… i axcedentially left a line in. now the only notification left in the code is “___locked after __ minutes”

With this app, the likelihood of you ever having that weird problem is almost zero.

I’ve never shared anything like this before, so please be gentle. I’ve been using it for a few days without issue, and the lock confirmation is really nice. Also, you will be notified if the lock fails a second attempt. I could make it more modular, but this is at lease a starting point. I’ve also had fairly good results with the runIn feature in the last few days, but avoided it where I could.

Club Steve’s Auto-Lock

It’s silly how simple this is, so I hope you weren’t expecting anything special, haha. I had one I made way back when to handle presence and all that stuff, but at some point I decided I’d rather just have multiple, more simple apps. That way I could add/remove functionality straight from my phone, rather than having to go modify code on my PC.