How do you schedule your thermostat temperature Throughout the year?

Apart from setting heating and cooling according to the season I also tend to set my temperature differently. For example in summer I cool down to 23 but in winter I heat up to 19.

Initially I thought we could use sensor.season

But the start and end of autumn are different similarly for spring.

Ideally I would do something like summer plus minus one month then winter plus minus one month.

What is the cleanest way to do this?

I use an input select to manually set the “heating season”.

Also using heating programs relative to sunrise and sunset minimizes the number of seasons.

2 Likes

I’ve thought about this as well. In theory, the number should never change but I am warmer or cooler (regardless of the thermostat) depending on the sun and the thermostat cannot take solar radiation into account.

I also used sensor.season for my lights as the speed at which sunset/dusk occurs is different throughout the year.

However, if you are looking for something else, you could always use {{now().month}} which will give the month number and so a greater resolution than sensor.season.

For Sept-March:

- condition: template
  value_template: "{{ now().month >=9 or now().month <=3 }}"

or for Dec-Jan

condition: "{{ now().month in [1, 12] }}"

You could also go one further with {{now().day}}

- condition: template
  value_template: >
    {{
      ( now().month >=9 and now().day >=21 )
      or
      ( now().month <=3 and now().day <=15 )
    }}

I have a convoluted set of schedules, input numbers, template sensors and two automations.

I tried using the season sensor. Season - Home Assistant But now just enable my two automations as needed. It’s different every year.

In spring and autumn-ish I enable the schedule automation which heats the house in the morning before I get up and in the evening if required.

In winter the heat pump stays on 24/7 and I enable another automation sets the temperature cooler based on me being away or in bed. It also slightly lowers the temperature during peak electricity rate times. It also boosts the temperature before I get up or home from work.

I was sceptical but it turns out that keeping everything in the house warm uses less energy than heating it up from cold every day. That coupled with the automatic temperature adjustments saved me a couple of hundred dollars last winter.

Summer they are both disabled and I just open all the windows and doors (they have insect screens) and let the air blow through. Only had to close everything up and manually run the air conditioner once last summer on a particularly hot and still night.

Off topic, but how do you group entities in that box?
image

I got these

In what way are you using sunset times?
It affects my solar a lot but I don’t know how to deal with it

I’m not sure where you read that but I only use sunset/rise for my lights not heating.

Currently I have a sensor that tells me the target temp and my automation is simple and triggered by this sensor (and a couple other things).

  • Schedule 1 is a a pre-get-up warming
  • Schedule 2 is active when house_modeawake (and before schedule 3’s time).
  • Schedule 3-5 is as you might expect
  • Schedule 6 is active when house_modeasleep (and before schedule 1’s time)

So, Influences include:

  • house mode
  • time of schedules
  • my presence
  • doors windows being open (not bathroom) > 1min
  • heating mode
  • boost function
  • morning bathroom heating
template sensor
template:
  - sensor
      - name: "Hive heating target temp"
        unique_id: hive_heating_target_temp
        device_class: temperature
        unit_of_measurement: °C
        availability: "{{ has_value('binary_sensor.hive_heating_doors_windows_open') }}"
        attributes:
        # influence shows (on dashboard) what is setting the temp
          influence: >
            {% set sched1 = states('input_boolean.hive_heating_1_scheduled') %}
            {% set sched2 = states('input_boolean.hive_heating_2_scheduled') %}
            {% set sched3 = states('input_boolean.hive_heating_3_scheduled') %}
            {% set sched4 = states('input_boolean.hive_heating_4_scheduled') %}
            {% set sched5 = states('input_boolean.hive_heating_5_scheduled') %}
            {% set sched6 = states('input_boolean.hive_heating_6_scheduled') %}

            {% set on1  = states('input_datetime.hive_heating_1')[:5] %}
            {% set on3  = states('input_datetime.hive_heating_3')[:5] %}
            {% set on4  = states('input_datetime.hive_heating_4')[:5] %}
            {% set on5  = states('input_datetime.hive_heating_5')[:5] %}

            {% set mode =     states('input_select.hive_heating_target_mode') %}
            {% set boost =    states('timer.hive_heating_boost') %}
            {% set bathroom = states('timer.hive_heating_boost_bathroom') %}
            {% set dr_win =   states('binary_sensor.hive_heating_doors_windows_open') %}
            {% set home =     states('zone.home') %}
            {% set time =     states('sensor.time') %}
            {% set house =    states('input_select.house_mode') %}
          
            {%   if mode        == 'heat' %}
              {%   if boost     == 'active' %}                        Boost
              {% elif bathroom  == 'active' %}                        Bathroom
              {% elif dr_win    == 'on' %}                            Dr/Win
              {% elif home      != '0' %}

                {%   if house   == 'Awake' %}
                  {%   if sched5 == 'on' and (time >= on5 or time < on1) %} Schedule 5
                  {% elif sched4 == 'on' and (time >= on4 or time < on1) %} Schedule 4
                  {% elif sched3 == 'on' and (time >= on3 or time < on1) %} Schedule 3
                  {% else %}                                                Schedule 2
                  {% endif %}
                {% elif sched1 == 'on' and ('12:00' > time >= on1) %}       Schedule 1
                {% else %}                                                  Schedule 6
                {% endif %}

              {% else %}                                              Away
              {% endif %}
            {% else %}                                                Off
            {% endif %}
        state: >
          {% set influence =  state_attr('sensor.hive_heating_target_temp','influence') %}

          {% set temp1  =     states('input_number.hive_heating_1_temp')|float %}
          {% set temp2 =      states('input_number.hive_heating_2_temp')|float %}
          {% set temp3 =      states('input_number.hive_heating_3_temp')|float %}
          {% set temp4 =      states('input_number.hive_heating_4_temp')|float %}
          {% set temp5 =      states('input_number.hive_heating_5_temp')|float %}
          {% set temp6 =      states('input_number.hive_heating_6_temp')|float %}
          {% set open =       states('input_number.hive_heating_open_temp')|float  %}
          {% set away =       states('input_number.hive_heating_away_temp')|float  %}
          {% set boostpre =   states('input_number.hive_heating_boost_prior_temp')|float %}
          {% set boostby =    states('input_number.hive_heating_boost_temp')|float %}
        
          {%   if influence == 'Boost' %}       {{ boostpre + boostby }}
          {% elif influence == 'Bathroom' %}    {{ boostpre + 0.5 }}
          {% elif influence == 'Dr/Win' %}      {{ open }}
          {% elif influence == 'Schedule 1' %}  {{ temp1 }}
          {% elif influence == 'Schedule 2' %}  {{ temp2 }}
          {% elif influence == 'Schedule 3' %}  {{ temp3 }}
          {% elif influence == 'Schedule 4' %}  {{ temp4 }}
          {% elif influence == 'Schedule 5' %}  {{ temp5 }}
          {% elif influence == 'Schedule 6' %}  {{ temp6 }}
          {% elif influence == 'Away' %}        {{ away }}
          {% elif influence == 'Off' %}         12
          {% else %}                            15
          {% endif %}
        state_class: measurement
        icon: >
          {% set influence = state_attr('sensor.hive_heating_target_temp','influence') %}
          
          {%   if influence == 'Boost' %}       mdi:timer
          {% elif influence == 'Bathroom' %}    mdi:shower
          {% elif influence == 'Dr/Win' %}      mdi:door-open
          {% elif influence == 'Schedule 1' %}  mdi:calendar-check-outline
          {% elif influence == 'Schedule 2' %}  mdi:calendar-check-outline
          {% elif influence == 'Schedule 3' %}  mdi:calendar-check-outline
          {% elif influence == 'Schedule 4' %}  mdi:calendar-check-outline
          {% elif influence == 'Schedule 5' %}  mdi:calendar-check-outline
          {% elif influence == 'Schedule 6' %}  mdi:calendar-check-outline
          {% elif influence == 'Away' %}        mdi:car
          {% elif influence == 'Off' %}         mdi:power-off
          {% else %}                            mdi:help
          {% endif %}

…but not sunset (yet). It’s rock solid for me and survives restarts etc.

I am working on editing it to have an offset when the light (sensor.light_level) is low (or maybe when it is raining) but that is still very much in draft. Bringing the temp up ½ hr before sunset is a great idea and I might create a schedule for that as well.

If you like what I have done, I’ll happily share the update when I’m done.

For completeness, here is the automation (again, happy to share the whole package). I’m using MQTT but it’s easy enough to convert.

automation
automation
  - alias: Hive heating control
    id: "hive_heating"
    description: ''
    mode: queued
    initial_state: true
    trigger:
      # reset mode if out-of-sync
      - platform: template
        value_template: "{{ states('sensor.hive_heating_reported_mode') != states('input_select.hive_heating_target_mode') }}"
      # set mode
      - platform: state
        entity_id: input_select.hive_heating_target_mode
      # set correct mode on startup
      - platform: homeassistant
        event: start
      # set temp
      - platform: state
        entity_id: sensor.hive_heating_target_temp
    action:
      - choose:
          - conditions:
              - condition: state
                entity_id: input_select.hive_heating_target_mode
                state: 'off'
            sequence:
              - service: mqtt.publish
                data:
                  topic: zigbee2mqtt/Hive/heat/set
                  payload: |-
                    {
                      "system_mode":"off",
                      "temperature_setpoint_hold":"0"
                    }
          - conditions:
              - condition: state
                entity_id: input_select.hive_heating_target_mode
                state: 'heat'
            sequence:
              - service: mqtt.publish
                data:
                  topic: zigbee2mqtt/Hive/heat/set
                  payload: |-
                    {
                      "system_mode":"heat",
                      "temperature_setpoint_hold":"1",
                      "occupied_heating_setpoint":{{ states('sensor.hive_heating_target_temp') }}
                    }

Edit: forgot to add that my dash looks like this:

A combination of fold entity-row, entities cards, custom-hui-element cards and card-mod themes.

entities:
  - card_type: custom:fold-entity-row
    head:
      entity: automation.scheduled_heatpump
      state_color: true
      name: Schedule
    padding: 0
    type: custom:hui-element
    entities:
      - type: custom:hui-element
        card_type: entities
        card_mod:
          class: inline-card
        entities:
          - entity: schedule.upstairs_heat_pump
            state_color: true
          - entity: input_number.upstairs_ac_temp_set_heat
            name: AC Heat Set Temp
          - entity: input_number.upstairs_ac_temp_set_cool
            name: AC Cool Set Temp
          - entity: sensor.upstairs_heatpump_mode_required
          - entity: sensor.upstairs_climate_mode
  - card_type: custom:fold-entity-row
    head:
      entity: automation.upstairs_aircon_temperature_adjustment
      name: Auto Temperature Adjustment
      state_color: true
    padding: 0
    type: custom:hui-element
    entities:
      - type: custom:hui-element
        card_type: entities
        card_mod:
          class: inline-card
        entities:
          - entity: schedule.upstairs_ac_boost
            state_color: true
          - entity: input_number.away_or_in_bed_delta
          - entity: input_number.peak_rate_delta
          - entity: input_number.boost_delta
          - entity: sensor.upstairs_automatic_temperature
show_header_toggle: false
title: Upstairs
type: entities
card_mod:
  class: top-level-card
1 Like