I want to create a single automation that will turn on a switch at a specific time based on the day of the week.
E.g.
If (Mon, Tue, Wed, Thur)
Then (Turn on @ 9:15pm)
Else If (Fri, Sat, Sun)
Then (Turn on @ 10:30pm)
I have been playing around with the automation Trigger and Conditions and cannot find a way to accomplish this, seemingly very simple, task…
How can I accomplish this in a single automation?
rossk
November 3, 2022, 3:23pm
2
I would use 2 triggers, one for each time block. Then under action I would use a choose option and split the two options, something like the following maybe:
mode: single
trigger:
- platform: time
at: "21:15:00"
id: weekday
- platform: time
at: "22:30:00"
id: weekend
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: weekday
- condition: time
weekday:
- mon
- tue
- wed
- thu
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.your_switch
- conditions:
- condition: trigger
id: weekend
- condition: time
weekday:
- fri
- sat
- sun
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.your_switch
There are multiple ways to do this using if_else, templates etc, but for quick and easy the above should work!
1 Like
Thank you for this suggestion! I think it will work well for my use.