Author Topic: Setup scene to automatically lock door if unlocked for XX minutes  (Read 735 times)

Offline nutshellml

  • Full Member
  • ***
  • Posts: 229
  • Karma: +1/-2
I have Shalge lock with my Vera Plus.  I'm trying to figure out how to best setup a scene that if the door is in the UNLOCKED state for more than XX minutes to LOCK it.  Can this be done w/ PLEG if so, how?  Or can it be done with the normal Vera scenes.

Thanks for any info!

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 755
  • Karma: +18/-2
    • Worthington Engineering, Inc.
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #1 on: February 25, 2017, 07:25:09 pm »
I should work both in PLEG and regular scenes. It just requires a timer.  PLEG has that capability, and you can install the countdown timer plug-in. The scene would start a timer when. A second scene would lock the door when the timer completed. Similar in PLEG.  Play with it, you will learn trying to get it to work.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline nutshellml

  • Full Member
  • ***
  • Posts: 229
  • Karma: +1/-2
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #2 on: February 25, 2017, 07:33:01 pm »
I should work both in PLEG and regular scenes. It just requires a timer.  PLEG has that capability, and you can install the countdown timer plug-in. The scene would start a timer when. A second scene would lock the door when the timer completed. Similar in PLEG.  Play with it, you will learn trying to get it to work.

THanks, I'll mess with the countdown timer, still having trouble with fully understanding PLEG with simple scenes like this.  Even after printing the entire manual...

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 755
  • Karma: +18/-2
    • Worthington Engineering, Inc.
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #3 on: February 25, 2017, 07:49:20 pm »
PLEG is much more powerful. They way I would do it is create a schedule using a selftrigger, a trigger to start the timer, a condition when the door is unlocked and the time expired, and an action to lock the door when the condition is true. Another learning opportunity  ;D
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline kigmatzomat

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +8/-0
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #4 on: February 25, 2017, 10:22:51 pm »
I have this set up on my locks.  To do it right you also need a door sensor to be sure the door is shut or the bolt will extend while the door is open. 

I have a PLEG trigger for the door being closed and another for it being unlocked.  The condition below confirms both are currently true and that they have been that way for more than 3 minutes. 

tfrontDoorClosed and tFr_unlocked and ( tFrontDoorClosed ; Now >3:00) and (tFr_unlocked ; Now >3:00)

Then you can use that condition as the trigger for a lock scene or directly add luup code to trigger the lock. 

I recommend an additional condition to trigger a notification if the locking failed.  e.g. below

tFr_unlocked and  (tFr_unlocked ; Now >5:00)

Offline Mike Yeager

  • Sr. Member
  • ****
  • Posts: 432
  • Karma: +5/-11
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #5 on: February 27, 2017, 11:45:42 am »
That is how I do mine with the exception of having a virtual switch to turn auto locking on and off. It works very well and since I've managed to train people to lock the door when they know it should be locked, it's not even too bad on batteries. That said, my locks use AA batteries so I'm not too concerned with them....

Offline 3rdStng

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #6 on: February 27, 2017, 12:40:39 pm »
Thanks Kigmatzomat. I've moved all my timers over into PLEG and have struggled a bit with getting the lock timer moved in. In my testing, everything was working right, but when I eventually closed the door, it didn't wait the 3 minutes to lock it. It would immediately lock. I'll try your condition above and see if that helps.

One comment on your notification. Shouldn't you have a DoorClosed trigger too? Otherwise when you leave the door open, and unlocked, it will notify you, right?

tfrontDoorClosed and tFr_unlocked and  (tFr_unlocked ; Now >5:00)

For Nutshell, I have 4 different scenes running my door lock right now.
1. Front Door Opens - When my door sensor trips (open) - Action Cancel my Countdown timer
2. Front Door Closes - When my door sensor untrips (closed) - Start my Countdown timer
3. Front Door manually locked - When I twist the inside lock or push the lock button outside - Cancel the Countdown timer
4. Front Door Auto Lock - When the Countdown timer expires, lock the door and notify me.

Offline Mike Yeager

  • Sr. Member
  • ****
  • Posts: 432
  • Karma: +5/-11
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #7 on: February 27, 2017, 03:34:33 pm »
If you want to be notified of it being left open, then you'd just need to set up a condition to do so. I have a condition that turns off my A/C in the event that the patio door (leading out onto the pool deck) is left open for more than 5 minutes. This allows me to not concern myself with the status of the A/C in the event that I wish to leave the door open. I will likely add some kind of notification to my garage door, but as of this moment, I haven't. For the door open notification, there's a post on notifications with repeats...

Offline kigmatzomat

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +8/-0
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #8 on: February 28, 2017, 12:21:42 am »

One comment on your notification. Shouldn't you have a DoorClosed trigger too? Otherwise when you leave the door open, and unlocked, it will notify you, right?

tfrontDoorClosed and tFr_unlocked and  (tFr_unlocked ; Now >5:00)

We don't use my front door so in my case if the door is unlocked, open or closed, for more than 5 minutes I want to know.

I have a schedule for our garage entry door that excludes our normal home times from notification.

Quote
For Nutshell, I have 4 different scenes running my door lock right now.
1. Front Door Opens - When my door sensor trips (open) - Action Cancel my Countdown timer
2. Front Door Closes - When my door sensor untrips (closed) - Start my Countdown timer
3. Front Door manually locked - When I twist the inside lock or push the lock button outside - Cancel the Countdown timer
4. Front Door Auto Lock - When the Countdown timer expires, lock the door and notify me.

I think the countdown tickers are probably overkill.  Look at my example again.

tfrontDoorClosed and tFr_unlocked and ( tFrontDoorClosed ; Now >3:00) and (tFr_unlocked ; Now >3:00)

The first two are true/false. The latter two compare the timestamps from the last time the events were true.

1. If the door is open, tFrontDoorClosed is false and the whole expression is false.
2.When door closes, it sets the tFrontDoorClosed timestamp which is evaluated by the first NOW statement, so it can't be true until 3 min after door closed.
3. When it is manually locked, tFr_unlocked becomes false and the whole expression is false.
4. Have lock scene triggered by the PLEG condition as a device property or use luup code. Include notification as needed.

Now this kind of expression isn't exact, it might take 3:01 or 3:59 to trip.  NOW() is only evaluated once a minute for all conditions, which is where the wobble comes from.But an average of 30s of drift isn't make or break issue and it keeps the load on the unit down. One precise timer isn't an issue but after you write a few dozen rules with them they add up, chewing clock cycles and slowing down other functions.
« Last Edit: February 28, 2017, 12:26:48 am by kigmatzomat »

Offline 3rdStng

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #9 on: February 28, 2017, 12:45:56 am »
Oh, don't get me wrong, PLEG is way easier to deal with. My scenes are from before I had PLEG. I tried a few weeks back to move it into PLEG with one additional item. If someone unlocked the door but never opened it, lock it back up after a period of time. My tests before didn't work as I wanted. But after seeing your condition, I think it will do what I want. And if it does, I can get rid of my last countdown timer.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 755
  • Karma: +18/-2
    • Worthington Engineering, Inc.
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #10 on: February 28, 2017, 01:29:32 pm »
I use the countdown timers to send me repeated notifications.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline dannieboiz

  • Sr. Member
  • ****
  • Posts: 381
  • Karma: +1/-2
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #11 on: March 06, 2017, 04:20:33 pm »
My Shclage lock does this natively and can be set to be disabled/enable on its own. I believe it's default to autolock @ 30 seconds. I wouldn't trust vera to autolock anything.

Offline 3rdStng

  • Jr. Member
  • **
  • Posts: 80
  • Karma: +0/-0
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #12 on: March 07, 2017, 02:44:12 pm »
My Shclage lock does this natively and can be set to be disabled/enable on its own. I believe it's default to autolock @ 30 seconds. I wouldn't trust vera to autolock anything.
Correct, as well as mine. But how does your lock know when the door is actually closed?

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 755
  • Karma: +18/-2
    • Worthington Engineering, Inc.
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #13 on: March 07, 2017, 07:42:10 pm »
A door sensor? I am not aware of a door lock with a built in door sensor.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.

Offline Mike Yeager

  • Sr. Member
  • ****
  • Posts: 432
  • Karma: +5/-11
Re: Setup scene to automatically lock door if unlocked for XX minutes
« Reply #14 on: March 08, 2017, 03:58:41 pm »
All of the locks can relock on their own, but you'll find it beats the door frame to hell when you're closing the door and the bolt extends. You need a door sensor to ensure that the door is actually closed...