Hi, today I’m going to tell you a story about the integration of your water heater/boiler in the smart home systems particularly Home Assistant. When I started I had no expertise in the heating systems at all. I was looking for a simple guide. I found none. Therefore, here I wanted to help those fellows who are lost in all the options.

The rationale of the climate system

My reasons for making choices are:

  1. I want to switch on the heating only when I am in the house.
  2. I don’t want to heat all the rooms if I’m not using them.
  3. I want to have efficient heating.
  4. I want to know what’s happening with my heating remotely.
  5. I want a heating system to be integrated into my smart home system.
  6. I want to have different parts independent from vendors so I can easily replace them.

Let’s look at these points one by one.

#1 – Switching the heating off when leaving a house

It can be easily solved with programmable thermostats if you are leaving to the office or for a vacation. Basically, most of the modern thermostats are have this feature.

Image result for honeywell touchscreen thermostat

It’s called a schedule. You configuring different days with a different schedule and your thermostat keep it automatically on or off.

#2 & #3 – Efficient heating and zones heating

There are several options on how to set up economically efficient and still comfortable climate ecosystem in all kinds of accommodation.

If you have central heating then you cannot control the boiler. That’s actually super great news. Your provider will arrange all the temperature control of the water (coolant saying properly). Basically, you outsource this headache and can make multiroom climate control almost straight away. As a simplest solution you can set a central heating inbound flow valve to the fully open state and then control different rooms with different smart radiator valves.

Example of the central heating inbound valve:

Please note: for some installations there’s a pump inside the apartment even with central heating. It constantly circulates the water in the system. It means that if you set you inbound valve to 100% you will consume maximum of the heating capacity with that pump. In other words, please be ready to pay insane amount of money.

No matter what boiler you have or central heating, your climate system consists of radiators in almost every room. These radiators are controlled by the valves. Normally it looks like a regular valve with a very regular knob:

Thermostatic Radiator Valves Including How to Fit a TRV and How to ...

Do you see digits on your radiator valve or some other kind of a scale? Then it’s a thermostatic radiator valve.

Classic Thermostatic Radiator Valve

The difference is that it can keep the temperature installed on the knob. The knob and the valve live together but they are different things. The knob has a controlling mechanism and a valve is controlled. Valves are quite standardized and knobs have gazillions shapes and forms. Knobs can be mechanical, wifi, zigbee, z-wave, etc.. Inside a mechanical knob, there’s a thermostatic element which behaves differently under the different temperature condition. This is special wax which gets bigger (closing a plug) if it’s hot and shrinks (open a plug) when it’s getting colder. With a knob turning left or right you just set some offset for this wax to shrink or expand. That’s all.

We were talking about radiators only. However, the same concept is in the warm floors. In the essence, this is a big flat radiator with a floor as a radiating surface. One of the main differences is that they are quite slow in heating. You can’t get them warm quickly either cold them down. They can be electrical or water-based. Electrical warm floors are actually quite simple in operation and installation. Water warm floors have a valve and a temperature sensor. They may be placed at a certain distance from each other.

That’s a demo stand of the whole system with warm floors and radiator:

Водяной теплый пол0

White knobs here that actually are the controlling valves in exactly the same way as you control your radiator. But as you can see here that warm floors don’t have any place where you can install a knob with a proper temperature reading. These knobs will be installed where this hub is located. The most common solution to this is to use an external temperature sensor and control these valves from some kind of a central unit. Just keep it in mind when you choosing a system.

This is some “real” life example of the warm floor system:

A black box on the wall is a central unit. It communicates with proprietary devices in rooms. Temperature in each room is controlled with this kind of devices:

#4 I want to know what’s happening with my heating remotely

This is an easy one. Whenever I’m away I want to connect somewhere and get digital control over the system state. Did I forget to switch it off? Is there too cold? I want to know. So here go all the smart stuff like smart thermostats and smart radiator valves. I will review them later on but the main idea is that you can approach your heating system from the perspective “I’m at home and want comfort” as well as from perspective “I’m away and want safety”.

#5 I want a heating system to be integrated into my smart home system

There are many of them and everyone has pros and cons. You don’t have it? Just leave it, it’s totally fine. But for myself, I put it as demand because I want to have a unified interface to control all my house appliances whatever that it’s.

#6 I want to have different parts independent from vendors so I can easily replace them.

This one is also about personal preferences rather than system efficiency. There are several options as usual:

  • Z-wave
  • Zigbee
  • Wifi
  • Vendor-locked solutions

First 3 are most likely interchangeable. The last one will cost you the whole price to replace the whole system if anything happened with a vendor

Off-the-shelf systems

If you want to choose a particular system for your home, you have to consider the following metrics:

  • do you need to control a boiler or not?
  • do you have warm floors?
  • do you want to integrate this system into your smart home?
  • do you want to pay a fee?
  • does it support connection-less operation?

There are plenty of options:

I did a careful consideration and decided that none of them would fit all my requirements as mentioned above. This decision led me to create the whole system based on a vendor-independent TRVs solution (z-wave) + custom maid electronic component for controlling a boiler.

Boiler

From top to bottom: the head of the whole system is a boiler. I have an almost generic boiler with OpenTherm support. It heats the water up. It can have different connection schemas, different sensors, special features like weather-based heating, and so on. It can be for your domestic hot water needs and/or house heating or just for one purpose.

Nonetheless, most likely it will operate on OpenTherm protocol so modern thermostats can precisely adjust boiler’s settings for current heating needs. These settings can be flame modulation, for example. However, this is still pretty new (like 20 years in operation) and not all the boilers support it yet.

Anyway, there’s a compatibility list from Tado about boilers which can be made smart: Compatibility Guide for the Smart Thermostat V3+

Dry contact

A predecessor of the OpenTherm was a guy called “dry contact”. It’s a super simple thing: just 2 wires from the boiler. If they are connected – the boiler heats the water, disconnected – do nothing. If you have an old boiler – none of the smart thermostats will make your system working the best and the option to use Opentherm Gateway (OTGW )is not for you. Apparently, OTGW needs an Opentherm boiler in order to work. You can use it without a thermostat but not with a boiler which doesn’t have Opentherm.

Keeping coolant temperature as set and return water temperature

Gas consumption will be quite high not only when you’re using heating but also when you don’t (relatively). The reason is that the boiler maintains the coolant temperature as set by measuring the temperature of the returning water. Your heating pipes also lose warm every second. These are my usage graphs from the last winter. From 8 AM to 4 PM heating wasn’t used in both graphs.

Here’s a graph when you let the boiler keep the temperature in the system at the desired level:

Here’s when it was turned off completely:

Just noticed a little glitch, day of the week is translated incorrectly. The first graph is ok (Wednesday), the second one is for Monday.

Flame modulation

Flame modulation is a parameter which shows how much gas is actually being burned. You can achieve a certain temperature by hitting full gas on and off (similarly to PWM in electronics), or keep it lower but for longer. There are certain research works were made about the flame modulation. For personal use, they are not like scientific research but something. For example, What is boiler modulation and boiler cycling?

Also, worth reading links about boilers efficiency in the house as well as in the city:

Thermostat

By definition, thermostat is a component which senses the temperature of a physical system and performs actions so that the system’s temperature is maintained near a desired setpoint. Thermostats are generally rather smart. It can control the temperature in the room quite precisely. Thanks to Opentherm it will set up a water heating setpoint based on the current temperature, execute continuous flame modulation, and do LOTS of other things to make sure that it heats the room at its best. However, I intentionally don’t use a word house. Because a thermostat is a single place system. You can find a more intelligent system like Plugwise, Tado, Netatmo, or any other but it will not be a single unit. . Using a simple room thermostat is super easy if it’s just 1 room. When there are more you need more thermostats, sensors, valve, or all together.

My thermostat is located in a bad place. It never gets warm enough and it’s only one for several rooms. So in the room where is my thermostat located, it’s almost always cold and other rooms are similar to sunny desert weather: very hot and dry. I could solve this problem by several options: set thermostat to maximum temperature (like 32°) and use TRV on each radiator in every room to control the temperature in the room. There nothing particularly wrong with except the boiler will heat the water all the time at the maximum flame. Say thank to the smart thermostat which is always thinking that the heating is not enough and will set flame modulation to 100% and a set point will be also somewhere like 80°. Trust me, you don’t want to have 80° radiators at your home. No even talking about gas consumption. I’m pretty sure you can restrict the maximum temperature but I’m not that sure that thermostat cannot override it with some of the OpenTherm features.

Implementation

So my initial intention was to get rid of a thermostat in this chain, control the boiler myself and different rooms separately. Basically, to build a central heating system.

Intervention into the control chain.

There are at least 2 boxed versions of the such device which can communicate to the boiler and expose control over the API:

OpenTherm Adapter

There’s nothing particularly wrong with this device and probably there are a lot of nice features. Like MQTT support and great extensibility. I found it much later than OTGW and therefore cannot say much.

OpenTherm Gateway (OTGW)

OTGW is a relatively old project with features like fault-safe design and visual control. It has been added to several smart home systems and quite popular. The most important for me was that OTGW can be integrated into Home Assistant via one of the native integrations. More importantly, is that you can order assembled device from certain suppliers or assembled it yourself. OTGW can work as in monitor mode (only data sniffing) or in a gateway mode when it overrides command to the boiler.

Disclaimer: If you are in the same position and looking at the possibility to build a similar system, please make sure that you read this information from the author of OTGW:

Considerations

Making a program to control the central heating may appear simple at first glance. But simply telling the boiler to start heating when the room temperature drops below the desired temperature and shutting it off when it reaches the setpoint again won't work very satisfactory. That method will result in large temperature swings, because a central heating system inherently has a big response delay.

So the controlling program has to account for the time and amount the temperature will continue to rise or fall after the boiler has been switched off or on. To make things worse, those figures are influenced by external factors like outside temperature, open or closed doors and windows, curtains being drawn, other heat sources, hot water use, etc.

In addition to keeping the temperature as constant as possible there's also the matter of doing it in the most energy efficient way. Modern boilers are generally most efficient at low temperatures. So, when maintaining a desired room temperature it may be wasteful to use relative short burns with a high control setpoint rather than longer burns with a lower control setpoint.

Finally there's the matter of reliability. If the controlling program crashes, or the system running the program decides to reboot and install patches after the control setpoint has been set to 80 degrees, the house may get quite warm.

Keeping that in mind, I started designing a heating system based on OTGW.

OTGW in Home Assistant

OpenTherm Gateway provides you with a software called OTMonitor. It can be used for monitoring, apparently, but also for operating in a gateway mode.

This software has MQTT operation, and web server, and a lot of other stuff. However, I personally found it difficult to use. Despite that this is an opensource software I couldn’t jump straight into the sources to navigate over the project. The reason is that it’s written in not that popular language (Tcl) with a small community and limited support. Nonetheless, you can use this software to communicate with your boiler over the MQTT messaging. There’s an addon for Home Assistant.

Moreover, OTGW is integrated into Home Assistant with native integration. Under the cover, it uses a library called pyotgw. This is an implementation of the OpenTherm protocol on top of OTGW serial port communications. This works well but not perfect and I would love to discuss a few things you might want to know.

Switch heating on

First of all, you would love to know what are the current settings. This can be done via a sensor from the native integration. It’s called Control Setpoint %connected_otgw_name%:

If this is not searchable in the states, please make sure that you enabled this entity from the integration page. You can do that by navigating to Integrations->OpenTherm Gateway->selecting your gateway name. You should see a window similar to that:

At the very bottom a button “N disabled entities”. My set of enabled entities are the following:

  • binary_sensor.master_ch_enabled_otgw_unit
  • binary_sensor.slave_ch_active_otgw_unit
  • climate.otgw_unit
  • sensor.burner_hours_otgw_unit
  • sensor.ch_water_pressure_otgw_unit
  • sensor.ch_water_temp_otgw_unit
  • sensor.control_setpoint_otgw_unit
  • sensor.dhw_setpoint_otgw_unit
  • sensor.dhw_temp_otgw_unit
  • sensor.otgw_dhw_ovrd_otgw_unit
  • sensor.otgw_mode_otgw_unit
  • sensor.relative_mod_level_otgw_unit
  • sensor.return_water_temp_otgw_unit
  • sensor.room_setpoint_otgw_unit
  • sensor.room_temp_otgw_unit
  • sensor.slave_max_relative_modulation_otgw_unit

Before started doing anything, I integrated OTGW and was just observing boiler’s behavior for several days.

For justification purposes, I will assume that central heating (CH) must be enabled when it’s needed and only. First, you need to turn it on. This is a very simple thing to do. You can refer to the documentation and find SET_CONTROL_SETPOINT. This is a service which would be available in Home Assistant:

However, please be cautious, in the same documentation you can find the following:

Due to the potential consequences of leaving this setting enabled for prolonged periods, the override will be disabled when Home Assistant is shut down or restarted

For me, fall/winter is the usual time when I do most of my smart home projects and this involves restarting Home Assistant quite frequently. So the first thing I did was to create a “digital twin” for a CH setpoint and sync the state regularly.

boiler_water_setpoint_input:
  name: Boiler water setpoint
  min: 0
  max: 65
  step: 1
  mode: box

Now, sync is simple time-based automation:

- id: boiler_water_set_to_the_variable_level
  alias: Update boiler setpoint
  condition: 
    - condition: state
      entity_id: input_boolean.house_heating
      state: "on"
  trigger:
    platform: time_pattern
    # This will match every 1 minutes
    minutes: "/1"
  action:
  - service: opentherm_gw.set_control_setpoint
    data_template:
      gateway_id: otgw_unit
      temperature: "{{ states('input_number.boiler_water_setpoint_input') | int }}"

Some alerting for polishing:

- id: high_boiler_temperature
  alias: Boiler water temperature alarm
  condition: 
    - condition: state
      entity_id: input_boolean.house_heating
      state: "on"
  trigger: 
    platform: numeric_state
    entity_id: sensor.ch_water_temp_otgw_unit
    above: 75
  action:
    service:  notify.telegram_smarthome
    data_template:
      message: "Boiler water temperature is high: {{states('sensor.ch_water_temp_otgw_unit')}}"

Switching off all heating

As you may notice, there’s no such thing as a switch. The system operates over the temperature override. If the override is set to something different than 0 – heating is enabled. If set to 0 then override is disabled. If override is disabled then control returned back to the thermostat. What does that mean? It means that from now on your thermostat will start instructing boiler over the water temperature and maximum flame modulation. In order to avoid confusion, I set my thermostat to antifrizing temperature at 14°C. This allows me to switch off all the heating with just disabling override. Moreover, now I’m sure that in the worst scenario I won’t get a freezing room if I left for a vacation, for example. In the pyotgw library, a certain functionality exists to make this mechanism more straightforward. Particularly, you can use a method called set_ch_enable_bit which would set a bit responsible for enabling/disabling central heating. Initially, I tried to make use of it but I couldn’t find it convenient.

Room thermostats

For room thermostats I chose Devolo TRVs. It’s essentially a tweaked version of the Danfoss LC13 which includes temperature reporting.

I enjoyed them pretty much. Battery life is something about a heating season but I do change batteries every 2-3 month just for my patience. It works on Z-Wave. From the moment you set it in Home Assistant it can take up to 5 minutes to sync to the device but I’m quite sure it’s related to battery life optimization and it wasn’t really a problem for me for the 2 years of usage.

Other things to consider

House heating is complicated. You have to think about not only about making it warm but also about keeping it warm. Roof insulation, window’s double glazing, floor isolation, and this is not a finished list. You can tune your radiators as well. Radiators can consume more water/heat because of the different conditions and that would lead to smaller or bigger gas consumption. This post is written not because I want to encourage you to do the same. It’s exactly the opposite. If you feel confident and can spend time and money – it worth trying. Otherwise, just pick one out-of-the-box solution and you must be fine. They would provide you with more efficient heating control straight away and don’t cost much.

P.S. you still can contact me via all possible means.