Using PLEG to control your front door lock - Program Logic Event Generator

I just wanted to share with everyone what I have done with the PLEG plugin that I thought was pretty cool.

I have a motorized Kwikset deadbolt on my front door, I also have linked into my home security system which will let me know when the front door is open or not. So the logic below will automatically closed the front door 15 minutes after the last time the door was opened (FrontDoorOpened)or the last time it was unlocked (FrontDoorUnlocked), whichever is later. But it will not lock the front door if it is currently open (FrontDoorState), or if I have set the virtual switch which set a variable (FrontDoorVariable) to either enable or disable the automatic closing of the front door. I also have another virtual switch which is similar to the variable which is just a bypass to disable auto closing of any door including the garage door. This is typically used for when babysitters or other family are at the house and we are not.

This is what I have put within within the conditions field to make this happen:
((FrontDoorUnlocked AND (FrontDoorUnlocked; NOW > 15:00) AND (FrontDoorOpened; NOW > 15:00)) AND (FrontDoorState == 0) AND (FrontDoorVariable eq “Enable”)) AND (AtHomeBypass == 0)

Thought I would share this seeing that learning from examples is usually the easiest way to learn.

Thanks for sharing!

Sounds awesome. Thanks for sharing!

We’re doing something similar at our house except the timer is set to lock immediately after the alarm sensor detects the door is closed. Great way to make sure you’re not bashing your extended deadbolt into your door frame!

Just to confirm, if you close the door after 15 mins of being open, the door will lock immediately?
I tried something similar, but had a condition that the door was closed for at least 1 min.

From how I understand the PLEG logic, it basically analysis the events every 1 minute, so at the 1 minute mark if the front door is still unlocked, and the unlock event is more than 15 minutes old, and the door open event is also more than 15 minutes old then the logic will close the door. Every time you open the door it should create an event\trigger and PLEG will wait 15 minutes after the latest of the two said events, before triggering.

Does that make sense?

I would have modified this as follows:

  1. If the door remains open for 15 minutes Notify me (VeraAlerts, Prowl …) that I left the door open.
  2. I would AutoLock 15 minutes after the door is Closed
Just to confirm, if you close the door after 15 mins of being open, the door will lock immediately?
With the specified logic the answer is YES. If you left the door open for 30 minutes. As soon as it closed it would lock.

whoamib, how did you link your front door lock with your alarm system?

Thanks
Jim

[quote=“jbfoster, post:7, topic:175141”]whoamib, how did you link your front door lock with your alarm system?

Thanks
Jim[/quote]
Perhaps the lock is z-wave tied to Vera which is connected to the alarm panel thru something like Envisalink. That is the exact set up I have and how I auto-lock doors when I arm my system and auto unlock doors when I disarm my system.

Hi, I’'m trying to do a similar thing like you, but hope you can help me, how you get the status of doorunlocked, dooropened, doorstate? I also have a Kwikset deadbolt and a door sensor.

thanks

[quote=“luisvieyra, post:9, topic:175141”]Hi, I’'m trying to do a similar thing like you, but hope you can help me, how you get the status of doorunlocked, dooropened, doorstate? I also have a Kwikset deadbolt and a door sensor.

thanks[/quote]

I have been beating my head on the wall for days now, and not able to make it work.
Most of the people here on the forum have sensors or alarm panels in sync with their door locks… and program the logic along with it.
However i just wanted a plain simple logic of the kwikset door locking after 5 mins… which does not seem to work.
I tried this simple logic… still no luck

DoorOpen Kwikset Door Lock is opened
DoorClosed Kwikset Door Lock is closed

Then you can have the following conditions:
AutoLock DoorClosed;NOW > 5:00
DoorAlert DoorOpen and (DoorOpen;NOW > 6:00)

Actions
AutoLock Lock Kwikset Door Lock
DoorAlert Setup alert in vera alerts.

But no luck.

Logic looks good … did you arm the PLEG ?

Did you arm the PLEG, plugin? I made that mistake before. Also you can use the status and report buttons on the first page of the PLEG plugin.

Sent from my SPH-L710 using Tapatalk 4

[quote=“Exorcist, post:10, topic:175141”]I have been beating my head on the wall for days now, and not able to make it work.
Most of the people here on the forum have sensors or alarm panels in sync with their door locks… and program the logic along with it.
However i just wanted a plain simple logic of the kwikset door locking after 5 mins… which does not seem to work.
I tried this simple logic… still no luck

DoorOpen Kwikset Door Lock is opened
DoorClosed Kwikset Door Lock is closed

Then you can have the following conditions:
AutoLock DoorClosed;NOW > 5:00
DoorAlert DoorOpen and (DoorOpen;NOW > 6:00)

Actions
AutoLock Lock Kwikset Door Lock
DoorAlert Setup alert in vera alerts.

But no luck.[/quote]
Do I understand you correctly that you do NOT have a door sensor? Without a sensor you cannot determine if the door is open or closed and you can’t make it work.

I believe that there is confusion due to your choice of trigger names. Rename your triggers DoorOpen and DoorClosed to Locked and Unlocked. Then you will note that your logic lacks any indication of the door’s state. You’ll need a door sensor to determine if the door is open or closed.

If you simple want the unlocked door to unconditionally lock after 5 minutes, then (using the above mentioned condition names):
AutoLock Unlocked;NOW > 5:00
DoorAlert Unlocked and (Unlocked;NOW > 6:00)

Note that this logic, will cause the dead bolt to lock even if the door is ajar, it really should have a door sensor.
Note also, the alert should never fire because the door should never be unlocked for more than 5 minutes.

[quote=“Z-Waver, post:13, topic:175141”][quote=“Exorcist, post:10, topic:175141”]I have been beating my head on the wall for days now, and not able to make it work.
Most of the people here on the forum have sensors or alarm panels in sync with their door locks… and program the logic along with it.
However i just wanted a plain simple logic of the kwikset door locking after 5 mins… which does not seem to work.
I tried this simple logic… still no luck

DoorOpen Kwikset Door Lock is opened
DoorClosed Kwikset Door Lock is closed

Then you can have the following conditions:
AutoLock DoorClosed;NOW > 5:00
DoorAlert DoorOpen and (DoorOpen;NOW > 6:00)

Actions
AutoLock Lock Kwikset Door Lock
DoorAlert Setup alert in vera alerts.

But no luck.[/quote]
Do I understand you correctly that you do NOT have a door sensor? Without a sensor you cannot determine if the door is open or closed and you can’t make it work.

I believe that there is confusion due to your choice of trigger names. Rename your triggers DoorOpen and DoorClosed to Locked and Unlocked. Then you will note that your logic lacks any indication of the door’s state. You’ll need a door sensor to determine if the door is open or closed.

If you simple want the unlocked door to unconditionally lock after 5 minutes, then (using the above mentioned condition names):
AutoLock Unlocked;NOW > 5:00
DoorAlert Unlocked and (Unlocked;NOW > 6:00)

Note that this logic, will cause the dead bolt to lock even if the door is ajar, it really should have a door sensor.
Note also, the alert should never fire because the door should never be unlocked for more than 5 minutes.[/quote]

@Richard, yes the PLEG is armed… i have another garage door logic on this, and works perfect.
But for the kwikset door logic its not… (yes i have made sure the trigger names and conditions are not conflicting with the garage doors logic).

Zwaver, That is correct… i dont have a door sensor. Never thought it was important… as the door pulls to close itself. The only thing that bothered me was the auto lock of 30 seconds by kwikset locks which gets annoying sometimes. Hence i wanted to see if we I can have the door autolock after 5 mins.
So to make this work… i will need a door sensor as well?

You can do what you like. As I stated, I think your trigger names are causing confusion and should be renamed.

To do what you say you wish to accomplish I would:
triggers
UnLocked Kwikset Door Lock is opened
Locked Kwikset Door Lock is closed

[Conditions
AutoLock UnLocked AND (UnLocked;NOW > 5:00)
DoorAlert UnLocked AND (UnLocked;NOW > 6:00)

Actions
AutoLock Lock Kwikset Door Lock
DoorAlert Setup alert in vera alerts.

The logic you originally posted said the equivalent of
AutoLock Locked;NOW > 5:00
Which is not what you wanted.

@Exorcist
The way you named the events I thought you had a separate door sensor.
In that case when the DOOR sensor detected it was closed … it should automatically lock the door …
in which case your original logic would have been correct.

But since you do not have a door sensor … you want to automatically lock the door after it is UNLOCKED for 5 minutes. (As opposed to the 30 sec option that the lock has).

In that case you need to to change your:
AutoLock DoorOpen;NOW > 5:00

As Z-Waver indicated your DoorOpen is really a Lock Unlocked
Also in this case the only way to get an alert … is if the AutoLock action failed.

[quote=“Z-Waver, post:15, topic:175141”]You can do what you like. As I stated, I think your trigger names are causing confusion and should be renamed.

To do what you say you wish to accomplish I would:
triggers
UnLocked Kwikset Door Lock is opened
Locked Kwikset Door Lock is closed

[Conditions
AutoLock UnLocked AND (UnLocked;NOW > 5:00)
DoorAlert UnLocked AND (UnLocked;NOW > 6:00)

Actions
AutoLock Lock Kwikset Door Lock
DoorAlert Setup alert in vera alerts.

The logic you originally posted said the equivalent of
AutoLock Locked;NOW > 5:00
Which is not what you wanted.[/quote]

Thanks for your prompt reply zwaver… you have always been of immense help.
I tried the logic you posted… but it did’nt work. Attaching the status from my PLEG.

Looks like you still have the AUTO Lock on.
It shows that it was locked 53 seconds after it was unlocked.

So the Actions did not need to fire.

[quote=“RichardTSchaefer, post:18, topic:175141”]Looks like you still have the AUTO Lock on.
It shows that it was locked 53 seconds after it was unlocked.

So the Actions did not need to fire.[/quote]
Man! You’ve got a good eye.

[quote=“RichardTSchaefer, post:18, topic:175141”]Looks like you still have the AUTO Lock on.
It shows that it was locked 53 seconds after it was unlocked.

So the Actions did not need to fire.[/quote]

Richard, thanks for your feedback… but how do i disable the auto lock on thing? Is it a feature in the kwikset log settings? Or do i change something in the logic…
In your previous post you posted to change the logic to…
AutoLock DoorOpen;NOW > 5:00

After changing this, it still locks after 53 seconds.
Posting the new pleg report.

Dont want to annoy anyone in here, but this is really driving me nuts… now its just a matter of my sanity… :-\