This is a basic blueprint to set the heat / cool set points for a thermostat on the specified days with an option to retry if the device does not respond. Automations will adjust the target temperature based on the current thermostat mode. Simply create a new automation for the time you want to adjust and it will act accordingly. If the thermostat is ‘off’, nothing happens - like magic!
blueprint:
name: HVAC Daily Schedule
description: Set the target HVAC temperature based on its mode.
domain: automation
input:
climate_id:
name: Thermostat
description: The thermostat to control.
selector:
entity:
domain: climate
cooling_temp:
name: Cool Set Point
description: The target temperature when cooling.
selector:
number:
min: 0
max: 100
heating_temp:
name: Heat Set Point
description: The target temperature when heating.
selector:
number:
min: 0
max: 100
at_time:
name: Time
description: The time to update this device.
selector:
time:
retry_timeout:
name: Retry Timeout
description: Duration (in minutes) to retry if the device is offline.
default: 0
selector:
number:
min: 0
max: 240
on_monday:
name: Monday
default: true
selector:
boolean:
on_tuesday:
name: Tuesday
default: true
selector:
boolean:
on_wednesday:
name: Wednesday
default: true
selector:
boolean:
on_thursday:
name: Thursday
default: true
selector:
boolean:
on_friday:
name: Friday
default: true
selector:
boolean:
on_saturday:
name: Saturday
default: true
selector:
boolean:
on_sunday:
name: Sunday
default: true
selector:
boolean:
variables:
# re-declare input as a variable for scripting templates
retry_timeout: !input 'retry_timeout'
# array used in the condition for this automation
weekly_schedule:
- !input 'on_monday'
- !input 'on_tuesday'
- !input 'on_wednesday'
- !input 'on_thursday'
- !input 'on_friday'
- !input 'on_saturday'
- !input 'on_sunday'
trigger:
- platform: time
at: !input 'at_time'
# only run on days we have been requested (using schedule array)
condition: '{{ weekly_schedule[now().weekday()] }}'
action:
# thermostats require different inputs depending on the current mode
- choose:
## heating mode ##
- conditions:
- condition: state
entity_id: !input 'climate_id'
state: heat
sequence:
- repeat:
# set the target temperature to the heating_temp input
sequence:
- service: climate.set_temperature
entity_id: !input 'climate_id'
data:
temperature: !input 'heating_temp'
- delay: '00:01:00'
# verify that the temperature was set until the retry timeout expires
until:
- or:
- '{{ repeat.index > retry_timeout }}'
- condition: state
entity_id: !input 'climate_id'
attribute: temperature
state: !input 'heating_temp'
## cooling mode ##
- conditions:
- condition: state
entity_id: !input 'climate_id'
state: cool
sequence:
- repeat:
# set the target temperature to the cooling_temp input
sequence:
- service: climate.set_temperature
entity_id: !input 'climate_id'
data:
temperature: !input 'cooling_temp'
- delay: '00:01:00'
# verify that the temperature was set until the retry timeout expires
until:
- or:
- '{{ repeat.index > retry_timeout }}'
- condition: state
entity_id: !input 'climate_id'
attribute: temperature
state: !input 'cooling_temp'
## heat/cool mode ##
- conditions:
- condition: state
entity_id: !input 'climate_id'
state: heat_cool
sequence:
- repeat:
# set the target temperature range based on user input
sequence:
- service: climate.set_temperature
entity_id: !input 'climate_id'
data:
target_temp_high: !input 'cooling_temp'
target_temp_low: !input 'heating_temp'
- delay: '00:01:00'
# verify that the temperature was set until the retry timeout expires
until:
- or:
- '{{ repeat.index > retry_timeout }}'
- and:
- condition: state
entity_id: !input 'climate_id'
attribute: target_temp_high
state: !input 'cooling_temp'
- condition: state
entity_id: !input 'climate_id'
attribute: target_temp_low
state: !input 'heating_temp'
mode: single
This will provide a blueprint that can be set up as an automation, similar to the following:
I believe it will accept whatever units are being used by the thermostat. There is no code in this blueprint that enforces units… The inputs can range from 0 to 100, so I would imagine that either scale should be okay.
The automation has been updated to select specific days to set the temperature… This allows for customized settings based on work schedules or other preferences.
I currently do this with another automation using the same blueprint… e.g. “Weekday - Morning” runs at 6:00a to set the daytime temperature and “Weekday - Evening” runs at 6:00p to set the nighttime temperature.
Would this accomplish what you are looking for?
If not, let me know your use case and I’d be glad to see if I can adjust this easily.
I guess that would do it, yes. I see that’s already implied in your automation example with the " - Evening" part of the automation name
Becomes a question of number of automations vs a more complicated single automation. Hard to decide where the line is sometimes.
I was just playing with a similar automation today and used trigger ids which successfully accomplishes this in a single automation, but I don’t have the day of week feature incorporated (I WFH and our HVAC schedule is the same 7 days a week) not sure if that would complicate the condition logic. Too tired to think through the flow in my head
I’m also only setting the low end temp right now and I use input helpers so I can present adjustment options in the front end for my wife as she’s only a standard user and can’t edit Automations directly, not that I’d want here too anyway… too confusing for an end user
I see what you are getting at… Adding multiple trigger times to the blueprint would be pretty straightforward. It would simply require adding the desired number of triggers as time elements.
e.g.
trigger:
- platform: time
at: !input 'at_time_am'
- platform: time
at: !input 'at_time_pm'
(of course you would need to add these as inputs to the blueprint).
Alternatively, you could use a Date / Time helper as the trigger input rather than blueprint variables:
- trigger:
- platform: time
at: input_datetime.hvac_morning
- platform: time
at: input_datetime.hvac_evening
This appears to work well for my needs however I am hitting an issue where when I try to disable any day of the week one of two issues occur.
1.) The save button doesn’t always pop up
2.) When I am able to save it doesn’t seem to keep the day disabled when going back in to the automation. This may be why 1 occurs.
Any ideas on this? I’m not seeing anything inherently wrong but I’m not very familiar with Home Assistant scripting.
Thanks!
Edit: After some further testing I found that toggling off a day in the UI causes the value to be set to ‘true’ in the YAML itself. Modifying the YAML to set it to ‘false’ keeps it that way. So perhaps an issue with the toggle logic?
I have not run into that behavior… I’m using a pretty basic implementation of the !input. Which version of Home Assistant are you using?
Also, I have a simplified version of the day-check logic in the latest updated on the blueprint. (Thanks to @123 and @AntonH for the pointers!) Are you using that version?
Sorry you are having trouble! Hopefully we can sort out what’s going on…
EDIT I think I see what you are experiencing now… There is a bug around saving blueprints using the UI that may be related. As a workaround, does the YAML editor work for your needs?
Hi @chewie41983 - there is no gist for this blueprint… If the import button is not working, you can copy the YAML block from blueprint: down to mode: single and paste that into a local blueprint file.
If the import link is not working for you, then you will need to create a local blueprint using the instructions found in the Blueprint tutorial - Home Assistant.
Also, I’ve removed the extra YAML configuration code from the overview. This should help the “Import” button work properly, so give that a try again.
Hey @jheddings, thanks for this blueprint! I just set a few schedules for my ecobee thermostat last night.
I did also add another condition to the blueprint, since I like to use a heat/cool range instead of just heat and cool separately.
Not sure if you want to add this to the blueprint or not. If not, I figure it would be helpful for me to leave a comment in the thread in case anyone else also wanted to make the change locally.
With the option in the configuration for how long ( while, condition, time, before) so if e.g. the chosen trigger time is 11 and the retry time-out is 2 hours, then the before condition is set to 11+2 = 13.
It would be immensely useful as my HVAC (innova) loses connection sporadically throughout the day (resulting in an “unavailable” status instead of cooling or heating) for up to 2 hours at a time and will then potentially miss the temperature change. and remain on the previous.
I like this idea… I need to think about how that would work when there are multiple schedule triggers throughout the day. e.g. if you have a “Early Morning” and “Mid Morning” schedule, the retry would have to stop when the new schedule kicks in.
Let me give it some thought and try a few things. Thanks for the tip!