Lock the Door When 2 Presence Sensors Leave


#1

As I’m sure you’ll see, I’m a total newb to home automation and webcore. Apologies for what is very likely a very basic question. Setting up pistons reminds me of the days when I did Turing programming in high school computer class. Clearly a little…that’s an understatement…rusty.

1) Give a description of the problem
The door did not lock even though both phone-based presence sensors were picked up by ST as away.

2) What is the expected behavior?
Lock the door when both phone-based presence sensors are away.

3) What is happening/not happening?
Nothing, the lock just stayed unlocked. The log time below is when we actually left home.

12/25/2018, 5:40:14 PM +836ms
+10103ms	║Piston waited at a semaphore for 10017ms

#2

Try changing line 21 to ‘are not present’, then click the cog icon and under Subscription, select Always.


#3

What kind of lock do you have? My Kwikset 910 has a setting to automatically lock the door after a minute.


#4

eibyer, Your suggestion worked! Thanks for your help!

Mebejedie, I have a Schlage Connect lock. I want it to specifically lock only when both my wife and I are out. I don’t want it to automatically lock every time it’s unlocked.


#5

I now want to create a script that unlocks the doors when either myself or my wife comes home. Have I done it correctly?

Note that once we’re home, I have other pistons that will trigger when the doors lock (eg. nighttime). As long as one of us is home, I don’t mind that the door stays unlocked.


#6

I’m very hesitant to give advice on auto-unlock piston if there’s no guard against times when ST flakes out. You’d find your door unlocked when you wake up in the morning or some odd times, definitely not good for the waf.


#7

I have a piston that runs a ‘Home’ routine when I get home. But, I use Tasker to detect when my phone connects to home wifi, then uses SharpTools to run the Home routine.

Actually, it used to work pretty well, but I’ve found lately that it isn’t running the routine for some reason.


#8

eibyer,
I’m not too fussed about this lock as it’s the door from the inside of my garage to the house. If it unlocks at any time, someone would have to get into the garage first.

bigalpha,
I still need to read up some more on Tasker/Sharptools, but is there a way to replicate what you’ve done using iphones?


#9

The doors didn’t unlock when we got home.

I’m getting these on my log. The 10:20am entries were when we left the house, and the 1:17pm entries were when we got home.

12/28/2018, 1:17:37 PM +113ms
+113ms	║Piston execution aborted due to restrictions in effect
12/28/2018, 1:17:24 PM +416ms
+105ms	║Piston execution aborted due to restrictions in effect
12/28/2018, 10:22:01 AM +504ms
+71ms	║Piston execution aborted due to restrictions in effect
12/28/2018, 10:21:55 AM +158ms
+90ms	║Piston execution aborted due to restrictions in effect

#10

Line 19 and 23 are clashing… remove 19 first and check.


#11

I couldn’t agree more…
I live in a very very safe city (crime rate almost zero - PD has 3 cars only LOL) even than,
I don’t let my piston mess with the locks after 10.00pm to 5.00am

10.00pm door is locked, pistons are out;))ST hub has no control over them at all at this point…

And @SW20MR2 just a suggestion:
consider a seperate piston only cheks the lock status and sends you SMS - instead of using that in this piston -

IF lock 2 status changes to unlocked
Send SMS “garage entry door is unlocked”

at least in this case even if someone manually unlocks the door you will get a notification…


#12

If I remove line 19, won’t that make it so that it unlocks our doors anytime that one of us is home? My logic behind the original code was to unlock it only if we were both away and then one of us comes home. Can I reflect this intention in the code?


#13

Sorry, I’m not sure about the iPhone side of things.


#14

Here’s one we use at our house. You can remove the ‘Routine’ and ‘Keypad 3’ lines in the first IF. (I use the routine to ask Google Assistant on my phone to unlock the door and the button was just for giggles. The button sits on my desk in my home office so I can unlock the door without walking all the way to the door. gasp!) Of course, you also need to add your presence sensors to a global variable or just hard code them in place of @presence_sensors.

The last IF only texts me if the lock changes if we’re Away. I used to have it text me anytime the lock changed, but I removed it after I was confident it wasn’t locking and unlocking when it shouldn’t.