[HELP] Build controller home and boiler heating

  • Platform information:
    • Hardware: Raspberry Pi3 Model B rev. 1.2 with 32Gb MicroSD
    • OS: Linux 6.1.21-v7+
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 4.0.4

Hello everyone!

First of all, I apologize if in this topic I raise questions that were previously asked by someone. I honestly tried to find similar situations, but unfortunately I didn’t find solutions suitable for me ((

Preface:
I am making a controller for controlling home heating and heating the boiler (and other consumers of thermal energy).
The source of thermal energy is vacuum solar collectors.
A backup source of thermal energy is also provided.

Structurally, this is implemented simply: the main data sources, temperature sensors DS18B20, are connected to the Raspberry Pi3 running OpenHab ver.4.0.4 via GPIO via a 1-Wire bus, the RPi output controls a group of relays that control power to circulation pumps and solenoid valves (control the movement/ supply of heat carrier in the system).

I successfully connected temperature sensors and relays to OpenHab: data from the sensors is displayed, relays are turned on and off through the switch functionality.
Temperature sensors in the OH are configured via OneWireGPIO Binding.
The relays in the OH are configured via GPIO Binding/Pigpio Remote.

Estimated logic of operation and functionality of the controller:

0. I want to heat the room and/or boiler to the desired temperature. The controller controls the system using automatic modes or manual functions to achieve these goals.

1.

5 temperature sensors are used:

  • tSC (measure the temperature of the Solar Collector, use the data in algorithms)
  • tWT (measure the temperature of the Water Tank, use the data in algorithms)
  • tRoom (we measure the temperature in the Room, use the data in algorithms)
  • tBL (measure the boiler temperature, use the data in algorithms)
  • tOutdoor (we measure the temperature outside, we use the data as information)

Several relays are used to control power:

  • several valves
  • Pump 1 for circulation of heat carrier in the system
  • Pump 2 for supplying heat carrier to a backup source of thermal energy

2.Control heating of the room and/or boiler through several (more than 10) Modes/Rules, which are functionally implemented in various options for the direction of movement of the heat carrier in the system.

Examples:
“Mode 1” (SC-WT-R-U) - with thermal energy from the solar collector (SC) we heat the Water Tank (WT, heat carrier), we heat the room heating radiators (R), we heat the heat exchanger to dissipate excess heat (Utilizer, U ).
Functionally, this is realized by turning on the power relay for the heat carrier circulation pump (Pump 1), as well as turning on several other relays that turn on the heat carrier supply valves on WT, R, U.

“Mode 2” (SC-R-BL) - with thermal energy from the solar collector (SC) we heat the room heating radiators (R), we heat the boiler (BL).
Functionally, this is realized by turning on the power relay for the heat carrier circulation pump (Pump 1), as well as turning on several other relays that turn on the heat carrier supply valves on R, BL.

3. Have the concepts of “Seasons” (Winter/Spring/Summer/Autumn), each of which has a set range (example

range for “Winter”: from 00:00:00 01.12.YYYY to 23:59:59 28.02.YYYY,
range for “Spring” from 00:00:00 01.03.YYYY to 23:59:59 31.05.YYYY,
range for “Summer” from 00:00:00 01.06.YYYY to 23:59:59 31.08.YYYY,
range for “Autumn” from 00:00:00 01.09.YYYY to 23:59:59 30.11.YYYY).

Depending on which season range corresponds to the current time and date, the controller works with those modes that are allowed for the current season.

Example:
for the “Summer” season, “Mode 1” (SC-WT-R-U) is allowed, “Mode 2” (SC-R-BL) is prohibited.
for the “Winter” season, “Mode 2” (WT-R-BL) is allowed, “Mode 1” (SC-WT-R-U) is prohibited.

4. Have the concepts of “Part of the day” (Morning, Day, Evening, Night), each of which has a set range (example

range for “Morning” from 05:00:00 to 06:59:59,
range for “Day” from 07:00:00 to 17:59:59,
range for “Evening” from 18:00:00 to 21:59:59,
range for “Night” from 22:00 to 04:59:59).

Depending on which time of day range corresponds to the current time and season, the controller operates with those modes that are allowed for the current time of day and season.

Example:
for “Night” “Mode 3” (WT-BL) is allowed, for “Morning”, “Day”, “Evening” is prohibited, allowed for all seasons,
for “Night” and “Day” “Mode 11” (SC-WT-R) is allowed, for “Morning”, “Evening” it is prohibited, for the seasons “Spring” and “Autumn” it is allowed, for the seasons “Winter” and “Summer” " is prohibited.

5. Have a state switch for “Home habitability” (“Inhabited”, “Uninhabited”) in the form of a Switch in the interface, which determines the list of modes allowed for operation.

Example:
for a switch in the “Uninhabited” state, only the mode is allowed “Mode 1” (SC-WT-R-U). This mode is the only one available for this condition.
for a switch in the “Inhabited” state, “Mode 1” (SC-WT-R-U) is allowed, but provided that tSC>tSC-max and/or tBL>tBL-max, and all other embedded modes are allowed (Mode 2 , Mode 3…and others).

6. Have a “Manual” or “Auto” state switch in the form of a Switch in the interface, which determines the control mode of the controller by the system.

Example:
For a switch in the “Manual” state, the user can forcefully enable any mode included in the controller program.
For a switch in the “Auto” state, the controller controls the inclusion of modes automatically, in accordance with the established algorithms/conditions.

7. Have a switch for the “Room heating” mode. For example, “Mode 7”. Its purpose is forced heating of heating radiators from an alternative source of thermal energy. This mode must be available for activation by the user when the controller is in the “Auto” state, regardless of the mode currently running.

In action, when this mode is turned on, the functionality of setting the countdown timer and its activation should be displayed with the launch of “Mode 7”, during which this mode will operate. After the timer expires, “Mode 7” is turned off and the Mode that preceded the activation of “Mode 7” is activated. Then the controller operates in automatic mode.

8. Have a switch for the “Boiler heating” mode. For example, “Mode 8”. Its purpose is forced heating of the boiler from an alternative source of thermal energy. This mode must be available for activation by the user when the controller is in the “Auto” state, regardless of the mode currently running.

In action, when this mode is turned on, the functionality of setting the countdown timer and its activation should be displayed with the launch of “Mode 8”, during which this mode will operate. After the timer expires, “Mode 8” is turned off and the Mode that preceded the activation of “Mode 8” is activated. Then the controller operates in automatic mode.

9. Have in the front-end interface the main functionality of controlling the controller and information display/icons:

  • setting buttons (“-”,“numerical value”,“-”) room heating temperature (tRoom-set)
  • button to turn on forced room heating with timer countdown indication
  • button to turn on the forced heating of the boiler with a timer countdown indication
  • indication of current time and date
  • indication of actual room temperature (tRoom)
  • indication of the actual boiler temperature (tBL)
  • indication of the actual temperature outside (tOutdoor)
  • information about the current Season
  • information about the current Part of the day
  • information about the current status of the house habitability switch (Inhabited or Uninhabited)
  • information about the current status of the controller mode switch (Manual or Auto)
  • information about the current Mode/Rule of operation of the controller

10. Have convenient settings functionality and indication of main parameters in the backend interface:

  • setting the hysteresis value tSC/tSC-max
  • setting the hysteresis value tWT/tWT-max
  • setting the hysteresis value tBL/tBL-max
  • setting the hysteresis value tRoom/tRoom-set
  • setting the tSC-max value
  • setting the tWT-max value
  • setting the tBL-max value
  • indication of the actual temperature of the solar collector (tSC)
  • indication of actual Water Tank temperature (tWT)
  • setting ranges for the concept “Seasons”
  • setting ranges for the concept “Part of the day”
  • state switch for “Home habitability” - “Inhabited” or “Uninhabited”
  • controller mode switch “Manual” or “Auto”

Forgive me if I’m boring you with such a long preface)), but I tried to present my thoughts on the planned project as thoroughly and systematically as possible, and now on my many questions:

1. Based on the description above, tell me how to correctly build a hierarchy of actions in OH when implementing everything planned? Where to start, what follows what? Step by step, if you don’t mind.
2. How to create the concept of “Seasons”?
3. How to make the concept “Part of the day”?
4. How to make “Modes” (Rules)? At least with 1-2 examples.
5. How to make a “Home Habitability” state switch?
6. How to make a “Manual” or “Auto” state switch?
7. How to make a switch for Mode 7 “Room heating”? Using his example, I will understand how to make a similar switch for Mode 8 “Boiler heating”.
8. How to make a frontend interface?
9. How to make a backend interface?

I would appreciate any help! :slight_smile:

I for one would much rather have too much information than not enough information.

This is very detailed in the requirements and definitely going to be achievable. However, it’s not going to be easy so I recommend starting small and gradually building it up. Come up with your minimal end to end thread and implement that. Then build on that adding in more and more.

A system like this is often best implemented using a state machine. 0-8 are your top level states. So your overall rules logic is going to mainly be involved with transitioning between those modes for the other modes. Under what conditions/states/events are a state transition required? Approach it from that and then the rest becomes just sending the right commands to the right devices.

Start small. Get the relays and sensors into OH. Experiment with how to command them and how the states are updated manually. Follow the Getting Started Tutorial for how to get an end-to-end thread going. As you learn it will become apparent how to proceed.

The Astro binding has a Channel that tells you the seasons. What to do during that season can be encoded using Items or Item metadata.

But this should be one of the last things you look at implementing. Get the basics working first.

I recommend Time Based State Machine [4.0.0.0;4.9.9.9] and/or Timeline picker to setup heating, light and so on.

It’s going to be driven by the details. See Rules | openHAB and Rules - Introduction | openHAB (which includes more than 1-2 examples) for generic details.

I see no reason why these cannot be implemented with basic and Blockly Rules. You don’t need to get into heavy coding I think.

I would probably start with creating Scenes (Settings → Scenes) with the states of all the Items for each mode. Then work on Rules that implement the state transitions through the rule triggers and conditions. That will work to get you started but eventually you’ll probably need to be more dynamic and you’ll move the Scenes into a Script Action in the Rules where you can calculate the commands to the Items instead of hard coding them in the Scenes.

It’s just an Item that’s ON when someone is present and OFF when not. How do you detect someone is present? :person_shrugging: It can be a challenging problem without a universal solution that works for everyone. It depends on how many people are involved, whether they always have their phone on them when they leave, and details like that. Sometimes it can be as simple as the phone reporting when the home SSID (that’s what I do) is near, slightly more complicated like geotracking, to as complicated as the Wasp-in-the-Box algorithm or Bayesian probability trees.

But ultimately it’s a separate set of sensors and rules that toggle a switch.

It’s just a Switch Item.

Have you reviewed the Concepts page of the docs and Getting Started Tutorial? A lot of these questions should be answered there. If not it would be helpful to understand what isn’t clear so we can improve them.

It’s easy enough using a String Item.

Some people use Number Items but I think using a String Item is more intuitive and self documenting. The Time Based State Machine uses this approach.

Pages - Introduction | openHAB through the start of the Rules section.

Getting Started - Introduction | openHAB through the start of the Pages section.

And don’t skip the Concepts sections of the main docs which explains bindings, Things, Channels, Items, and Rules.

Hello Rich!

Thanks for your feedback and good parting words!
Your advice is fair - most of the answers to my questions are in the OH tutorial.
I went to study the tutorial in more depth…