Control of Solar& Pellets Heater system - OpenHab Beginners experience

solarlog
froeling
Tags: #<Tag:0x00007fd3149283f0> #<Tag:0x00007fd3149282b0>

(Wilfried) #1

I was looking for options to control and improve the performance of our heating system. This was installed with the goal to get close to the lowest possible energy consumption in a house dating from the sixties which was renovated from the ground.
Now we have:
• a building which fulfills KfW70 requirements (germans know what this means :grinning:),
promising to be as low as 6 kW/qm
• a heating boiler system based on Froeling P4 wood pellets with 15 kW power
• two thermal collectors of 15 qm, producing hot water and supporting the heating system
• a photovoltaic system of ~5 kW

Interested in Home Automation, but not willing to play complete nonsense games (like talking to Alexa, switch the music on when coming home, etc.) I decided to look into the collaboration of the Froeling heater with my solar systems.
I quickly realized that one can do nearly everything with a Raspberry-based system. Spending “a few” hours with Mr. Google I found the right community which already had managed to hack into the control system of P4 and to build a Pi environment that can communicate and control the complete P4 interface. Yet, it is a stand-alone service only with its own web interface.
My goal was to switch the heating cycles of the P4 according to information about the weather conditions of the day. During most days early and late in the winter season, there are a few hours with sun, bringing enough solar intensity to keep the buffer of the heating system (1000L) on acceptable level. But with a standard, time based programming of heating cycles, you end up with cold rooms for the days without sun. It is not a good solution to manually reprogram the switch times every morning, based on the actual weather forecast. So this would be a good exercise to connect a few players in order to improve the situation.

At this point, I should say that I am atechnically interested guy, but I am not a computer nerd, especially when it comes to LINUX systems and “object-oriented programming”.
Anyway, after some more nights with many frustrations and a few positive experiences, I had at least the raspi system running, which now could interact with the Froeling P4 heater system.
In the next step, I had to look for more intelligent systems, which allow to link information from different platforms into one control system. And of course, after googling another few weeks, it is clear that there is only one option: OpenHAB!
Of course, I had no idea at this point, what it means to dig into the details of the tasks necessary to this project.

Here are the more detailed goals:

  • Use local weather forecast.
  • Information about the actual solar intensity, which is directly at hand from my own photovoltaic system
  • Logging all internal data of the heating system state in order to optimize the parameters.
  • Control the activity of the burner, dependent on shorttime expectation of the local sun intensity
  • A mobile user interface

First attempt: Openhab on Synology as a stable, running system. (database for P4 was already installed there)
There is nearly no support for Openhab on Syno, so I was not able to get the programming environment running (access rights, find the correct directories for config files, etc.)

So I moved the whole project to
Openhabian on Raspberry3:
installation was very easy, and I found the first tutorial which deserves the name:
How to set up graphana and Influx for use with openhabian
I also installed Samba service on the raspi, so I can edit all config files from my ordinary windows environment. Moreover, the log files from Openhab are displayed in the windows browser, which helps a lot.

For the weather conditions, I decided to use Weather Underground. It has a straightforward integration with a binding in Openhab 2.0. It offers maps with available weather stations in your neighborhood, which can be accessed for extensive local weather reports, after you have applied for an API key, which is very easy.

My photovoltaic system has a “SolarLog” Interface, so I tried to find a way to get access to the logging data. It turned out that there is the alpha version of a SolarLog Binding.
However, until now, you must be very lucky to find this binding in a google search, and manage to install it in Openhab2. I would strongly appreciate if this binding could be released for ordinary use.

In order to connect to my heater system, I had to do some more work.
In the project P4D a raspberry daemon provides a direct interface to the Froeling heater. Simple commands can be sent via its web interface. So, the first step was to install the HTTP binding, which allows to send command strings to web sites.
In my first demo version, there is now only one command string used to adjust the threshold temperature which triggers the buffer heating cycle. It took me only a few hours to get this simple command running. Maybe, in a far future, there could be a Froeling binding, which would make life much easier :grinning:.

So with those prerequisites, I could start to do something useful and define my first rule, which should be something like:
IF (shortterm weather will allow solar heating OR sun is presently shining) THEN disable burner

• Shortterm weather: From Wunderground I get strings with various states like “Sunny”, “Partly cloudy”, etc.
Making this more quantitative means to transform these strings into a numerical representation.
(Side remark: After spending some time with RegEx, I decided that keeping my mental health is important and switched to ordinary transformation files. The remaining problem was how to handle a blank in a string? This is so simple that it is covered nowhere. After a few hours I found this solution: “partly\ cloudy").

• Sun is shining: this is measured by the actual AC power reading of the SolarLog, which is directly usable via the binding alpha version.

• Communicate with the daemon interface of the heater: This is also “really” easy, after recognizing how to use the GET command in order to map ON and OFF states of a switch into a HTTP string, it did not take more than a few hours, to find a slighty similar problem in the user forum, and adjust the solution to my problem.

Similar issues came up when I tried to define time dependent rules: After struggling for some days with “milliS”, “Joda” s and various methods for handling time variables, I found that this stuff is not for ordinary people! Yet, there was one forum post which actually stopped me from throwing the towel:


It turns out that a lot of troubles with time conversions can be avoided by turning the variables into plain strings!

This is the kind of example for beginners which should be promoted much more, because it can be used in a rule file without trouble.

So after a few weeks dealing with the syntax issues of rules, I finally have a running system, which at least allows to monitor the heating system and to adjust the heater cycles as originally planned.

I really like the possibility to visualize all the data in Grafana, although this package posed its own challenges to my understanding of user interfaces. But meanwhile, I am able to even handle SQL data from my heater in its MariaDB data base and I can combine them with persistence data of the rule set, as can be seen here:
P4 Dashboard
The details of the rule file will be provided soon, presently I am still struggling with a few bugs, that should be resolved.
So in summary, it was a hard time learning the basics of this project, but now I am looking forward to other interesting projects using the tools I learned. Next one will be to define a watering system in the garden. So let’s see.


(Rich Koshak) #2

Thanks for the detailed posting. The community really benefits from posts like these.

I’ve just a few comments/questions:

openHABian is a set of scripts that will set up and configure a Linux system with openHAB and related services (like Samba). That link shows how to setup and configure Grafana and InfluxDB for any OH install, not just openHABian.

Among the things that openHABian will install and configure for you include:

  • samba
  • InfluxDB
  • Grafana

Are you really using OH 2.0? We highly recommend using the latest release which is OH 2.2. There are usually very significant changes even in point released versions, mainly additional capabilities. Consequently, it is important to be very clear and careful when mentioning which OH version you are referring to.

Where did you find it? A link would help others avoid being lucky in a google search and at least monitor the binding for when it goes to beta or gets released.

All of the Design Patterns as well as other useful tutorials are listed here:

https://docs.openhab.org/tutorials/index.html

If you have a better place to list it we are very open to suggestions and even more so to PRs. :wink:

Be sure to review the DPs and other tutorials there. You sill see many similar approaches that will likely help you in other aspects of your system as it grows.

Are you using VSCode with the openHAB extension? It really helps with finding and helping with syntax problems and it helps you discover what methods are available on objects, like now.

If you need help with the bugs please feel free to ask for help.

This might be a place to start: Design Pattern: Cascading Timers