How to Turn Off Lights After Second Motion Detector Active

I want to write a rule such that:

If MD1 is active, turn on basement lights. Turn off basement lights 5 minutes after MD 2 is active and only if MD1 was active first.

I'm not sure how to approach this in RM. Is there a way to get at time stamps?

You could try the following, may require some tweaks depending on your motion sensor placement and which ones go active independently of each other, but it's a starting point.

I'm listing them backwards to aid in setting restrictions.

Trigger 1
Trigger: Motion 2 inactive
Actions: Delay 5 minutes, turn off light, Set Private Boolean False (This Rule)
Restrictions: Enable/Disable with Private Boolean

Trigger 2
Trigger: Motion 2 active
Actions: Cancel actions of Trigger 1

Trigger 3
Trigger: Motion 1 active
Actions: Turn on lights, set Private Boolean True (Trigger 1)

1 Like

Thanks! I haven't worked with Private Booleans before. Are all three triggers in the same triggered rule?

No, it would be 3 separate rules, each one is a Trigger type.

1 Like

Here's an alternative method using two rules...one Rule type, and one Trigger type. I think this would accomplish the same thing as my first post with one less rule to set up. I always hesitate when combining restrictions with Rule type rules, takes me some time to think through it to see if it would cause problems.

Rule 1
Condition/Rule: Motion 2 active
Actions when True: (none - leave blank)
Actions when False: Delay 5 minutes (cancel on truth change), turn off light, Set Private Boolean False (This Rule)
Restrictions: Enable/Disable with Private Boolean

Trigger 1
Trigger: Motion 1 active
Actions: Turn on lights, set Private Boolean True (Rule 1)

Have a look at the zone motion controllers app, set up a triggered activation zone, use md1 as the trigger, then put md1 and md2 in the zone.

2 Likes

I will definitely check it out.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.