Climate temperature profile up to 10 points per day

Here is a blueprint for setting the temperature of thermostat-entity at specific time to specific temperature. There is a flag to active or deactivate the profile and selection if the profile has to be active at ‘on’ or ‘off’ value of the flag.

You could for example use a “weekend” flag and define two automations with ‘on’ and ‘off’ selection. So you will additionaly get a profile at workdays using one input_boolean or binary_sensor only.

In my case I switch between two different temperature profiles in dependency on the occupation of the room.

If the value of the flag changes, the last temperature of the activated profile is set, as it would be active all the time.

Have fun.

blueprint:
  name: Set thermostat temperature at specific time
  description: Sets a climate entity to a specifc temperature at a set time everyday. Start with the earliest time of the day i.e. 12:10 AM and end with the latest i.e. 11:00 PM in ascending order. At least one time/temperature pair has to be set.
  domain: automation
  input:
    climate_entity:
      name: Thermostat
      description: Climate entity which will get the temperature update
      selector:
        entity:
          domain: climate
    active_flag:
      name: Activity flag
      description: Input boolean flag as condition for execution
      selector:
        entity:
          domain: input_boolean
    active_when:
      name: Automation is applied when activity flag is equal to
      description: Selection if automation is active at ON or OFF value of the flag
      selector:
        select:
          options:
            - 'on'
            - 'off'
    time_to_set_1:
      name: Time_1
      default:
      description: When should the temperature be set
      selector:
        time: {}
    temp_to_set_1:
      name: Temperature_1
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_2:
      name: Time_2
      description: When should the temperature be set
      default: 
      selector:
        time: {}
    temp_to_set_2:
      name: Temperature_2
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_3:
      name: Time_3
      description: When should the temperature be set
      default:
      selector:
        time: {}
    temp_to_set_3:
      name: Temperature_3
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_4:
      name: Time_4
      default:
      description: When should the temperature be set
      selector:
        time: {}
    temp_to_set_4:
      name: Temperature_4
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_5:
      name: Time_5
      description: When should the temperature be set
      default: 
      selector:
        time: {}
    temp_to_set_5:
      name: Temperature_5
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_6:
      name: Time_6
      description: When should the temperature be set
      default:
      selector:
        time: {}
    temp_to_set_6:
      name: Temperature_6
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_7:
      name: Time_7
      default:
      description: When should the temperature be set
      selector:
        time: {}
    temp_to_set_7:
      name: Temperature_7
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_8:
      name: Time_8
      description: When should the temperature be set
      default: 
      selector:
        time: {}
    temp_to_set_8:
      name: Temperature_8
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_9:
      name: Time_9
      description: When should the temperature be set
      default:
      selector:
        time: {}
    temp_to_set_9:
      name: Temperature_9
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider
    time_to_set_10:
      name: Time_10
      description: When should the temperature be set
      default:
      selector:
        time: {}
    temp_to_set_10:
      name: Temperature_10
      description: Temperature to set on defined time
      default: 19.5
      selector:
        number:
          min: 10.0
          max: 30.0
          unit_of_measurement: degrees
          step: 0.5
          mode: slider

trigger:
- platform: state
  entity_id: !input active_flag
  id: set_last_temperature
- platform: time
  at: !input 'time_to_set_1'
  id: time_1
- platform: time
  at: !input 'time_to_set_2'
  id: time_2
- platform: time
  at: !input 'time_to_set_3'
  id: time_3
- platform: time
  at: !input 'time_to_set_4'
  id: time_4
- platform: time
  at: !input 'time_to_set_5'
  id: time_5
- platform: time
  at: !input 'time_to_set_6'
  id: time_6
- platform: time
  at: !input 'time_to_set_7'
  id: time_7
- platform: time
  at: !input 'time_to_set_8'
  id: time_8
- platform: time
  at: !input 'time_to_set_9'
  id: time_9
- platform: time
  at: !input 'time_to_set_10'
  id: time_10
  
condition:
  - condition: state
    entity_id: !input active_flag
    state: !input 'active_when'
action:
- choose:
    - conditions:
        - condition: trigger
          id: set_last_temperature
      sequence:
        - alias: "Find T to be set"
          variables:
            T_1:     !input temp_to_set_1
            T_2:     !input temp_to_set_2
            T_3:     !input temp_to_set_3
            T_4:     !input temp_to_set_4
            T_5:     !input temp_to_set_5
            T_6:     !input temp_to_set_6
            T_7:     !input temp_to_set_7
            T_8:     !input temp_to_set_8
            T_9:     !input temp_to_set_9
            T_10:    !input temp_to_set_10
            time_1:  !input time_to_set_1
            time_2:  !input time_to_set_2
            time_3:  !input time_to_set_3
            time_4:  !input time_to_set_4
            time_5:  !input time_to_set_5
            time_6:  !input time_to_set_6
            time_7:  !input time_to_set_7
            time_8:  !input time_to_set_8
            time_9:  !input time_to_set_9
            time_10: !input time_to_set_10
            T: >-
              {% set all_values = [[time_10, T_10],[time_9, T_9],[time_8, T_8],[time_7, T_7],[time_6, T_6],[time_5, T_5],[time_4, T_4],[time_3, T_3],[time_2, T_2],[time_1, T_1]] %}
              {% set result = namespace(time_curr = strptime( (((as_timestamp(now()) | int ) | timestamp_custom("%H:%M:%S")) | string), "%H:%M:%S"), temp_last = all_values[all_values|length()-1][1]) %}
              {# loop from last time of the day, till first set time #}
              {% for curr_values  in all_values -%}
                {% if curr_values[0] and (strptime(curr_values[0], "%H:%M:%S") < result.time_curr) -%}
                  {# we found previous closest time to now() #}
                  {# store the temperature #}
                  {% set result.temp_last = curr_values[1] -%}
                  {# break the loop #}
                  {% set result.time_curr = strptime('00:00:00', "%H:%M:%S") -%}
                {% endif %}
              {% endfor %}
              {{ result.temp_last }}
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: "{{ T }}"
    - conditions:
        - condition: trigger
          id: time_1
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_1'
    - conditions:
        - condition: trigger
          id: time_2
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_2'
    - conditions:
        - condition: trigger
          id: time_3
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_3'
    - conditions:
        - condition: trigger
          id: time_4
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_4'
    - conditions:
        - condition: trigger
          id: time_5
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_5'
    - conditions:
        - condition: trigger
          id: time_6
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_6'
    - conditions:
        - condition: trigger
          id: time_7
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_7'
    - conditions:
        - condition: trigger
          id: time_8
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_8'
    - conditions:
        - condition: trigger
          id: time_9
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_9'
    - conditions:
        - condition: trigger
          id: time_10
      sequence:
        - service: climate.set_temperature
          entity_id: !input 'climate_entity'
          data:
            temperature: !input 'temp_to_set_10'
  default: []

mode: queued

Here an example:

2 Likes

Can you add days also, as an example
on Saturdays and Sundays at 10 AM set heating to 20C, at 11:59PM set to 16
On Weekdays (Mon-Fri) set heating to 20C at 8AM and at 10PM set to 16

In this case you will need an additional selection for each time, if it is a weekend or not. Due to this reason of simplicity I’ve included “activity flag”. You need in this case two automations with my blueprint: one for the weekend, and one for the workdays.
As activity-flag you select the binary_sensor for the weekend. In my case it is:

binary_sensor:
  - platform: workday
    country: DE
    workdays: [mon, tue, wed, thu, fri]
    excludes: [sat, sun, holiday]

In the temperature-profile for the weekend you set “active when” to “off”, in the temperature-profile for workday you set “active when” to “on”.

If you use “binary_sensor” you have to change within the blueprint “input_boolean” to “binary_sensor”

active_flag:
      name: Activity flag
      description: Binary_sensor as condition for execution
      selector:
        entity:
          domain:  binary_sensor

If you want to use this blueprint to set 2 temperatures only, this blueprint is probably “overkill”

cheers

I want to ask you a very huge favour,
Is is possible to add under the “Automation is applied when activity flag is equal to”
and add a option aswell like this:

temp_sensor:
      name: Temperature Sensor
      description: Temperature Sensor to check temp outside
      selector:
        entity:
          domain: sensor
          device_class: temperature

so it basically creates a box so i can select my outside temp sensor.

because time_1 till time_5 its only a time selectable, i just want to have a temperature selected instead that compares with the new added temperature device.

So for example:
time_1 should be called temp_1 so i can select the temperature.
SO when outside hits for example 2 celcius and i setup the slider at temp_1 on 21 than it should set my thermostat to 21…
and so on for more value’s

maybe you can add this option to it that would be even better.

i really don’t know where to start but it will save a lot of energy issue’s

many thanks !!!

Ok, I see. I do not have a solution for the moment, have to think about it.

A quick and dirty way, would be for example, to define, let say, 2-3 binary_sensors, triggers to “on” in a given range on temperature and use three automations.

i.e.

binary_sensor:
  - platform: template
    sensors:
      very_cold:
        friendly_name: "very cold"
        value_template: >-
          {{ float( states('sensor.temperature_outside') , 0)  < -5 }}
      cold:
        friendly_name: "cold"
        value_template: >-
          {{( float( states('sensor.temperature_outside') , 0)  < 0 ) and (( float( states('sensor.temperature_outside') , 0)  >= -5 )) }}
      warm:
        friendly_name: "warm"
        value_template: >-
          {{ float( states('sensor.temperature_outside') , 0)  >= 0  }}

That binary_sensors you can use that as the “activity_flag = ON” for the automations (each for separate automation).

I know, it is not what you wanted, but your issue it not so easy to solve quickly.

The problem I see in your case, how to trigger once at given temperature. If you use something like “below 2°C”, your sensor will trigger at any change of the temperature value below that point. If you use the trigger like T = 2°C, you can miss the exact value.
And remember: template-triggering in blueprints (with selected entities) is still not possible, as I know

Many thanks,

i have an idea i will make a blueprint based on yours and other ones i will share it once its ready.

thanks for the info