Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106304

OR condition with nested ANDs

$
0
0

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

Read full topic


Viewing all articles
Browse latest Browse all 106304

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>