Auto Lock Door after X Time

Hi I am looking for option to Lock my door after X time I close the door.

I don't have a lock so I'm only guessing here but have you tried Rule machine?

1 Like

Do you have a contact sensor on the door?
If so, something like
TRIGGER.
Door Contact sensor closes.

ACTION.
Delay 5 minutes
Lock door.

1 Like

Like @bobbles said, you have to have a contact sensor or something to say the door is closed to react to the door closing. If you want the door to relock after being unlocked, you can use the trigger of the door being unlocked as the trigger to re-lock it. However, it will then re-lock even if it is open , meaning you would have to unlock it, in order to get it to close (if it's a deadbolt). I'd suggest getting a contact sensor and using that as the trigger though. Less problematic.

3 Likes

Exactly, here's what my rule looks like with a contact sensor

image

3 Likes

Okay, so it would lock 5 minutes after the door closes. Is that really what you want? Is this not working for you?

The condition of the Lock itself is technically redundant.

If the Lock is locked and you send a lock command, it would hurt nothing.

You can reduce the Rule to the Trigger that @bobbles suggested, if you wish. Usually, when you see a Rule with no False Action, a trigger is something to consider.

1 Like

The only reason you might want to leave it as a rule with a delay plus cancel on truth change is in case someone closes the door then re-opens it. But I don't know how fast your lock responds to the lock command. If it is instant basically and you just want it to lock immediately, then go with the trigger. However, if you want it after X minutes, you can't cancel those actions based on truth change in a trigger. So, a triggered action will happen regardless of the condition is still true, because it does it based solely on the trigger.
So, if you used a trigger, i would remove the delay, otherwise you're going to run into the same problem. You could also do a triggered rule if you want a delay but to me that is just redundant.

1 Like

The rule is working as I want, I posted it as an example for OP

5 minute delay so, when I go outside to yell "Get off my lawn!" it doesn't lock on me, J/K with three kids there is a lot of out and back in type action, the delay is timed for WAF. Cancel on truth so that if someone opens it, then closes it and then opens it again before 5 minutes and leaves it open the dead bolt wont come out. Before adding cancel on truth daughter slammed the door with the dead bolt out.

1 Like

I agree. If you're going to have a delay you want to be able to cancel on truth change. But triggers don't allow for that, only rules and triggered rules. So, OP if you're going to follow @csteele's suggestion, i'd remove the dealy.

1 Like

Thank you guys I use the @drew RM for now. But I believe the Hubitat Team cam improve the Lock Manager.

This has nothing to do with Lock Manager. Lock manager just manages the lock codes. Everyone has different needs for lock configuration and rules to control them. The lock capabilities within RM are quite robust overall.

1 Like

I do have a question for rule automation. Here is my current rule that is duplicated for other doors too:

I would like to add in some type of monitor to see if the lock truly locked. Sometimes ppl close the door enough to close the sensor but not enough to allow the lock to actually engage and lock. So I would like to setup a rule/automation/addition to my current rule to check for this and after X amount of attempts to re-lock door then notify through pushover an issue. Thoughts on this or does this need to be an app?

If it tries and fails to lock, does it initially change to locked state and then back to unlocked?

If yours does, you could use a rule to increment a virtual dimmer. Rule: Lock is unlocked and Door is closed, When True adjust virtual dimmer +1, when false set virtual dimmer to 0. Then another rule when virtual dimmer >= 5 send notification.

If not, you'll have to figure out if the lock state changes even give you enough info to do anything with. You have to know somehow that the lock tried and failed. Maybe a time delay between calling the lock command and running another rule with a condition of Lock locked or something.

@bravenel

Any thoughts to supporting global variables that can be modified within RM? I see a lot of benefit to using this verses all of these virtual switches. Thoughts?

SOLVED

Please see my rule below, I have door Sensor "Garage Door" but the rule ignore this device, I made a test, unlock and open the door, status of "Garage Door" show "open" keep door open and after one minute the locker works.

I Fixed, I Select "Cancel on truth change?"

image

I made tests today and I hope still working.

Hello @emersonvier. I added your rule because this is what I want to do. I've tested it and it works. What is the "Cancel on truth change?" option do?

I also have mine setup to when the door is unlocked by a user code, it will disarm the alarm. This also works, but I'm trying to figure out one more thing.

We get a lot of packages from UPS. They have there own door code. When UPS used the code it will disarm the system as it would with anyone else. What I'm trying to figure out is how can I put the system back in armed mode only after UPS unlocks

1 Like

Easy, write a rule that triggers off the UPS Code for your lock. This rule will turn the private boolean true for another rule. This second rule will be a trigger based on the lock locking or the door closing, which will both arm HSM and turn it's own Private Boolean false. If you want to add some safety you could delay both actions for 5 seconds or so.

1 Like

@Ryan780. WOW that's sounds like what I want but really have no idea where to start on this trigger. I'm not up on the Boolean stuff.

I had this setup in ST but can't figure out how to do it in HE.

1 Like

Pretty much self explanatory, if the (true) conditions change before the delayed time is reached (Ex: 30 seconds), then the action is cancelled. However, once the conditions become true again the delayed timer starts over.

Example: If you want a door to lock after 3 minutes of closing, and you re-open the door at 2 minutes, the door will no longer lock in 1 more minute, but will lock 3 minutes after the door closes again

2 Likes