Need help with simple light rule

Why doesnā€™t this work?
I want the light to come on with the contact open or motion, then off after 2 minutes if the contact is closed and thereā€™s no motion.

It never turns off.

Change your triggers to 'changed' instead of open and active. It's not triggering the rule on inactive or closed.

2 Likes

It doesn't work because your Trigger only checks for the contact being open or motion being active.

Change the trigger to:

Family Door Contact *changed*
OR
Garage Motion Sensor *active*
2 Likes

You'll also want a "Cancel Delayed Actions" somewhere between your IF and ELSE and set the "Cancel?" flag on your delayed action (between the ELSE and END-IF). That way, when motion starts again or the contact sensor reopens, your previously scheduled delayed "off" will be canceled (otherwise they'll all pile up and run).

PS - you could also save some clicking in the future. Your ELSE-IF here is equivalent to what ELSE would be, and then you wouldn't have to specify conditions (the opposite of either active or open is both inactive and closed, what a plain ELSE would get here--anything not caught by a previous IF or ELSE-IF).

Also be aware that with motion sensors the inactive state occurs after the sensor times out. Motion sensor time outs vary by manufacturer and model. Many motion sensors remain "active" for a while (some a minute or more) after the motion stops. This time would be added to any delay you build into your rules.

2 Likes

Thanks JNS and aaiyar, itā€™s working now!

@bertabcd1234 do you happen to have an example I can copy?

Good call out @Eric.C.Miller

1 Like

Funny you should ask. I actually do. :slight_smile:

3 Likes

:+1::+1:

Thank you!

2 Likes