Best way to set up a heating schedule for weekdays/weekends

Hi,

I’m looking for some inspiration on how to set up a schedule to control my thermostats with different settings for weekdays and weekends.
Currently I have created three input sliders for each thermostat to preset target temperatures for day, evening and night.
I have automations for “day”, “evening”, “night” that are triggered at specific times of day.
They read the slider values and set the corresponding target temperature for the thermostat.

Now I’m a little out of ideas how to elegantly add the weekday/weekend differentiation.
I could duplicate this whole set up to have a second set of sliders/automations for weekends, but I’m hoping for a better way…
Also, it would be cool to have a “switch” to override the setting - i.e. to switch to “weekend”-mode on bank holidays and to “weekday”-mode when I’m away for a day on a weekend.
What I’m missing is a way to select different actions within an automation, depending on some variable or component’s state.

Speaking of “modes”: the climate control has a set_away_mode service and a set_swing_mode service.
What are those for?

TIA,
Sebastian

you could make 1 set of sliders which gives the difference you want.

for example in the week you want durng the day 18 degrees, in the weekend you want it 22 degrees during the day.
you could then make the weekend switch on +4.

in the automations you could set different hours for weekend days.

if you make a switch for “like weekdays” then you can put in the automation for weekdays the condition “if switch is on” and in the weekendautomation you put “if switch is off”

i would advice you to read about appdaemon https://github.com/acockburn/appdaemon if you know a bit off python.
it would make youre automations a lot more flexible.

Thanks for your reply!
A static addition to the slider value for weekends would be one solution, but I’d like to have the sliders reflect the actual target temperature.
But, utilizing a “weekend switch” (input_boolean), I could update the slider values when the switch is put into “weekend mode”.
Good idea, thanks!

I’ll have a look at AppDaemon. I had a quick glance at the github page, but I still have no clue what it does.
I see it comes with a tutorial - that should clarify things.

Do you care to share your yaml code for this automation? This sounds exactly like what I want to implement, but I’m a bit unsure about how to set it up

Sure,

this one turns on “weekend mode”, either at 00:00:05 on Saturday or when manually turning on the input_boolean.weekend switch.

alias: 'Heating: Weekend Mode'
trigger:
  - platform: time
    hours: 00
    minutes: 00
    seconds: 05
  - platform: state
    entity_id: input_boolean.weekend
    from: 'off'
condition:
  - condition: or
    conditions:
    - condition: and
      conditions:
      - condition: time
        weekday:
          - sat
      - condition: state
        entity_id: input_boolean.weekend
        state: 'off'
    - condition: template
      value_template: '{{ trigger.platform == "state" }}'
action:
  - service: input_boolean.turn_on
    data:
      entity_id: input_boolean.weekend
  # office
  - service: input_slider.select_value
    data_template:
      entity_id: input_slider.heating_office_day
      value: 20
  - service: input_slider.select_value
    data_template:
      entity_id: input_slider.heating_office_evening
      value: 20
  [... set the sliders for all thermostats to their weekend values]

And this one turns on weekday mode on monday or when the weekend switch is turned off.

alias: 'Heating: Weekday Mode'
trigger:
  - platform: time
    hours: 00
    minutes: 00
    seconds: 05
  - platform: state
    entity_id: input_boolean.weekend
    from: 'on'
condition:
  - condition: or
    conditions:
    - condition: and
      conditions:
      - condition: time
        weekday:
          - mon
      - condition: state
        entity_id: input_boolean.weekend
        state: 'on'
    - condition: template
      value_template: '{{ trigger.platform == "state" }}'
action:
  - service: input_boolean.turn_off
    data:
      entity_id: input_boolean.weekend
#------------------------------------------------
  - service: input_slider.select_value
    data_template:
      entity_id: input_slider.heating_office_day
      value: 18
  [...]

With this you can switch on weekend mode even on a weekday, e.g. if you’re working from home.
It only switches back automatically in the night from Sunday to Monday.

I have another automation that sends me a message when Weekend Mode is active during a weekday, so I don’t accidentally leave it on.

Sebastian

Thanks!

But where do you set the target temps for the different rooms e.g. during the day? I’m thinking about lowering the temp to e.g. 17 between 7AM and 4PM, and then resetting the target temp in each room to whatever the target temp was before 7AM

Chris

I have sliders for every room, like this:

input_slider:
  heating_office_night:
    name: 'night'
    initial: 16
    min: 10
    max: 30
    step: 1
    icon: mdi:weather-night
  heating_office_day:
    name: 'day'
    initial: 18
    min: 10
    max: 30
    step: 1
    icon: mdi:weather-sunny
  heating_office_evening:
    name: 'evening'
    initial: 21
    min: 10
    max: 30
    step: 1
    icon: mdi:weather-sunset

The “initial” value specifies the default (but that’s also taking care of by appdaemon and the switch_reset app).

Additionally I have automations for day/evening/night that get triggered when the sliders are moved or when it’s “their time” to activate:

alias: 'Heating: Evening'
hide_entity: 'True'
trigger:
  - platform: time
    hours: 16
    minutes: 00
    seconds: 00
  - platform: state
    entity_id: input_slider.heating_livingroom_evening
  - platform: state
    entity_id: input_slider.heating_bedroom_evening
  - platform: state
    entity_id: input_slider.heating_office_evening
  - platform: state
    entity_id: input_slider.heating_bathroom_evening
  - platform: state
    entity_id: input_slider.heating_kitchen_evening
  - platform: state
    entity_id: input_boolean.venting
    state: 'off'
  - platform: state
    entity_id: input_select.housemode
    state: 'Evening'
condition:
  - condition: and
    conditions:
      - condition: or
        conditions:
          - condition: template
            value_template: '{{ 16 <= now().hour < 21 }}'
          - condition: state
            entity_id: input_select.housemode
            state: 'Evening'
      # don't switch modes while ventingmode is 'on'
      - condition: state
        entity_id: input_boolean.venting
        state: 'off'
action:
  - service: climate.set_temperature
    data_template:
      entity_id: climate.danfoss_z_thermostat_014g0013_heating_1_6_1
      temperature: '{{ states.input_slider.heating_kitchen_evening.state }}'
  [... repeat for all rooms ...]
  - condition: and
    conditions:
      - condition: template
        value_template: '{{ trigger.platform == "time" }}'
      - condition: state
        entity_id: input_select.housemode
        state: 'Evening'
  - service: input_select.select_option
    data:
      entity_id: input_select.housemode
      option: 'auto'	  

The bottom part with the conditions inside the action clause is to reset the house mode to “auto” when it was manually overridden. E.g. when I get home from work early and set the house mode to “Evening” although it’s just afternoon, the house mode will return to “auto” when the time for “Evening” is reached.
That way I don’t have the heating running all night, because I forgot to remove the house mode override (i.e. setting it back to “auto”).

Sebastian

ok thanks, I’ll give it a go, and then probably come back with some more questions:)

I shall be giving this a shot myself pretty soon after making my own boiler switch and sensor nodes out of ESP8266’s.

Sebastian, I don’t suppose you share your config on github do you? As it would make for a very interesting read!

Currently I don’t have my config shared anywhere.
I’ll put it on github if that would help - I’d need to remove any sensitive information first, though, so give me a day or so…
I’ve also been thinking about writing a few explanatory lines and add some screenshots, but I haven’t gotten around to it yet.

Sebastian

Here you go:

If you have any questions, just ask…

Sebastian

3 Likes

On top of everything that has already been said, you should consider the workday sensor, it’s a standard component in HA.
This is a binary sensor for workday or not. You can put in your location (country, state, province) and it automatically determines if it is a weekend, bank holiday etc

1 Like

Wow, thanks for the tip! This should be useful.
It’s the first time I hear about this sensor - must have missed it when it was introduced.

Sebastian

I’m also looking for some insight or examples to thermostat programming. I have a z-wave thermostat set up and a simple schedule to set the temperature.
The behavior I’m looking for is:

  1. I want to have a predefined set of target conditions (temperature, heat/cool, fan mode) based on day of week and time of day. If there is no other input, these conditions are set.
  2. If the setpoint (or any other parameter, such as the fan mode) is changed either at the physical thermostat or via the HA web interface, I want that condition to time out in a given time (e.g. 3 hours).

I’ve implemented a simple version that covers behavior 1. But not sure the best way to do behavior 2.
Input or advice appreciated!!

Hi,

I was reading this thread myself when I searched the web for a Plug & Play heating control system for Home Assistant.

I wrote one for AppDaemon and just wanted to link it here.

Maybe one of you finds it useful.

Best regards
Robert

1 Like

Thanks roschi! I’ll check it out.