Modifying the Auto lock/unlock apps for multiple family members


(Cory S) #1

Currently the


(Cory S) #2

Dang forum bug, can’t see what I’m typing while making a new post…lets try this again…

Currently, the app can only be configured for one presence sensor at a time. to compensate for that I have configured one app for each presence sensor for both locking and unlocking. The issue is when multiple people leave at once multiple lock/unlock commands are sent, which I think could be why I see the lock fail to respond more often when this occurs.

What do you guys think the best way to tweak the app would be to negotiate this scenario better?


(Jim L) #3

Here is one potential solution. If you write your program and instead of setting your locks up programatically as type lock, use them as “refresh” devices. This makes selecting the locks more problematic but it gives you some additional options.

You can call .refresh() on the lock then get the actual state of the lock. Then you can only send the command if it needs to be sent.

The kwikset locks suffer from the issue that hey do not report back their state when it changes due to someone manually manipulating the lock.

Here is an example of what I did because I noticed that my locks were not always locking/unlocking when I had manually gone up to a door and changed the state that smartthings thought the lock was in.

preferences {
	section("When a presence sensor arrives or departs this location..") {
		input "presence", "capability.presenceSensor", title: "Which sensor?", multiple:true
	}
/*	section("Select locks") {
		input "lock1", "capability.lock", multiple: true
	}*/
    section("Select locks"){
    	input "refresh1","capability.refresh", multiple: true
    }
}

def installed() {
	subscribe(presence, "presence", presenceHandler)
}

def updated() {
	unsubscribe()
	subscribe(presence, "presence", presenceHandler)
}

def presenceHandler(evt) {
	log.debug refresh1?.lock
    refresh1.refresh()
	if (evt.value == "present") {
		log.debug "${presence.label ?: presence.name} has arrived at the ${location}"
    	refresh1.unlock()
	} else if (evt.value == "not present") {
		log.debug "${presence.label ?: presence.name} has left the ${location}"
        refresh1.lock()
	}
    refresh1.refresh()
    log.debug refresh1?.lock
}

(Cory S) #4

Hmm seems like an option. My Schlage does will report back if you manually change the state of it, but you have to initiate the refresh yourself…and it hasn’t been 100% reliable.


(Cory S) #5

Have you noticed if your method seems to be any slower than the preinstalled app being it has to wait for a refresh?