I’ve got an automation for to have a switch turn on the sunsets and turn off for sunrise. The only problem is it turns on for sunset but not off for sunrise. I’m sure I’m missing something easy but I can’t figure it out. Any help would be appreciated. Thanks
alias: Light Sunset/Sunrise
description: Turn light on at sunset and off at sunrise
trigger:
- platform: sun
at: sunset
action:
- service: "switch.turn_{{ 'on' if trigger.platform == ‘sun’ else 'off' }}"
entity_id: switch.frontporch
mode: single