Auto Lock Door

I have found several different topics about auto locking a deadbolt. I have tried a few things I found and could not get them to work correctly. I would like to setup a scene that runs when the door is unlocked and has a command to lock the door after 10 minute.

Luup code:

Code: [Select]
local from_hour = 24
local to_hour = 0

local now = os.date (“*t”)

if ((now.hour >= to_hour) and (now.hour < from_hour)) then
return false
end

return true

Any help would be appreciated. thanks,

A couple of comments:

  1. I assume you put this LUA code in the trigger LUUP or scene LUUP section.
    If I ignore your “Any help would be appreciated. thanks,” in the middle of
    the code than this is setup to STOP the scene from executing.
    At any time during the day the hour is >= 0 and less <24
    Why is this code here ? … Do you only want to execute the scene during certain times during the day ?

  2. I assume you have a delayed command in your scene, for waiting 10 minutes before sending the lock command. Did you know that if Vera restarts between the time the scene starts and the 10 minute delay happens that the door will NOT get locked! That is why there are plugins like the Program Logic Event Generator, Program Logic Timer Switch, and Countdown Timer. These all handle timing events that survive a Vera restart.

[quote=“RichardTSchaefer, post:2, topic:174568”]A couple of comments:

  1. I assume you put this LUA code in the trigger LUUP or scene LUUP section.
    If I ignore your “Any help would be appreciated. thanks,” in the middle of
    the code than this is setup to STOP the scene from executing.
    At any time during the day the hour is >= 0 and less <24
    Why is this code here ? … Do you only want to execute the scene during certain times during the day ?

  2. I assume you have a delayed command in your scene, for waiting 10 minutes before sending the lock command. Did you know that if Vera restarts between the time the scene starts and the 10 minute delay happens that the door will NOT get locked! That is why there are plugins like the Program Logic Event Generator, Program Logic Timer Switch, and Countdown Timer. These all handle timing events that survive a Vera restart.[/quote]

Yes, this was a mistake when i posted “ignore your Any help would be appreciated” thanks,

What i would like to accomplish is to automatically lock the door after it has been unlocked for 10 minutes. I would like this to run 24/7.

What would you recommend?

Do you need code for this? Why not just create a scene with entering a pin code as the trigger and then lock it again after a 10 minute delay?

The thought was if someone else inside the house (KIDS)left and didn’t lock the door it would auto lock itself in 10mins.

Sorry, I’m not following you. How would Vera know that the kids left? If you could get Vera to know this then you could just create a scene to lock the door when they leave.

EDIT:

OK. I think I get it. You want it to operate on the lock status as opposed to entering a PIN because kids might be unlocking the door from the inside when they leave and then not relocking it?

Would “a lock button is pressed” work for this as a trigger?

[quote=“S-F, post:6, topic:174568”]Sorry, I’m not following you. How would Vera know that the kids left? If you could get Vera to know this then you could just create a scene to lock the door when they leave.

EDIT:

OK. I think I get it. You want it to operate on the lock status as opposed to entering a PIN because kids might be unlocking the door from the inside when they leave and then not relocking it?

Would “a lock button is pressed” work for this as a trigger?[/quote]

Correct. They unlock the door from inside the house and walk over to a friends house forgetting to lock the door when they leave.

What brand of lock is it?

New Schlage motoroized deadbolt.

With the latest beta software I understand that this lock provides accurate status of locked/unlocked only about 75% of the time. Often it thinks it’s locked when it’s NOT.

I would recommend using an addition magnetic door open/close sensor and use that.
Every time you get a close event … send a lock command in 10 minutes.
And maybe another one in 15 minutes for good measure!

I have the Schlage Door Lock (Lever Arm, not motorized). It works great. I was surprised by the number of problems people have reported with the motorized deadbolt. At the time I opted to NOT use a motorized lock … I felt that the battery would wear down much faster.

r.t.s.

[quote=“RichardTSchaefer, post:10, topic:174568”]With the latest beta software I understand that this lock provides accurate status of locked/unlocked only about 75% of the time. Often it thinks it’s locked when it’s NOT.

I would recommend using an addition magnetic door open/close sensor and use that.
Every time you get a close event … send a lock command in 10 minutes.
And maybe another one in 15 minutes for good measure!

I have the Schlage Door Lock (Lever Arm, not motorized). It works great. I was surprised by the number of problems people have reported with the motorized deadbolt. At the time I opted to NOT use a motorized lock … I felt that the battery would wear down much faster.

r.t.s.[/quote]

Yes, I am aware of the issues with the lock thank you. I have been very active in the testing of the device on the forum. When I installed 1.5.532 firmware it fixed a couple issues with the lock and when I installed 1.5.621 it fixed the majority of the other issues. So far the lock is working much better more like the manual schlage deadbolt I have. I would still like to know what the easiest way to program it to auto lock would be. Again I am just looking for it to autolock 24/7 after 10min when it sees the lock as being unlocked. Thanks,

Did the suggestion in my previous reply work?

Easiest:
Create a Scene … call it autolock
Create a trigger for the scene when the Schlage lock indicates it is unlocked.
Create a delayed schedule for the Scene for 10 minutes later.
Add a lock command for the delayed schedule to the scene.
[hr]
As I mentioned earlier … this is NOT reliable … if Vera reboots between Trigger and the 10 minute delay happens … it will NOT lock your door. If that’s acceptable with you … you are done.
[hr]
Otherwise use one of the Plugins I mentioned earlier.
With Program Logic Event Generator
Add input Trigger, call it DoorUnlocked when the Schlage reports the door unlocked.

Create a condition called LockDoor with a value of:
(DoorUnlocked; NOW > 10:00)

Create an action for the condition DoorUnlocked
Add the device command for locking the door.

I did not try your suggetion becuase I need something that will lock the door when it is unlocked from inside the house and not by using a pin code. thanks,

[quote=“RichardTSchaefer, post:13, topic:174568”]Easiest:
Create a Scene … call it autolock
Create a trigger for the scene when the Schlage lock indicates it is unlocked.
Create a delayed schedule for the Scene for 10 minutes later.
Add a lock command for the delayed schedule to the scene.
[hr]
As I mentioned earlier … this is NOT reliable … if Vera reboots between Trigger and the 10 minute delay happens … it will NOT lock your door. If that’s acceptable with you … you are done.
[hr]
Otherwise use one of the Plugins I mentioned earlier.
With Program Logic Event Generator
Add input Trigger, call it DoorUnlocked when the Schlage reports the door unlocked.

Create a condition called LockDoor with a value of:
(DoorUnlocked; NOW > 10:00)

Create an action for the condition DoorUnlocked
Add the device command for locking the door.[/quote]

Ok, I will try the PLEG. Do I also need to install the Progrma Logic Core?

Yes Program Logic Core contains the shared functionality used by Program Logic Event Generator and Program Logic Timer switch.

Ok, I have installed and configured but, for some reason it is not working. Everything looks right but, in the picture with the actions nothing shows configured. I have choosen the action twice but it does not show. Should the configured action be displayed?

[quote=“RichardTSchaefer, post:13, topic:174568”]Easiest:
Create a Scene … call it autolock
Create a trigger for the scene when the Schlage lock indicates it is unlocked.
Create a delayed schedule for the Scene for 10 minutes later.
Add a lock command for the delayed schedule to the scene.
[hr]
As I mentioned earlier … this is NOT reliable … if Vera reboots between Trigger and the 10 minute delay happens … it will NOT lock your door. If that’s acceptable with you … you are done.
[hr]
Otherwise use one of the Plugins I mentioned earlier.
With Program Logic Event Generator
Add input Trigger, call it DoorUnlocked when the Schlage reports the door unlocked.

Create a condition called LockDoor with a value of:
(DoorUnlocked; NOW > 10:00)

Create an action for the condition DoorUnlocked
Add the device command for locking the door.[/quote]

I found what I was doing wrong once you configure the “actions” I did not see the normal “Save” on the upper right. Once I clicked on Finish on the top bar then I was able to click “Save”. I have tested it several times and works great! This is a very handy tool. Thanks for taking the time to help a novice understand how to use it.

Thanks again as stated “Pleg” is working perfectly. I have not been able to configure email notifications. I was trying to configure a notification once the door was told to lock automatically as part of the notifications “A condition is satisfied with a specified status” and “A condition is satisfied” could you tell me what i am doing wrong?

On PLEG … you can create a Notification:
A condition is satisfied
Than specify one of your conditions.
Then specify your recipient.
This is the same as any other notification.
[hr]
The second notification option:
A condition is satisfied with specified status will not be available until the next Public Vera Release.