Check my lighting Rule Please

Can someone check my rule for me to make sure it looks right.

Here's what I want.
Porch light comes on at a certain time (already existing rule) and is dim.
Doorbell sense motion
Lights go brighter
after 1 minute of no motion, lights return to original level.


This won't work; your ELSE will never be reached. This is because your trigger is "motion active," but your ELSE only captures the state of motion inactive. Triggers are the only things that will make your actions run. The easiest fix for this is to change your trigger from "active" to "changed," which will capture any event for motion (active or inactive, the only two possible states for motion).

But: what happens if the light wasn't on to begin with, but you turn it on somehow, generate motion, and then this automation's ELSE will run? Nothing stops that from happening even if this rule didn't turn the light on in the first place. What I might suggest instead is keeping your "motion active" trigger, then changing the actions to something like:

Set Private Boolean False
Capture: Front door lights
Dim: Front Door Lights: 75
Wait for event: Motion inactive --> duration 0:01:00
Restore: Front Door Lights
Set Private Boolean true

And also add "Private Boolean True" as a required expression, which will prevent re-entrant execution.

You may also want to look into an app built specifically for lighting, like Room Lighting, which is better suited for many complicated (or simple) lighting setups than creating rules yourself.

1 Like

The trigger is motion active so the IF-THEN will always be true and the ELSE will never run. You could change motion to changed but I think you'll have an issue with the capture if your motion goes active again within the 1 minute delay. I would rewrite the rule like this

Required Expression
Front Door Light is on

Trigger Events
Front Doorbell motion active

Actions to Run
Capture: Front Door Lights
Dim: Front Door Lights: 75
Wait for Events: Front Doorbell motion inactive and stays that way for: 0:01:00
Restore: Front Door Lights
1 Like

You have a two good examples on how to fix your rule. I'll throw one more in:

Required Expression: Front lights on.
Triggers: Motion Active; Motion Inactive and stays for 1 minute
If motion, set Front light to 75
else, set Front light (to whatever normal Front Light setting you use)

Basically, this simplifies your rule and you do not need to worry about capture (assuming your Front Lights are always the same with no motion).


Great help!! Thanks all!

One other option; I'm a big fan of writing rules to describe how things should be, regardless of their current state. So go to the rule that's already turning your porch lights on/off and add motion like this:

  • Triggers:
    • Start light time
    • Stop light time
    • Motion active
    • Motion inactive for 1 minutes
  • Actions:
    • If time between start and stop:
      • If motion active, lights bright
      • Else, lights dim
    • Else, lights off
1 Like