Hi all, I’m having trouble with this OR condition that has nested ANDs. Overall problem: Using camera motion detection to trigger a light between 10pm and sunrise, but when the automation runs and the light turns off after 2 minutes, the camera sensor changes back to “Detected” which re-triggers the automation over and over. I read best to use a “last state change” condition:
condition:
condition: or
conditions:
condition: and
conditions:
- condition: time
after: "22:00:00"
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.light.entrance_porch_light.last_changed)) > 10 }}'
condition: and
conditions:
- condition: sun
before: sunrise
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.light.entrance_porch_light.last_changed)) > 10 }}'
1 post - 1 participant