Managing a boiler with NodeRED and Sonoff


The part that controlles the schedule, the upper and lower limits and the connection to the mqtt of the sonoffs.


I don't know what schedules you are talking about (I did not mention schedules) and I don't understand what you mean by upper and lower limits. For mqtt run mosquitto on whatever you are running node red on and then tell the sonoff to connect to it.



Schedules: I thought you had some kind of routine like in the top example that the heater is set to e.g. 20 °C from 08:00-20:00.

By upper and lower limit I meant some kind of hysteresis, so if you set 20 °C the heater shuts down at 20,5 and turns on at 19,5 (like you would be able to do in the ewlinke FW.

The reason why I’m interested in in this is I want to use this flow to control my boiler like in the top example but also for the room heating.

I'm able to switch my sonoff on and of via a switch (connected via mqtt).

But I'm unable to turn the switch on and off in accordance to a set temperature.

If I use a function and apply a if else request and return a true or false I get the error that the function can't process Boolean.

If I try to set it up like in the top example I'm unable to extract the true and toggle my switch, see example.

That's why I asked for a working flow so I could figure out where my problem is.



If you look back at my posts I think you will see that is not correct. What I did do was to suggest using node-red-contrib-ramp-thermostat, which will do the On/Off control that you are looking at.
However for scheduling have a look at node-red-contrib-bigtimer and node-red-contrib-schedex. In fact if you search the flows site for timer there are other nodes there that might be of interest.
The other thing I did was to point out that you could do the on/off control in the Sonoff device without involving node-red, which might be considered safer for a boiler control as then you are not reliant on the wifi and node red to keep the boiler safe.


Hello, first of all your setup is awesome! I'd like to do something similar at my parents' home, but i'm far from savy about domotics. Our boiler can go up to 21A, does that mean i have to vet a sonoff switch than can handle at least that much?


AFAIK, none of the SONOFF devices would be in any way safe for that load. I think the highest rated one is said to be 16A but I wouldn't trust it anywhere near that load. Indeed, I probably wouldn't load a SONOFF above about 1/2 its claimed rating.


According to the original poster:

(For 3KW, the current is 13.6 A at a nominal 220V.) I suspect @TotallyInformation is right, and I wouldn't even bother changing out the relay in the Sonoff. Just use it to switch a second relay that can handle the current.


I suggest, if possible, not completely replacing the existing controls (which can obviously cope with switching that power) but instead build your system round it, so that you feed inputs to the existing controller so that it will drive the boiler but you don't need to switch the high currents yourself. This will also be safer as you will not remove the safety systems in the existing setup.


I agree with Colin about not messing around with your existing boiler switching/controls.

I have a number of Sonoff devices (in-line versions and S20 versions) I use for switching low-current mains-voltage things like table lamps, external lights, power to printers. These have proved very reliable.

If you really must switch high currents then you could do some research on using heavy-duty solid state relays (as per the example link below). (I seem to remember someone mentioning using these devices on this forum.)

PS: You need to be careful reading the "specs" when you are switching inductive things like transformers.


My comments were more about safety rather than failing relays. Take a close look at the sonoff’s and read Pete Scargill’s blog on the matter.


Thanks for the reply, i'll try to find an alternative then, and more importantly do my homework on how the system works!


As with all things EBAY/Alibaba etc - do not trust these to the full rating - i use a conservative 1/2 load rating with these and they seem to stand up well to that use (with some heatsinking also). In the case we are talking of 3KW on 220a there is plenty of leeway with the model listed. Also note that you can get these with a 220v input on the switch side i.e. you could drive one from the output of the sonoff and have the relay handle the load. The one listed is meant to be driven directly by a microprocessor such as an Arduino or ESP8266 voltage. So to use a sonoff with this would require soldering a link out of one of the sonoff pins and kludging up a wire out of the case.

Here is an example that can be switched via 240v



Unfortunately that appears to be about 10 times the price of the low voltage one, can anyone recommend a low cost mains powered one?


How much does it cost to rebuild your house after setting it in fire with an underrated electrical device ?


I use a so off SV to control my boiler (combi). I am not switching mains with it, but just shorting a link that switches the boiler on (relay closed) or off (relay open). I have Tasmota flashed on the sonoff SV and it is controlled via MQTT from my node red flow running on a raspberry pi. It has been running successfully for a couple of months with no apparent problems. The system was originally running using my own software, until I discovered Node-Red, so still tweeting my flows :blush:


That is not the issue. I can use the low voltage one, but that is less convenient as I have to bring the low voltage signal out of the Sonoff to drive it. The high voltage one can be driven direct from the Sonoff terminals. If the high voltage one were available at the low cost then that would be the most convenient.
In fact it seems the high voltage one is not available in the UK (not even on ebay direct from China) so I can't get it anyway.


Aha, this seems to do it. I think DA on the end means low voltage DC drive, AA means high voltage AC


That's just the same as the one I mentioned above - both made by Fotek (in Taiwan I think).
The one I mentioned was rated at 50A.
Here's a link to the datasheet for Fotek's range of SSRs.

I bought 3-off of the DC-to-AC and DC-to-DC versions from Banggood in China.
They arrived to me here in the UK just before Christmas.
Although I've not used them on a high-current application yet, they look well made and robust.
The screw terminals are a lot more substantial than the ones in the in-line Sonoff.

Just found this 80Amp version on Banggood for £5 and post-free to UK.


Yes, except the one you linked to was the DC drive version. The one I linked to is the AC drive version, which is more convenient if driving from something like a Sonoff Basic or TH10/16.


Oh yes I see what you are doing now.
You're thinking of driving the SSR from the SonOff, hence the need for the AC-to-AC version.
Your solution also means you could place the SSR near the boiler, rather than trying to fit it in the small enclosure that appeared at the start of this thread.

Ali-Express appear to stock the item (25A and 40A versions) you are interested in.