Motion Lighting - what am I doing wrong

I have several old RM rules that I'm just now getting around to moving to Motion Lighting. The first one I set up, i figured should be really easy (the RM rule isn't too complicated) but it's not working like it should.

Setup (screenshot below): If the motion detector in the garage is activated or if either garage door is opened or if the door into the house from the garage is opened, turn the garage lights on. After 10 minutes of inactivity, turn them off (set to 1 min for testing).

Problem: On works just fine, but the lights never get turned off.

I assume I'm doing something wrong...

I think you need to add the contacts to the Off section as well.

While the sensors are active, the lights in your Motion Lighting app will not turn off. For example, I have some Monoprice motion sensors that stay active for minutes after the motion stops. So it will take the couple of minutes for the motion sensor to become inactive and the delay that you have configured before the light turns off.

For troubleshooting things like this, I watch the control panel on a tablet or phone to see what the sensors are doing.

@jon1 - I've tried with and without them in the off section. Doesn't seem to change anything.

@billmeek - My testing is actually triggering with opening the door from the house to the garage. It's slightly out of sight of the motion sensor, so I'm not tripping the motion at all.

Show the logs from the app. They should explain what it's doing. And, if you want the lights to turn off after the door is closed, you do need the contacts in the Off options.

Ok, some logs below. What I'm getting from this is the actual delay only appears to kick in when motion goes inactive. If motion isn't part of the chain of events at all, it doesn't seem to even enable the "delay" (but did eventually turn off 7 minutes later).

First logs: rule active, but motion sensor never tripped (it's on the far side of an oversized 3-car garage)

Second logs: rule active by door contact, but then motion gets involved as I'm rummaging around in the garage. Delay pops up immediately when motion goes inactive.

OK, that's expected behavior. This is Motion Lighting, not Motion and Contact Lighting. Having the contact sensor turn on the lights is like having a switch turn them on -- it is not the main actor. To do what you want you will need to use Rule Machine.

I solved this using this virtual motion sensor switch.

Then you make a RM to control it from the contacts.

image

Then just include your new virtual motion sensor in ML as if it was a real motion sensor. Then you get the delay after virtual motion (ie the contact) is fired.

1 Like

You would also need to add a else though wouldn't you?

Contacts change

If (any open) then
Active
Else
Inactive
End if

Actually I used the 5 sec auto-off function of the virtual motion switch.

Here's the rule I wrote, working exactly as intended.

Are you sure that's what you really want the rule to do? You're turning the lights off ten minutes after either door opens or motion becomes active, even if the door is still open or motion stays active (it may appear to be working as intended in this case because lots of motion sensors have short timeouts and will send "inactive" followed by "active" events long before the 10-minute timeout in your rule expires). I'm not sure what you want to do with the doors--wait until they close or keep it as-is with a delay of 10 minutes after opening regardless of what happens after--but with motion, you almost certainly want to make it a 10-minute delay after motion stops, not starts.

(As an aside, I'd use "Cancel Delayed actions" rather than "Cancel Timed Actions." The Cancel Timed Actions action does a lot more than just cancel delays and might get you into trouble if you ever use repeats, periodic triggers, or other things you didn't intended to cancel. And it actually cancels all delays, so if you do want to keep using "Cancel Timed Actions" for some reason, you don't need to bother with the "cancelable" flag. This is not a typical usage.)

I could suggest a re-write, but it would be a bit different depending on how you wan the doors to work, so I'll hold off to see which way you want it if you're interested. :slight_smile:

Appreciate the feedback! As for the "Cancelled Delayed Actions", I'll switch it.

As for the doors, that's handled in 2 different rules. The garage doors I only monitor in Away mode and after dark. The garage entry door alerts if left open for a certain amount of time.

The lights are more a matter of convenience. If the garage is entered (one of the doors opening) I want them on while someone is present (motion active) and off otherwise, doors open or not. So now you have me wondering if continuous motion will NOT reset the rule (never a new motion event).

I'm not sure what you mean with "reset the rule." Any trigger will cause your rule actions to run again, but anything that was previously run (or scheduled to run in the future, "wait" events being one exception) will still happen. This is why you need to cancel delays--a new instance of the rule being spun up won't stop anything that's already happening.

If your concern is keeping lights on in the garage when you are there, then you may not need the doors in the rule at all. I assume the motion sensor would see you. But if they don't or you want the lights on sooner and want the doors to have to be closed before the lights turn off, something like this might work:

Triggers: Garage Entry Door open OR Garage Door 1 open OR Garage Door 2 open OR Garage Motion *changed*

Actions:

IF (Garage Motion active OR Garage Entry Door, Garage Door 1, Garage Door 2 any open) THEN
  On: Garage Lights
  Cancel Delayed Actions
ELSE
  Delay: 0:10:00 (cancelable)
  Off: Garage Lights
END-IF

If you don't want the doors to have to be closed for motion or door-opening to turn off the lights, you could re-work that a little, maybe:

IF (Garage Motion active OR Garage Entry Door, Garage Door 1, Garage Door 2 any open) THEN
  On: Garage Lights
  Cancel Delayed Actions
ELSE-IF (Garage Motion inactive AND Garage Entry Door, Garage Door 1, Garage Door 2 any open)
  Cancel Delayed Actions
  On: Garage Lights
  Delay: 0:10:00 (cancelable)
  Off: Garage Lights
ELSE
  Delay: 0:10:00 (cancelable)
  Off: Garage Lights
END-IF

Someone might want to check my logic on that last rule. :slight_smile: I had a hard time figuring out how to account for both cases turning on and off the light under different circumstances. I think that works, though.

NOTE: I am careful to use separate "Contact 1 OR Contact opened" triggers here and not "Contact 1, Contact 2 any open" triggers. This is because a combined "any" trigger will still fire if both doors were opened and one door becomes closed (because one still remains in the open state and that's all it checks after a change). The separate triggers will only fire if any door really becomes open, and that is how these triggers need to be restricted for the actions to work as intended.

Good luck!

1 Like

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