For my automation to open the blinds in the morning, I want the blinds to open no earlier than 7:15 if the sun has already risen. Is sunrise after 7:15, the blinds should open at sunrise. I already have the following automation:
alias: Gordijnmanager
description: ""
trigger:
- platform: time
at: "07:15:00"
id: Openen
- platform: sun
event: sunrise
offset: 0
id: Openen
enabled: true
- device_id: eaf23ea82bae8a3cfdb25647eb694253
domain: zha
platform: device
type: remote_button_double_press
subtype: button_2
id: Openen
- platform: time
at: "22:00:00"
id: Sluiten
- device_id: eaf23ea82bae8a3cfdb25647eb694253
domain: zha
platform: device
type: remote_button_short_press
subtype: button_2
id: Sluiten
- platform: sun
event: sunset
offset: 0
id: Sluiten
- platform: state
entity_id:
- media_player.chromecast_huiskamer_2
to: "on"
id: Sluit huiskamer
- platform: state
entity_id:
- media_player.chromecast_huiskamer_2
to: "off"
id: Open huiskamer
- platform: state
entity_id:
- media_player.kpn_diw7022
to: "on"
id: Sluit huiskamer
- platform: state
entity_id:
- media_player.kpn_diw7022
to: "off"
id: Open huiskamer
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- Open
- condition: template
value_template: ""
sequence:
- service: cover.open_cover
target:
entity_id: cover.rolgordijnen
data: {}
- service: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.rolgordijn_huiskamer_door_manager
- conditions:
- condition: trigger
id:
- Sluiten
sequence:
- service: cover.close_cover
metadata: {}
data: {}
target:
entity_id: cover.rolgordijnen
- service: input_boolean.turn_off
target:
entity_id: input_boolean.rolgordijn_huiskamer_door_manager
data: {}
- conditions:
- condition: trigger
id:
- Sluit huiskamer
sequence:
- service: cover.close_cover
metadata: {}
data: {}
target:
area_id: huiskamer
- conditions:
- condition: trigger
id:
- Open huiskamer
sequence:
- service: cover.open_cover
metadata: {}
data: {}
target:
area_id: huiskamer
My idea is to have a condition at the first option and check if sunrise is before or after 7:15 using a template. So, if sunrise <= 7:15 result should be false, otherwise true. I can’t find how to get the current time and compare it to 7:15.