I have been trying for several days to get a working automation rule for turning on a switch 1.5 hours before sunset. I copied the example for using the sun platform and have checked it over many times and cannot find the error in my code. I found one example that used the single quote around the time offset and another example that used the double quote around the time offset. I have used both and neither worked. I have even tried removing the offset altogether and simply use sunset as the trigger and still nothing.
I checked the homeassistant log file and it has no errors. I have one other rule that turns the same switch off at midnight using the time platform. That one successfully fires every day. The only difference I can see between the two is the use of the sun platform. Sun tracking is working on my platform as far as I can tell. I see sunrise and sunset showing in my log and when I click sun on the home assistant screen it shows me next sunrise and sunset. Below are the sections in their current state from my configuration file:
My code for the sunset automation (not working):
automation:
alias: 'Turn on sunroom light 1:30 before sun sets'
trigger:
platform: sun
event: sunset
offset: '-01:30:00'
action:
service: homeassistant.turn_on
entity_id: switch.ge_45609_onoff_relay_switch_switch_5
My code for the midnight automation (working:
automation:
alias: 'Turn off sunroom switch at midnight'
trigger:
platform: time
after: '00:00:00'
action:
service: homeassistant.turn_off
entity_id: switch.ge_45609_onoff_relay_switch_switch_5
If anyone has any ideas or sees where my error lies I would greatly appreciate the help!