So I have my lights working with home assistant like a champ. They turn off at 11:30pm and on at 5:30am then turn off at 8am (work). My question is how can do this based on a day? I want a different schedule for the weekends. Thanks for looking guys. Have a great weekend.
Time condition -> Weekday
Here’s an example - I am using it for heating but the principle is the same!
#
# Turn on heat at 5:30am weekdays if anyone is home
#
- alias: 'Heat on week'
trigger:
platform: time
after: '05:30:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: group.all_devices
state: home
action:
service: script.turn_on
entity_id: script.smart_heat_on
#
# Turn on heat at 6:30am weekends if anyone is home
#
- alias: 'Heat on weekend'
trigger:
platform: time
after: '06:30:00'
condition:
- condition: time
weekday:
- sat
- sun
- condition: state
entity_id: group.all_devices
state: home
action:
service: script.turn_on
entity_id: script.smart_heat_on
Awesome, thanks!
How do you do this in the gui?
You might also check out the Workday component. I added this to my heating schedule because I don’t want the heat coming on early if I’m staying in bed for a holiday. It’s not perfect, but improves on just a weekend/weekday schedule for me. (Note, most of my climate schedule is handled by the ecobee, this automation adds the workday variability that ecobee doesn’t offer.)
configuration.yaml:
binary_sensor:
- platform: workday
country: US
province: CA
automations.yaml:
- alias: "ecobee Good Morning mode"
trigger:
platform: time
at: '05:45:00'
condition:
condition: state
entity_id: 'binary_sensor.workday_sensor'
state: 'on'
action:
service: climate.set_hold_mode
data:
entity_id: climate.thermostat
hold_mode: smart4
Are you asking how to edit the yaml files?
I know your question is 2 months old and maybe you’ve answered it, but I feel your pain. I’m guessing you’re a Home Assistant newbie like me who was initially quite daunted, but then stumbled across Node Red and fell in love. If that’s the GUI you’re talking about, have a look at node-red-contrib-simple-weekly-scheduler (add it into the palette). You can specify which days of the week, and what time(s) of the day on each.
No. I know how to edit a yaml file. I want to know how to perform this task in the gui under automations, triggers, time and set the properties as you have in the yaml file.
The gui editor can not handle complex templates like that, and I’m not sure it ever will.
It’s just meant for simple automations and simple scripts.
Newbies can gain confidence and understanding by reading the output and then learn to dabble with templates.
Though, I have to admit I’ve never used the editor in its full glory (if there is any)
Actually it can. I’ve been using the gui for almost everything. I believe that is their goal at some point.
In the gui, create the automation, under condition, select “TIME” then click the three dots and select “edit as YAML” add the following:
condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
I’m intrigued by the fact you have returned to this topic every 2 years. There must be a fascinating story behind this 2-year absence.
There isn’t, actually was googling for a solution, re-found this post and saw I commented 2 years ago asking the same thing. The GUI has evolved and so I figured out the solution.