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?

94A8021C-11AD-4C3B-83DC-88B3C4876992|690x276

triggers
door lock changed
or
door sensor changed

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

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

Current:
Trigger
front door unlock
or
door sensor open

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

else-if
door sensor closed and front door locked
then
cancel delayed actions
exit rule.

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

1 Like