Routine for Auto Lock

I have a routine for the door lock to lock aft tit has been closed for 10 minutes. I am seeing sometime the door is auto locking when the door is open and contact sensor is open… This worked great in the RBOY LUM but they haven’t updated to Edge…

You have the time delay in the wrong place. It should be one the IF side for the door sensor and/or lock.


The way this Routine is written, you have two triggers that must both be met in order for this Routine to work. The door must unlock and the the contact sensor must close. What I think you want is:

If the Lock is unlocked (pre-condition)
Contact is closed
Lock door after 10 mins

With a pre-condition, it now reads “If the door contact sensor closes and the lock is in the state ‘unlocked’ then lock the lock after 10 mins”.

1 Like

I’d not used pre-condition before, do you think it would work better if the Contact sensor “Closed” is for 10 minutes as the pre-condition.

Something like this:

Door Lock contact sensor is “Closed” for 10 minutes and the Door Lock is “Unlocked”
Lock Door.

That makes sense.

The Routine is executed, by which I mean it looks to see if it needs to do anything and either does or doesn’t do it, whenever someone locks or unlocks the door, or when someone opens and closes it. So that is four possible events

The conditions will evaluate as true if the lock is in an unlocked state after an event happens, and if the door is in a closed state after the event happens. If both are true the action is carried out.

That sounds reasonable to me but it isn’t my door.

The action is to start a ten minute timer and lock the door when it expires. Your problem seems to be that it is carried out regardless of subsequent events.

You could follow the suggestion from @h0ckeysk8er and have the timer only start when someone shuts the door. There may be a question mark over whether you get a new timer start if the door is opened and closed again. You never used to but I believe the behaviour has changed. However regardless of that, what if you unlock the door but never open it? Wouldn’t you want it automatically locked?

What you may want to do, as @Automated_House suggests, is move the timer to the ‘if’ side so the conditions only evaluate as true after a time period, and then you lock the door immediately. So the conditions become the lock remaining unlocked for ten minutes and the door remaining closed for ten minutes.

1 Like

The key to all of this is remembering that pre-conditions are state checks and triggers are events. So, as originally written, it was looking for two events because of the AND and no pre-conditions. So, a Routine like:

If Contact Sensor is Closed for 10 minutes (pre-condition)
Lock unlocked
Lock lock

means something completely different than:

If Lock unlocked (pre-condition)
Contact Sensor is Closed for 10 minutes
Lock lock

Using the second example is how I think you would move the time check to the If part of your Routine. So, Event is “Contact Sensor is Closed for 10 minutes” and the State Check is “Is the Lock unlocked”.

To handle the use case of “lock gets unlocked but door never opens”, you will need a separate Routine because you need a different trigger and pre-condition.

If Contact Sensor is closed (pre-condition)
Lock is unlocked for 10 mins
Lock lock

This! It is exactly how mine is written. Change Front Door State to a Precondition and it will work.