Hi everyone,
I need help setting up an automation that turns off the lights if neither of two motion sensors detects motion for 10 minutes. It’s important that the timer resets if either sensor detects motion again during that time.
Here’s the code I currently have, but the lights never turn off:
Any ideas why this isn’t working? Or how I can better structure the automation so the timer resets properly when motion is detected again?
Thanks in advance!
Can you be a little bit more specific? You actually reference fourbinary_sensor entities in your automation, but your post only talks about two.
With respect to just the trigger portion of your automation, it will trigger if either of those two sensors has stayed in the off state for 10 minutes, even if the other one has been on. But that isn’t your immediate problem, since you’re saying that the action block never executes.
I’ve tried different combinations — sometimes the light turns off when just one of the motion sensors hasn’t detected movement for 10 minutes, completely ignoring the other one (usually the first sensor added seems to take priority). But with the version I shared, the light never turns off at all.
this one only has 1 motion sensor, but I have others with multiple, you simply include them in the triggers and wait for sections.
this turns on the lower stair lights when motion, or when I turn off my receiver/tv/etc, then waits until specified motion is cleared for however long, and shuts the lights off.
although lights can be controlled in other automations, the only real down side to this, is it does not easily allow for manual over ride, once motion is triggered and cleared, the lights go on and off in their specified manner, regardless of prior state and intention.
entity_id:
- binary_sensor.hall_motion_sensors
to: "off"
for:
hours: 0
minutes: 10
seconds: 0
trigger: state
Also skip the conditions, not needed now when you have a group of sensors, just the trigger and then the action.
Here is a much simplified example off my motion sensor automation that turns on and off the lights with a single automation based on trigger id’s.
I just have one single automation for all my motion sensors.
I made another one for turning the light on, also with the group of motion sensors, so that it would only turn on when both detect motion. It seemed to work, but for the past few days, no matter which single sensor detects motion, the light turns on.