alias: Outdoor Xmas lights based on sunset and sunrise description: "Turns on lights before sunset and off after sunrise" mode: single trigger: - platform: template value_template: > {{ now().timestamp() >= (as_timestamp(state_attr('sun.sun', 'next_setting')) - 1800) }} id: sunset-on - platform: template value_template: > {{ now().timestamp() >= (as_timestamp(state_attr('sun.sun', 'next_rising')) + 1800) }} id: sunrise-off action: - choose: - conditions: - condition: trigger id: sunset-on sequence: - service: homeassistant.turn_on target: entity_id: - switch.your_first_switch_with_lights - switch.your_second_switch_with_lights - conditions: - condition: trigger id: sunrise-off sequence: - service: homeassistant.turn_off target: entity_id: - switch.your_first_switch_with_lights - switch.your_second_switch_with_lights