User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
homeautomation:heating [2024/12/11 17:05] – [My heating system] willyhomeautomation:heating [2025/03/13 14:55] (current) – [The smart solution] willy
Line 1: Line 1:
-====== Smart Heating ======+====== B) Smart Heating ======
  
 Your home, most probably, has some kind of heating system for those months of the year when the outside temperature is too low to be comfortable. At least, in most of the world, every home has some kind of heating system. Of course, then, why don't we make it smart? Your home, most probably, has some kind of heating system for those months of the year when the outside temperature is too low to be comfortable. At least, in most of the world, every home has some kind of heating system. Of course, then, why don't we make it smart?
Line 6: Line 6:
  
 Let me describe my heating approach and how my home heating system is structured, so the following will be easier to understand. Please consider that this is a complex matter, and many of the issues i have encountered over the years can be different from your experience, because every heating system is different, and mine is indeed a bit unique. Let me describe my heating approach and how my home heating system is structured, so the following will be easier to understand. Please consider that this is a complex matter, and many of the issues i have encountered over the years can be different from your experience, because every heating system is different, and mine is indeed a bit unique.
 +
 +====== Key concepts ======
 +
 +Here is a list of key concepts useful for the topic at hand.
 +
 +**eco temperature**: the temperature to use at night, or when nobody at home, or whenever you want to //save// on heating.
 +
 +**comfort temperature**: the temperature you want your room to have when you are in the room, or in general, you consider comfortable to stay in.
 +
 +**boiler**: with this word, i will indicate an heater generator. It could be a gar boiler, a wood pellet boiler, or whatever means you have to heat your home (heat pump...)
 +
 +**wood pellet boiler**: a specific heat generator that uses //wood pellets// as fuel, and it's directly connected to your radiators or radiating floors. This is usually like a wood/coal furnace, but more automated and can autofeed during the day. It comes with a few caveats, like needs a dedicated water circuit, has limitations on maximum water temperature, and must be refueled periodically (daily, weekly...) in order to keep working. 
  
 ==== My heating system ==== ==== My heating system ====
Line 13: Line 25:
 The house itself has radiators in every room, while floor heating is a trend now, i didn't installed it when i moved in for various reasons. My heating system is pretty complex because i have both a gas boiler and a wood pellet (=pellet) boiler. As it is customary in these cases, the gas boiler is directly installed on the radiators water circuit, while the pellet boiler has a dedicated water circuit and a copper heat exchange is in charge, coupled with a dedicated circulation pump, to heat the radiator water circuit and, well, circulate it when the gas boiler is off. The house itself has radiators in every room, while floor heating is a trend now, i didn't installed it when i moved in for various reasons. My heating system is pretty complex because i have both a gas boiler and a wood pellet (=pellet) boiler. As it is customary in these cases, the gas boiler is directly installed on the radiators water circuit, while the pellet boiler has a dedicated water circuit and a copper heat exchange is in charge, coupled with a dedicated circulation pump, to heat the radiator water circuit and, well, circulate it when the gas boiler is off.
  
-This solution is pretty complex and requires a lot of logic to function properly, i will add a schema soon.+This solution is pretty complex and requires a lot of logic to function properly, here is very simple schema of it all: 
 +{{ :homeautomation:heating_system_rid.svg |}} 
  
   * When the gas boiler is on, it's internal pump will circulate the water in the radiators, and that's pretty simple.   * When the gas boiler is on, it's internal pump will circulate the water in the radiators, and that's pretty simple.
Line 30: Line 44:
 At first i went fully //traditional//. I placed an old fashioned thermostat (actually, two), run the wires from those to a nice set of switches that i manually switched to choose gas or pellet, plus a pretty complex approach with relays and such amenities to control the pump. At first i went fully //traditional//. I placed an old fashioned thermostat (actually, two), run the wires from those to a nice set of switches that i manually switched to choose gas or pellet, plus a pretty complex approach with relays and such amenities to control the pump.
  
-I quickly moved to a //smarter// self-made approach using an [[http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-Zero.html|OrangePi Zero]] board with a few 12v relays, a 1wire igro-thermometer and wrote a custom dedicated software composed of a C++ backend and a Javascript frontend to replace most of the original solution. I kept the 220v relay to start the pump, and that's it. This brought a very nice improvement, since i was able to control and check my heating system from the web.+I quickly moved to a //smarter// self-made approach using an [[http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-Zero.html|OrangePi Zero]] board with a few 12v relays, a 1wire igro-thermometer and wrote a custom dedicated software composed of a C++ back-end and a Javascript front-end to replace most of the original solution. I kept the 220v relay to start the pump, and that's it. This brought a very nice improvement, since i was able to control and check my heating system from the web.
  
 The //smarter// solution worked fine for a few years. I improved the software and the logic behind it a few times, until i discovered Home Assistant and ZigBee devices, now new amazing opportunities where available! The //smarter// solution worked fine for a few years. I improved the software and the logic behind it a few times, until i discovered Home Assistant and ZigBee devices, now new amazing opportunities where available!
Line 41: Line 55:
 To achieve this solution, unless your house has already been equipped with a thermostat in every room (mine wasn't) and unless your heating system has every room separated with electro-valves (mine wasn't), ZigBee and Home Assistant will come to the rescue. ZigBee is an amazing wireless system that can connect many //smart// objects that can then be controlled via automation in Home Assistant.  To achieve this solution, unless your house has already been equipped with a thermostat in every room (mine wasn't) and unless your heating system has every room separated with electro-valves (mine wasn't), ZigBee and Home Assistant will come to the rescue. ZigBee is an amazing wireless system that can connect many //smart// objects that can then be controlled via automation in Home Assistant. 
  
-I have replaced all (most, actually) of the valves of the radiators with ZigBee controller valves (so called thermostat valves), and added in each room a dedicated ZigBee thermometer in a logical place to measure effective temperature. In fact, the all-in-one thermostat-valves suffer from a common issue of having the thermometer too close to the radiator itself. While you can control this by setting an offset to the measurement, it doesn't work well specially when there is not a good airflow nearby, like when the radiator is behind a curtain or near furniture. The solution is to add a separate thermometer, then use a Home Assistant blueprint to automatically adapt the thermostat-valve offset.+I have replaced all (most, actually) of the valves of the radiators with ZigBee controlled valves (so called thermostat valves), and added in each room a dedicated ZigBee thermometer in a logical place to measure effective temperature. In fact, the all-in-one thermostat-valves suffer from a common issue of having the thermometer too close to the radiator itself. While you can control this by setting an offset to the measurement, it doesn't work well specially when there is not a good airflow nearby, like when the radiator is behind a curtain or near furniture. The solution is to add a separate thermometer, then use a Home Assistant blueprint to automatically adapt the thermostat-valve offset.
  
 Now i have Home Assistant, trough ZigBee thermostat-valves, which takes care of turning on and off the heating in each room independently. In addition, Home Assistant can also be used to define a schedule (under devices -> helpers) that can be used to define times of the day / week when you want the heating to be on, or off. Now i have Home Assistant, trough ZigBee thermostat-valves, which takes care of turning on and off the heating in each room independently. In addition, Home Assistant can also be used to define a schedule (under devices -> helpers) that can be used to define times of the day / week when you want the heating to be on, or off.
Line 51: Line 65:
   * Each thermostat-valve has it's offset corrected automatically using a dedicated thermometer trough a blueprint   * Each thermostat-valve has it's offset corrected automatically using a dedicated thermometer trough a blueprint
   * This information can be collected and sent to the OrangePi Zero to actually control the heat generators.   * This information can be collected and sent to the OrangePi Zero to actually control the heat generators.
-  * The OrangePi Zero controls the generators turning them on or off depending on the Home Assistant conmmand.+  * The OrangePi Zero controls the generators turning them on or off depending on the Home Assistant command.
  
 In theory, by using dry-contact ZigBee relays i could skip the OrangePi, but implementing the logic behind to properly manage both generators, including the dedicated pump and the various emergency conditions is something i have not yet moved to Home Assistant, so i am still using the OrangePi with it's relays, i just simplified and rewrote the custom software backend. In theory, by using dry-contact ZigBee relays i could skip the OrangePi, but implementing the logic behind to properly manage both generators, including the dedicated pump and the various emergency conditions is something i have not yet moved to Home Assistant, so i am still using the OrangePi with it's relays, i just simplified and rewrote the custom software backend.
Line 68: Line 82:
 === Creating the schedule & main temperature set === === Creating the schedule & main temperature set ===
  
-Device -> helpers -> create a new schedule (TBD)+Create a schedule to control when during the day and the week you want your home to be in a **comfort** temperature, or al **eco** temperature. This schedule will be the base on which your heating will be activated or deactivated. This same schedule is also used to decide when to use the pellet boiler and when to use only the gas boiler in conjunction with two dedicated toggles, described below. 
 + 
 +Go to: 
 +  * Settings -> Devices -> helpers -> create a new schedule 
 + 
 +You could create more than one schedule then use a selector connected to the blueprint below to choose between the scheduler. 
 + 
 +Now, also create two numeric helpers to define the **eco** and the **comfort** temperatures. 
 + 
 +Go to: 
 +  * Settings -> Devices -> helpers -> create two new numeric values 
 + 
 +I called them **eco temperature** and **comform temperature**.
  
  
Line 88: Line 114:
 === Commanding the generators  === === Commanding the generators  ===
  
-The basic logic is simple: whenever at least ONE thermo-valve is open (heating), the generators should be operative. Only when ALL the thermo-valves are closed (idle), then the generators can be turned off (actually the pellet is not turned on or off, but switched from minimum to modulation...).+The basic logic is simple: whenever at least ONE thermo-valve is open (heating), the generators should be operative. Only when ALL the thermo-valves are closed (idle), then the generators can be turned off (actually the pellet is not turned on or off, but switched between minimum to modulation...).
  
-The point now is how to connect Home Assistant with the OrangePi Zero... Well, using [[homeautomation:mqtt|MQTT]] of course! So, setup your Mosquitto broker as defined in the link on Home Assistant. +The point now is how to connect Home Assistant with the OrangePi Zero... Well, using [[homeautomation:protocols:mqtt|MQTT]] of course! So, setup your Mosquitto broker as defined in the link on Home Assistant. 
  
-I have rewritten the OrangePi Zero code to become an MQTT client and connect to the Home Assistant broker, this is pretty simple following the Mosquitto documentation and example code. In the future, i will post the code i am using.+I have rewritten the OrangePi Zero code to become an MQTT client and connect to the Home Assistant broker, this is pretty simple following the Mosquitto documentation and example code. 
  
-So, let's assume we have the //MQTT topic// **heating/consensus**, which will be **true** if the generators shall produce heat, or **false** otherwise. You can use the following automation script to automatically publish the topic when the termostat-valves state change:+The code to my dedicated control software is published [[https://github.com/gardiol/pithermo|here]] under the GPLv3 license. 
 + 
 +The choice between heating with the gas or the pellet boiler, or both, is controlled by two dedicated Home Assistant toggles (create them from settings -> devices -> helpers): 
 +  * **use_pellet** toggle: if true, pellet boiler is used, if false, gas boiler is used 
 +  * **quick heat** toggle: if true, gas boiler will be turner on together with the pellet boiler. This is important because the pellet boiler will take up to one hour before it's startup phase is over and the hot water start circulating. Activating the gas boiler too will speed up initial warming of the house (the safety measures inside the OrangePi will take care to turn the gass off once the pellet is hot) 
 + 
 +The key point here is that when in eco mode (at night, and such...) only the gas boiler will be used for heating. Instead, the bulk of the comfort heating will be done with the pellet boiler, or the gas boiler (for example, when away from home for a few days and the pellet tank will be empty).   
 + 
 +I choose to chain the toggles together with the thermostat-valves states to send the associated MQTT topic to the OrangePi so that all the topics will be published together. Better send the information twice, than forget about it once. 
 + 
 +So, let's assume we have the //MQTT topics// **heating/consensus**, **heating/usegas** and **heating/usepellet**. You can use the following automation script to automatically publish the topics when the termostat-valves and toggles state change:
  
 <code yaml> <code yaml>
-alias: Send Heating consensus to OrangePi Zero +alias: Send topics to OrangePi 
-description: publish topic+description: Send heating topics
 triggers: triggers:
 +  - trigger: state
 +    entity_id:
 +      - sensor.termo_bathroom_hvac_action
 +  - trigger: state
 +    entity_id:
 +      - sensor.termo_kitchen_hvac_action
   - trigger: state   - trigger: state
     entity_id:     entity_id:
Line 105: Line 147:
   - trigger: state   - trigger: state
     entity_id:     entity_id:
-      - sensor.termo_bathroom_hvac_action+      - input_boolean.use_pellet
   - trigger: state   - trigger: state
     entity_id:     entity_id:
-      - sensor.termo_bedroom_hvac_action+      - input_boolean.quick_heat 
 +  - trigger: state 
 +    entity_id: 
 +      - schedule.my_heating_schedule
 actions: actions:
   - action: mqtt.publish   - action: mqtt.publish
     data:     data:
       payload: >-       payload: >-
-        {{  is_state('sensor.termo_livingroom_hvac_action', 'heating') or  +        {{  is_state('sensor.termo_bathroom_hvac_action', 'heating') or  
-        is_state('sensor.termo_bathroom_hvac_action', 'heating') or +        is_state('sensor.termo_kitchen_hvac_action', 'heating') or 
-        is_state('sensor.termo_bedroom_hvac_action', 'heating') }} +        is_state('sensor.termo_livingroom_hvac_action', 'heating') }} 
-      topic: heating/consensus+      topic: heating/feedback 
 +      retain: true 
 +  - action: mqtt.publish 
 +    metadata: {} 
 +    data: 
 +      evaluate_payload: false 
 +      qos: 0 
 +      retain: true 
 +      topic: heating/usegas 
 +      payload: |- 
 +        {{  is_state('input_boolean.use_pellet', 'off') or 
 +        is_state('input_boolean.quick_heat', 'on') }} 
 +  - action: mqtt.publish 
 +    metadata: {} 
 +    data: 
 +      evaluate_payload: false 
 +      qos: 0
       retain: true       retain: true
 +      topic: heating/usepellet
 +      payload: "{{  is_state('schedule.my_heating_schedule', 'on') }}"
 mode: single mode: single
 </code> </code>
Line 123: Line 186:
 Of course you need to specify all the thermo-valves here. You should check under //Developers -> states// exactly which states your thermostats use. Usually, it should be under the entity //hvac_action// of the thermostat, but you need to check as YMMV for different devices, maybe, i have no idea. Of course you need to specify all the thermo-valves here. You should check under //Developers -> states// exactly which states your thermostats use. Usually, it should be under the entity //hvac_action// of the thermostat, but you need to check as YMMV for different devices, maybe, i have no idea.
  
 +=== Feedbacks from the heating system to Home Assistant ===
  
-=== Future steps  === +Since like to keep everything under control, the OrangePi custom software will publish a status MQTT topic reporting if the gas boiler, the pellet boiler are on or off, and if the pellet boiler water output is hot or cold.
- +
-Currently have no way to //choose// whether to use gas or pellet from Home Assistantthis is something i will work on in the future. Currently the old program on the OrangePi Zero must be used to that extend, i know this is not optimal. +
- +
-Maybe i could remove the OrangePi Zero altogether using some ZigBee relaysor maybe coupling ZigBee switches with the relays i have today. This would require to rewrite in Home Assistant the logic between switching the generators and the various protection logic. +
- +
-I also need to publish my code for the backend and the frontend on the OrangePi Zero so you can check it out and copy if needed. +
  
 +This can be achieved by adding the following custom YAML lines inside your **configuration.yaml** file:
 +<code yaml>
 +mqtt:
 +  binary_sensor:
 +    - name: "Pellet_status"
 +      state_topic: "heating/pellet_status"
 +      device_class: "power"
 +      value_template: "{{ value_json.on }}"
 +      payload_on: 1
 +      payload_off: 0
 +      unique_id: "pellet_on"
 +    - name: "Pellet_hot"
 +      state_topic: "heating/pellet_hot"
 +      device_class: "heat"
 +      value_template: "{{ value_json.hot }}"
 +      payload_on: 1
 +      payload_off: 0
 +      unique_id: "pellet_hot"
 +    - name: "Gas_status"
 +      state_topic: "heating/gas_status"
 +      device_class: "power"
 +      value_template: "{{ value_json.on }}"
 +      payload_on: 1
 +      payload_off: 0
 +      unique_id: "gas_on"
 +</code>
  
  
 +==== Future steps  ====
  
 +Maybe i could remove the OrangePi Zero altogether using some ZigBee relays, or maybe coupling ZigBee switches with the relays i have today. This would require to rewrite in Home Assistant the logic between switching the generators and the various protection logic.
  
  
  
  
-=== Smart thermostatic valves === 
-Thermostatic valves are valves that will open or close the flow of hot water in your heating elements according to a set temperature. Smart thermostatic valves are exactly the same kind of valves, but in addition they can be controlled remotely. This means not only set the temperature, but also open and close them remotely. 
  
-This is pretty interesting, because one of the issues with this kind of valves is having the controlling thermostat inside the valve, which is located, of course, very close to the heating elements. This creates issues with airflow and pockets of heat that will falsify the readings of the valve itself. The best approach would be to place the thermometer on the opposite side of the room, and this is there home automation comes into play. 
  
  
  
-You will need to take care that: 
-  * The gas furnace is turned off when the pellet generator manifold is hot, or the pellet generator will not dissipate it's heat and will result in a forced shutoff. 
-  * The additional circulation pump is turned on when the pellet generator manifold is hot, or the hot water will not actually reach the rooms 
-  * The gas furnace is turned on if the pellet generator fails to start, which can happen sometimes 
  
  
  
  

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information