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

That would be a feature of the lock … check the documentation for it.

The lock should have four switches. Switch 2 should enable AUTO LOCK when in the ON position and should disable AUTO LOCK when in the OFF position

@Richard, Beaton303, thanks for the tip on disabling auto-lock feature in the kwikset door… turning off the second switch disabled the autolock and the pleg logic worked perfect.

[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]

@Zwaver, the logic you posted for worked perfectly well.
I even did a mock to see if the door alert function works or not… for this, i unlocked the door, and removed the battery slot… (mimicking that the battery ran out after the door was unlocked and inbetween autolocking).
I got the alerts on the phone (which i set to, “Alert!! The Main Room door lock has not been locked yet.”
But the only thing that did not happen was… the door did not lock after i inserted the battery slot back. I was expecting the door to lock after 5 mins, or 1 min… but that did not happen… i guess i will need another condition logic here.

Note: For anyone who does not want to set an alarm or a door sensor with the door lock, this logic works perfectly fine stand alone. Although i think adding a sensor is a great way of not auto-destroying your door frame by the extended door jar.

Richard, zwaver and beaton thanks again so much for your help here. This was something i was trying for a long time… but never managed to achieve.

[quote=“Exorcist, post:23, topic:175141”]…i unlocked the door, and removed the battery slot…

The Main Room door lock has not been locked yet."
But the only thing that did not happen was… the door did not lock after i inserted the battery slot back. I was expecting the door to lock after 5 mins, or 1 min… but that did not happen… i guess i will need another condition logic here.[/quote]

Nothing happened because your AutoLock condition has already passed. An event needs to happen to reinitialize the logic process so that the AutoLock condition is no longer past. For instance, install the battery and actuate the Kwickset, then it begins again. Everything starts happening on the UnLocked trigger and your actions happen only once. To make it keep checking you would need to do something like below where it will try to lock every 5 minutes until it locks successfully:

Triggers
UnLocked Kwikset Door Lock is opened
Locked Kwikset Door Lock is closed

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

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

This is Richard’s work, I’m just repeating his previous advice.

[quote=“Z-Waver, post:24, topic:175141”][quote=“Exorcist, post:23, topic:175141”]…i unlocked the door, and removed the battery slot…

The Main Room door lock has not been locked yet."
But the only thing that did not happen was… the door did not lock after i inserted the battery slot back. I was expecting the door to lock after 5 mins, or 1 min… but that did not happen… i guess i will need another condition logic here.[/quote]

Nothing happened because your AutoLock condition has already passed. An event needs to happen to reinitialize the logic process so that the AutoLock condition is no longer past. For instance, install the battery and actuate the Kwickset, then it begins again. Everything starts happening on the UnLocked trigger and your actions happen only once. To make it keep checking you would need to do something like below where it will try to lock every 5 minutes until it locks successfully:

Triggers
UnLocked Kwikset Door Lock is opened
Locked Kwikset Door Lock is closed

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

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

This is Richard’s work, I’m just repeating his previous advice.[/quote]

Zwaver, thanks again, i tried this today morning and it worked like a charm.
A big thanks to Richard for PLEG… i am slowly getting to understand the logic now… and tried my very own version for few dimmers and switches and they worked as expected.

Any way to auto lock ALL doors with a variable? instead of writing code for each lock? I have 5 locks that I want this to work on. if ANY lock is open for 15 minutes… lock it.

Thoughts?

Condition:

AnyLockOpen (Lock1 or Lock2 or Lock3 or Lock4 or Lock5)
AutoClose AnyLockOpen and (AnyLockOpen; Now > 5:00)

Make sure you set the “Repeat” on the AnyLockOpen condition.
Then it will close 5 minutes after the most recent one was opened.

Done. now need to watch to see if it works :wink: