I have an automation I want to run in the mornings at 07:00 but only if it is somewhere between 1 h. before sunrise to 1 h. after sunrise.
Would this condition work?
initial_state: True
trigger:
platform: time
at: '07:00:00'
condition:
- condition: or
conditions:
- condition: sun
before: sunrise
before_offset: "-1:00:00"
- condition: sun
after: sunrise
after_offset: "1:00:00"
action:
service: homeassistant.turn_on
entity_id: group.window_lights```
Will this trigger automation when the time is 07:00 and +- 1 h. to sunrise?
I struggled with this while trying to create an automation condition based on time. I couldn’t figure out how the offsets behaved. I ended up using the solar angle attribute of the sun component.
You can see my condition here. I think ~15 degrees is an hour