I’ve put together a heating control system for my house using Home Assistant. This completely replaces any hardware thermostat, all decisions and schedules are done in software by the system. Since it took quite a lot of work, I thought I’d share it for anyone trying to achieve something similar. It all started from the solution on this page but I wanted a more flexible approach - however it was excellent to set the base to start from. The goal was also to have all configuration available in Lovelace GUI and no need to edit config files in order to change operational parameters.
- split the days in 4 time segments, separately for workdays and free days (morning, daytime, evening, nighttime)
- schedule different temperature levels for each time segment
- adjust the main thermostat based on the average temperature of all the rooms
- provide an override method for holiday/party mode
- automatic home/away mode switching based on presence detection
- automatic on/off switching based on outside temperature, weather forecast temperature, door/window opening sensors
I have my Home Assistant config set up using splitting method which I recommend anyone who wants to have a more flexible way of setting up things. Configuration items can be separated in sub-folders based on integration types, and they can be further split in multiple yaml files, which is great because if any config has to be excluded or temporarily taken out, all it takes is to rename the extension of the filename to something else and restart Home Assistant. I share my heating control solution in this layout - I’ve only left in the configuration items related to it. This way most of the things are self-explanatory.
- a switch to control the heater (something like Sonoff Mini running Tasmota or ESPHome firmware)
- temperature sensors in each room, and outdoors (for indoors I used Geeklink IR Bridge with an extra DS18B20 soldered on an punched out on the side of it - extra benefit that it can also control AC devices in the room but that’s a different story; for outdoors the same sensor on a Sonoff Dual switching my garden lights)
- weather forecast service set up in Home Assistant
- a device tracker integration to monitor for presence detection
- average custom component installed
- optionally simple thermostat card for the main thermostat in the frontend
- optionally some door/window opening sensors, configured in a group of binary sensors, to detect when any of them is open
Normally the user doesn’t have to deal with the main thermostat because it’s operation is fully automatic.
Each day is split into morning, daytime, evening, nighttime periods, the starting times for these can be set separately for workdays and free days. A workday binary sensor helps with this, because not only Saturdays and Sundays can be free, but also national holidays, vacations etc. configuring this properly makes the system aware of these. So all one has to do is to set the desired temperature levels for these periods and turn on the
Heating timer enable switch. As time passes, the system will automatically adjust the thermostat’s target temperature to the level corresponding to the time. With
Heating timer enable turned off, this will not happen. Whenever the switch is turned on, the system immediately checks for the current time and adjusts the temperature level to the corresponding time period.
Timer can be overridden with a separate
Heating override switch. It can be specified
Until when (with both date and time) to hold the override and return to the timer mode. This can be useful to have a fixed temperature level set regardless of the timing, and have it finish automatically after a deadline. Note that override applies to home/away and weather on/off automations too, so with this, away mode will not trigger, and the system will continue to operate regardless of presence and outdoor temperatures.
The system will automatically switch to away mode when the presence detection reports this. The thermostat configuration has a different temperature level set for away mode, and the schedules don’t run while away.
Monitoring both outside temperature and also weather forecast temperature helps turning off the system when it’s warm enough in the environment, thus saving precious energy.
Grab the source configs from here:
Read further down for the 2-zones version, multi-zones, rooms with multiple circuits etc.