Help with Porch Lighting Rule Please

Ok Iā€™ll try that

Honestly, all of the ways discussed above seem a bit weird. Yes, the lights could still turn off if the door is open because nothing is checking for that before turning them off. They could still turn off if motion is active, too. This is not the way most people would set this up. Here is a more common setup:

Triggers: Motion sensor *changed* OR Contact sensor *changed*

Actions:

IF (Motion sensor active OR Contact sensor open) THEN
  Cancel Delayed Actions
  IF (Time is between x and y) On: Light Switch
ELSE
  Delay 0:01:00 (cancelable)
  Off: Light Switch
END-IF

This way, the lights won't turn off until motion is inactive and the contact sensor is closed. (It will also turn them off even if this automation didn't turn them on or it is now outside of the specified "on" time; most people want the latter, and there are ways to work around the former if you don't want that.) I can think of very few cases where you'd want motion to turn off based on when motion becomes active rather than inactive.

And if this all you're doing, I wouldn't use Rule Machine at all. Motion Lighting can handle this with none of the above effort. Your original rule did have a fade out, but I don't see that in the new version; you'd need RM or another app to handle something like that.

I've never thought of doing it the way you have described above. Makes perfect sense when it is all laid out.
I've always gone down the road as I've shown.
Nice one..

It's one of the first examples in the Rule 4.0 documentation, which I recommend reading so much that I should probably have a shortcut that types this sentence for me. :slight_smile:

I agree but I didnā€™t want to stray too far from the original question.

The biggest difference I had was I used a motion group for the sensors. That way I didnā€™t have to deal with them turning on and off independently as I moved around outside. I used the changed condition to trigger and then used On/off condition to trigger the lights. It worked well because my motion sensors have a 4 minute timeout. I didnā€™t need a delay.

The logic looked something like this:

IF (nighttime) THEN
   IF (motion detected) THEN
      Turn lights on full
   ELSE
      Dim nightlights
      Turn off other lights
   ENDIF
ELSE
   Turn off all lights
ENDIF

If there was any motion the lights would go on full then back to dim when motion stopped. I put the full off in the outer loop just in case the motion ran past the time constraint. That way the would turn off during the day without fail.

It worked well but that was only the start. Now I have a custom app that has overrides and special holiday scenes. For example, starting tonight the lights are yellow and orange for Thanksgiving but still come on full if anybody come onto the property. Then they dim back to the seasonal colors. At midnight they return to the regular nightlong settings. It has been a fun project and really took a bit to get me over the initial learning curve.