I want to turn a switch on/off if the sun rises/sets.
If I run it manually it just works! But if I wait for the sun.rise and sun.set events to get triggered, nothing happens… (I already enabled all entities of the “sun” service).
alias: Toggle corridor light based on sun
description: ""
trigger:
- platform: sun
event: sunrise
offset: "00:00:03"
- platform: sun
event: sunset
offset: "00:00:03"
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: sun.sun
state: above_horizon
sequence:
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.shelly_plug1_output
- conditions:
- condition: state
entity_id: sun.sun
state: below_horizon
sequence:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.shelly_plug1_output
mode: single