Door Lock Example - First Time User

First time smart home hobbyist here trying to understand the rule machine. This is my first rule ever.. so be patient.

My objective is:
Trigger: When the door is unlocked or if the door sensor is open

A. If the door is unlock and the door sensor is closed > lock the front door in 5 mins
B. If the door is locked and the door sensor is closed > do not do anything.

With the current setting, if I were to unlock the door, open it, check the mail then close it and lock it, the rule will still try to lock it and not exit.

Can you show me how to properly execute my objective?


door lock changed
door sensor changed

If front door is locked and
sensor is closed
then cancel delayed actions
if door unlocked
sensor closed
lock door
delayed 5 minutes - toggle cancelable to yes

There are other ways to set this up. You'll want to try to keep your rules as simple as possible for processing purposes. For this case, I don't think that the state will be changing so much that it would cause issue.

I'm not home to search it out, but you should refer to the hubitat live episode on youtube for the KISS method. It's got some good examples on it on how to keep your rules simple and your processing at the top of game.

Thank you.

It looks like we have a similar code, just in different orders for me. not sure why i can't post images but..

front door unlock
door sensor open

wait for event: door sensor closed
If (front door unlock) and (door sensor cosed)
delay 5 mins and lock front door

door sensor closed and front door locked
cancel delayed actions
exit rule.

Thank's i'll give your rule a shot! Will watch that episode as welll.

1 Like