Finally I've got my boiler smarter with NodeRED It now has automatic mode which heats the water based on usual family needs (as scheduled). During the day it maintains 45C for daily needs.
It also has manual mode and "warm once" feature which warms the water up to 60C if needed (outside the schedule).
The project uses Sonoff TH16 with its original firmware but was tricked to use local sonoff server hosted in NodeRED. Very neat Cloud / Internet / Vendor independent solution.
Sensor's cable was lengthen and the sensor was attached to boiler's water tank just behind the mechanical thermometer (the only available option without the need to break the insulation). The sonoff is itself placed in an isolated plastic box:
I had to develop a new Node specifically for Sonoff TH series which reports temperature and humidity (this node was proposed to the author of node-red-contrib-sonoff-server and hopefully it will be included in the suite).
The logic is based on Norelite which has powerful rule engine and tools for date/time limits:
Here is the complete flow which drives the boiler:
Basically it says:
- warm the water to 60C everyday between 23:00 - 01:00, 04:30 - 07:00 and 17:00 - 18:30 (we have two tariffs , the night tariff is cheaper);
- During the day keep water's temp at 45C;
- Allow the water to be heated once up to 60C;
- In all cases if the water exceeds the temp threshold - stop the heating.
There's logic to check for sensor malfunction which is important when playing with electricity. In case of failure all rules are disabled. I plan to add notifications.
The boiler can be managed and monitored via new Dashboard page where you have a few sliders, status indicator and simple temperature graph:
It is driven by the following flow:
Since I log all temperature and switch status readings to a MySQL database they are displayed in a meaningful chart using Grafana:
The green is the water's temperature, the yellowish rectangles show the time when the sonoff switch was on (i.e. heating mode). Here you can see, analyse and make conclusions about:
- Temperature losses of your boiler
- Human behavior. That can be further analysed to create dynamic heating schedule;
- How much energy is used based on daily uses
Recently I've upgraded to more recent version of MySQL (manual compilation from source files, duh) which supports Windowing functions. So it will be easier to calculate the total power consumption over specified period.
Roughly speaking the boiler is working 3-4 hours less a day which results in great savings.
TODOs:
- Create dynamic scheduling based on behavior analysis
- Fast warm when someone is reaching the house based on GPS coordinates
- Vacation mode
- Heating failure detection - i.e. detect if the switch is on, but the water does not get heated + notifications
A caution regarding sonoff TH16: According to the specs it can drive up to 16A. But it seems there are batches with cheaper relays that can be troublesome. In my case the boiler is 3KW and the relay got broken after a few days of work. So I had to replace it (with 20A equivalent in my case).