So here are my thoughts: I wanted to build a nest like controller for my heating system. Did a lot of reading and purchased a Raspberry Pi 4 and Sonoff TH16 smart switch with temperature and humidity sensor. Watched a few YouTube video's and read some articles. I went down the same road as Pete Scargill who's informative and extremely helpful information on building a heating controller came in very useful.
I got my Pi up and running, installed Node-red, Mosquitto MQTT server and flashed my Sonoff with Tasmota. Next l imported some Node-red flows from Pete's blog pages and started to learn how they worked and what they did.
I got it working after a fashion but it seemed all I was doing was replicating a physical heating controller in software. Then it hit me: why don't I just get Alexa to send a scheduled command (rather than a voice command) to set the temperature to a particular value at a particular time. All I would need to do is bring this temperature value into Node-red, compare it with the reading from the Sonoff sensor using a template node, and output an instruction to operate the Sonoff relay which would control the heating. An advantage of this method is that scheduling changes can be made easily just by going into Alexa on a mobile device and adjusting the times and temperatures to suit changing situations. It can also be done away from the local network i.e. away from home.
Am I being over simplistic or is this a viable option? The only stumbling block I can see is how to get a scheduled Alexa value into Node-red. I would of course leave my current electro-mechanical thermostat in place as a backup in case of system failures.
Just a simple wall mounted gas heating boiler (quite old) All I'm looking to do for the moment is replace the original mechanical thermostat contacts with a Sonoff smart switch.
Good, I was worried that you would be switching a high load with the TH16. If you are doing heating control you will need to think about PID control too:
This node was developed by @Colin, a member of this forum.
The biggest problem with that approach is that it is using Alexa. What happens if the service goes down, will it still work, will you be able to change it?
Also, how easy will it be to change the schedule? You most likely will want to vary the schedule through the year.
The advantage of using Node-RED is the ability to quickly change things and make use of the many nodes such as the cron-plus node which would let you build multiple schedules and change between them for example. You can also build schedules based on sunrise/sunset or you could enhance your system to take into account local weather. While you might not want to do these things immediately, you may wish to do so later on.
Do you mean you are going to disconnect the original thermostat contacts and replace them with the Sonoff or are you going to strap the Sonoff across them (ie. in parallel) ??
Either way you NEED TO CHECK the Sonoff contacts as I don't know if they are voltage-free.
Voltage-free means the contacts are completely isolated.
Just looking at photos of the Sonoff TH16, on the web, it looks as if whatever is inside the SonOff - probably a relay, is just switching the Live side of the mains. So the contacts are NOT voltage free.
I haven't got a Sonoff TH16 so cannot check what's inside, but maybe someone on the forum can.
Just be ULTRA CAREFUL as you are dealing with MAINS and the mains can KILL YOU.
Thanks for the replies chaps. I've been using Alexa routines reliably for a while now switching on and of several lights and appliances in my home with few if any issues. They are also easy to set up and modify when necessary so I would like to pursue this path if possible. If Alexa stopped working or I had network issues I have the original stat to fall back on. This would be switched back in circuit with a change over switch that will be fitted as part of the project. I intend to do initial testing on the bench for a few weeks adding in things like hysterisis compensation and some PID stuff as and where necessary. As I mentioned before my biggest concern is how to get node red to accept a value from an Alexa schedule rather than a voice command. So any comments or tips on how to do that would be gratefully accepted.
That depends on the boiler some are voltfree some fire on 240v to switched live. Some can be wired both ways and newer ones have opentherm. As @Surefire01 said it is an older boiler and he's in the UK i would think it fires on 240v to switched live.
What boiler is it and do you have the boiler manual
I'm pretty confident with the hardware side including the electrical mains circuitry. I'm pretty new to node- red and the software part of things, it's a bit of a steep learning curve for someone of my advanced years I'm afraid. By the way my boiler is a 25 year old Potterton Prima F. It may be ancient and inefficient but it's simple and solid as a rock. I'll take a look at Alexa remote 2 and see if I can figure something out. Thanks for the interest chaps