I’m sure this is an easy one but would like to understand the best approach.
I have a motion sensor in our hall which turns lights off if there hasn’t been any movement for 10 minutes and it’s after 22:00.
But… if the last movement of the day is at 21:00 then ‘no movement for 10 minutes’ will trigger at 21:10 and the condition of ‘after 22:00’ has not been met. So the light will stay on all night.
Have I understood that correctly? If so, what’s the best fix? A separate automation that triggers at 10pm and checks to see that there hasn’t been any motion in the last 10 minutes?
Just add a second trigger to the same automation, and a second condition. This is quite a common pattern here for doing something when 2 things are true
trigger:
- platform: state
entity_id: MOTION SENSOR
to: 'off'
for:
minutes: 10
- platform: time
at: '22:00:00'
condition:
- condition: state
entity_id: MOTION SENSOR
state: 'off'
for:
minutes: 10
- condition: time
after: '21:59:59'
action:
service: light.turn_off
entity_id: LIGHT
Sorry to resurrect this old thread but I have a similar question. I’m trying to turn a light off when there’s no movement in the hall AND no movement at the front door (from a security cam). I can trigger it okay, but I don’t know how I can establish that there hasn’t been any movement from the camera in the condition section. Do you know?