I want to have an automation that closes curtains at :
OR at Sunset + 15 mins
OR at 8 pm
I have created the following Script and would like to know if this is correct:
alias: MBR Dark Curtains
sequence:
condition: or
conditions:
condition: time
before: “20:00:00”
weekday:
mon
tue
wed
thu
fri
sat
sun
condition: or
conditions:
condition: sun
after: sunset
after_offset: “15”
condition: or
conditions:
condition: sun
before: sunset
after: sunset
after_offset: “45”
type: turn_on
device_id: d12793886c34239a69d8e8980c030e18
entity_id: switch.10a_mbr_dark_curtains
domain: switch
mode: single
If you want them to close automatically you should use an automation, not a script. You did not specify if the curtains should close at the earlier instance of the two options or the later.
I thought about an automation, but I can not figure out what the trigger should be.
How can I set up the trigger with OR Sunset + 15 mins, OR Sunset + 45 mins (*) OR 8 pm ?
For time being I have resolved it by creating more than one Automations.
Automations can have as many triggers as you want. The automation actually triggers on all three. But, you design the conditional logic so that the actions are only executed when you want. The general outline of the automation is as follows, but you will need to explain the conditions under which it should and/or should not execute the action for us to help any further.
trigger:
- platform: sun
event: sunset
offset: "+00:45:00"
- platform: sun
event: sunset
offset: "+00:15:00"
- platform: time
at: "20:00:00"
condition: ?
action:
- service: switch.turn_on
target:
entity_id: switch.10a_mbr_dark_curtains