Overview:
If the automation turns the lights on… the automation is free to turn the lights off… But If I manually turn the lights on then the automation is shunted. I’m using a boolean flag set in the “On Automation” to tell the “Off Automation” whether the current state was set by an automation.
In this snippet… this is the “On Automation”…
When my motion sensor sees movement
And
The East light is off
And
Its between Sunrise and Sunset
turn my two lights on and set the boolean flag
It works without the sunset check so I know where the problem is… but I cant make HA happy
With respect to the offset times I’ve tried 00:00:00 and 00:00:01… and several more
Below is HA generated YAML
- id: East_Patio_Lights_On
alias: East Patio Lights On
trigger:
- entity_id: binary_sensor.east_patio_motion_detector_sensor
platform: state
to: 'on'
condition:
- condition: device
type: is_off
device_id: 6f52a149b901d5d60b44ba94f2796a40
entity_id: switch.east_patio_east_light
domain: switch
- condition: and
conditions:
- condition: sun
before: sunrise
after: sunset
after_offset: -00:30
before_offset: -00:30
action:
- data:
entity_id: switch.east_patio_east_light
service: switch.turn_on
- data:
entity_id: switch.east_patio_west_light
service: switch.turn_on
- data: {}
entity_id: input_boolean.east_patio_automation_started
service: input_boolean.turn_on
mode: single