Help with motion lighting

Hello, I've got a a couple of questions concerning motion lighting.

First, I would like to trigger the lights to come on when either one of 2 motion sensors becomes active, and go off (after a delay) when both are inactive. Right now I think I have this working using 2 rules, but am wondering if I could do it with just one. I tried setting both sensors as the triggering condition, but it looked like it was only triggering when both became active.

Second, I'd like the lights to come on when the front door is unlocked, and remain on for at least 5 minutes, after which time, I'd like them to stay on as long as one of 2 motion sensors is active. How would I do this?

Thanks in advance for any help.

I've never had good luck with motion lighting. I always used two rules to make sure that everything ran as expected because it felt like motion lighting just reversed triggered. I prefer to use RM. This is what I would do with your door light scenario in RM4.

Triggers:
lock changed
motion sensor 1 & 2 changed

If
lock A is unlocked
then turn on light 1
Else if
motion sensor a and b are active
then cancel delayed actions
else if
motion sensor a & b both are inactive
then turn off light 1 <- delay 5 minutes cancel=yes
end if

This will keep the light on if the sensors are active, but will also reset the 5 minute time if the motion sensors change from inactive to active within that 5 minutes.
Hope this helps?

1 Like

#1. Yes, you can do it with 1 and that would be the recommended configuration.

#2. The problem you are going to run into with this is that motion lighting won't handle them turning off if they are already on. Do you need to have them turn on if they will be turned on when the door is opened and motion goes active?

1 Like

Thanks for responses, I really appreciate it.

April, If I understand that rule, it looks like that itwouldn't turn on the lights unless the door is unlocked, is that correct? Would I then use a separate rule to turn on the lights (with a 1 minute delay), if the motion sensors activate but the door lock status doesn't change?

Ryan780, how would I go about doing it with 1 rule? I previously tried setting both sensors as triggers, but it seemed to treat it as an AND instead of an OR. I'm not sure I understand your second question. My desired behaviour is:

  1. If either Motion sensor is active, turn lights on and keep them on until 1 minute after both sensors become inactive
  2. If door is unlocked, turn lights on and keep on for at least 5 mintues. After 5 mintues, if both motion sensors are not active then turn off light. Otherwise keep the light on until 1 minute after both sensors become inactive.

You might consider using the Zone Motion Controllers built-in app to combine your two motion detectors into a single zone. Then use that zone in your rule instead of the individual motion sensors. That will help to simplify your rule.

1 Like

What my question was, if you are turning the lights on via motion, why do they also have to turn on with the door unlocking? Won't they also turn on with the motion?

If you require that the lights turn on via both triggers but always turn off via motion with separate timeouts, you would have to do this with Rule Machine and it is going to be very complicated. So, I would suggest cutting back some of your requirements. Either make the timeouts match or drop the lock as the trigger.

This gave me a different idea: create a virtual motion sensor, then use a rule to make that sensor active when the door is unlocked at inactive 5 minutes after that (or technically your timeout for your motion automation minus 5 minutes, but really whatever you want). That will keep everything do-able in Motion Lighting (which can handle multiple sensors so you don't really need to make a zone, but you can if you want to avoid dealing with this complexity elsewhere). Something like this would do literally that:

image

...but if it were me, I'd probably do something like this instead, assuming you want the countdown to start when door gets locked and not just after it's unlocked:

image

...but I guess you know your desired use case and outcome better than I do. In either case, that would, again, give you something you can use in a motion lighting app (Simple Lighting or Motion Lighting, among others), which will open up a lot of possibilities without needing to handle the entire lighting automation in Rule Machine yourself. You'll still have a bit of your automation spread out across two rules/apps (this plus, for example, Motion Lighting or another rule), but there is nothing wrong with that, and this particular rule is really just tangential to that goal if it makes you feel better. :slight_smile:

1 Like

Thanks again everyone. A lot of great advise. Definitely given me things to try out.

1 Like

So I tried going with a virtual motion sensor and it seems to trigger fine, but it looks like it's setting itself to inactive immediately despite me setting a delay. Here's the rule I'm using:

Any ideas?

Can you show the logs from the period where the rule fired? Also, turn on Rule Logging. It appears that it should be fine.

I think I figured it out. The Virtual motion sensor has a setting called 'Auto Inactive' which defaults to 15 seconds. I set it to disabled, and things appear to be working now.

Thanks again for all the help everyone.

The idea to use the unlock event to manipulate a virtual motion sensor is really very clever, and not something I would have thought of on my own.

I'm also now making use of Zone motion controllers, so I'm able to do what I want with one rule to manipulate the virtual sensor, and one motion lighting rule.

You guys rock!

3 Likes