Nest-style central heating controller in Node-RED

Anyone seen the latest news about Google Nest?

Previously, I was going to buy 5 or 6 Nests for our new home. I already have one, which I have enjoyed for the last few years. But now - no way! I don't like the direction that consumer HA is going anyway, so let's make our own clone of Nest!

So, who is up for making a DIY clone of Nest? I already have this UI clone operational in my NR dashboard:

The control side of things are easy for me: a SONOFF near the boiler and a rotary controller / display in the wall. I plan to use my Fleetwood controller in each room. And obviously this requires multiple temperature sensors housed in some fancy wall-mounted box.

But the tricky bit for me is the software. Obvs I want to use Node-RED for all the logic. Can someone join me?

Suggested spec, in order of priority:

  • Phase 1: time switch. Some kind of time / temperature programming interface in NR Dashboard.
  • Phase 2: comfort. Silently break-out out of timer mode with a temperature adjustment input. (i.e. "walk in room, turn up the temp"). Recommence time/temp mode at next timer event, unless that timer event is in the next hour or two, in which case delay it. Similar to "boost" on an old thermostat, but nicer.
  • Phase 3: intelligence. By default, our system will result in high heating bills and a feeling that it's just not as "clever" at predicting the right temp as Nest. It therefore must work hard in the background to reduce heating bills without sacrificing comfort. I have broken down the problem below, but whilst we are implementing this problem, we have to live with the system. So I propose first implementing some kind of slider that allows us to adjust between "try to reduce bills" and "try to keep us warm".
  • Phase 4: reporting. Seems a shame to leave this until the end, perhaps the key to developing this system is in the monitoring, to allow tweaking the algorithms, configs, etc. But reporting is definitely useful for the user. I love Nest's email reports like "you used 14 hours of heating this month", comparing to last month, same time last year, etc.

Notes on Phase 3: Making the system intelligent (economy and comfort)

  • Economy
    • The first quick win is to use location sensing to enable and disable "away". But even this is difficult. I wonder, does Nest somehow manage to predict you are coming home? Or does it just know when you are near home? The obvious difficulty here is if you work every day very near the home, Nest will assume you are home. How do we define "away"? Does the definition change over time, e.g. if my workplace is 50 yards away and I set myself as away a few time, does it learn this? What about the idea of a "confidence" level, to prevent flip-flopping when you nip out to the shops, or even spend 4 hours in the garden? Should this confidence level depend on time of day, how long you are usually gone for? How far away you are? What about multiple users? Am I over-complicating this?
    • Also requires ability to set the away temperature, e.g. 15*C. Should this change depending on the confidence level?
    • Sense location using OwnTracks? Is this the best option?
  • Comfort
    • Using room presence sensing to keep existing set temp regardless of timer events
  • Economy AND Comfort
    • Using location sensing to spot patterns and quietly adjust the timer events that you thought you set up correctly but didn't
    • Learn from user adjustment (i.e. the manual "tweak" of room temp): if this happens often around the same time every day, every Saturday, or whatever, then silently adjust the time/temp program

As always chaps and chappesses, I'd love to hear your thoughts.

1 Like

Personally, I like actual automation, so preferably no buttons, switches, dashboards whatsoever.

Heating is done here via temperature monitoring (netatmo), if below certain temp for x minutes then turn heat on. Location based is possible via telegram for example, but you can also check for mac address in your accesspoint/router, if mac in arp table set occupancy true.

When heating turned on/off, track it in a database, generating a report from it should not be an issue.

Looks like a great project and I look forward to seeing progress. Hopefully I might be able to offer some back-seat advice along the way :slight_smile:

I already have a smart(-ish) heating controller using the Drayton Wiser system. I plan to add more smarts via Node-RED since the system isn't that smart really and isn't always that intuitive to use. Time is always short though and what dev time I do get tends to be spent on developing uibuilder at the moment.

My plans are to create a family-friendly web interface - so probably something similar to what you are developing.

So far though, I've only got as far as creating a details page and a simple lighting page. These are detailed in another post somewhere here on Discourse. I'm using uibuilder (of course!) with VueJS and bootstrap-vue to build the pages.

The details page exposes some info on what the system is doing, e.g. the level of demand on the boiler - and room/external temperatures, humidity, radiator demand, etc.

I want to build some additional simple tools such as:

  • Away/Out/Home (away being away for several days, out is away for a few hours).
  • Boost for areas of the house such as ground floor, first floor, Kitchen.
  • Automated kill for the system's inbuilt boost. For example to kill of room boost when it is bedtime (the kids sometimes boost their bedrooms for 3 hrs close to bedtime instead of for 1/2 hour).

In regard to automating presence sensing - this turns out to be virtually impossible without using hardware tokens and something like NFC around all exits/entrances. Phones focus on power saving and are therefore unreliable as tokens. Geofencing can work but typically, as you identify, isn't very accurate. You also have to make sure that everyone is always carrying their phone, has power, etc. Not terribly reliable either (even I forgot my phones the other day). A token attached to key rings is more useful but also more expensive to set up.

In regard to heating automation. The keys I think are to be able to understand how quickly rooms heat up and cool down and what the outside weather is doing. Then you, as you say, need to predict when people are in the building.

In truth, I think that you can make significant savings simply by fine tuning heating schedules by room rather than for the whole house. For that, you have to have TRV's on each radiator.

Yes I got this email about google winding down the Works with Nest developer program, I am of the same mind, I have no intention to migrate to a Google Account it will do nothing for me, I do not intend to get locked into googles connected home, so I will develop my own solution using node-red with a aim to scrap my nest thermostat altogether.

I also inked my nest info to that 'Nest like dashboard widget' clearly that will not work anymore after August 09 so I am interested in code to replace my Nest thermostat

Phase 1: I started playing about with node-red-contrib-ramp-thermostat connected to the 'Nest like dashboard widget' that part was easy, understanding fully the the capability's of the ramp-thermostat is not so easy, I guess I just need to experiment for a while (maybe a long while).

My next aim is to replicate my actual nest schedules into profiles for the ramp thermostat node, adding profiles for each day of the week, plus away / holiday etc then automate these so I don't have to manually choose them.

The main concern at the moment is how I will control the heating when I am away from home, I use the Nest app on my iphone a lot (I suspect google will close this service soon in favor of google connect although they say the Nest app will currently continue to work) of course I can vpn into my dashboards and adjust the 'Nest like dashboard widget' but its a bit of a pain loading the whole dashboard just for this operation, maybe I should buy another raspberry pi just for the thermostat because my current pi's dashboards are getting bloated with all the stuff I control with them.

Whilst it isn't graphical, I will be extending my Telegram bot to include some heating control.

At present there is not too much incentive for me to rush into this since I can use the Wiser cloud capability if I want to with the Wiser app. I don't have to though since I only ever purchase hardware that isn't totally tied to cloud applications. The Wiser system works without the Internet just fine.

Certainly, I will be adding simple commands to my telegram bot to turn on/off away mode for example just as I have for my lighting.

I looked at Telegram with no particular reason, ages ago but when I installed the node's my pi crashed I didn't bother to trace the problem as it all looked very complicated and I didn't have enough available time, I will take another look at Telegram in due coarse as I guess it would be a good solution to this problem, thanks..

Telegram is worth looking at because you can control things without exposing your network to the internet.

I've used it with my students to control LEDs on a Wemos D1 Mini board via a mobile phone.

1 Like

Have a look here: https://github.com/cflurin/node-red-contrib-ramp-thermostat/wiki/Thermostat-basics

It will take you a little time to get your head around how bots work with Telegram. However, it is possibly the easiest of all of the bot platforms. Once you have something basic working, it is easy to build on.

I now have a simple flow that listens to specific MQTT topics and translates the topic and value into a Telegram message. That makes it really easy to use for output. Input from Telegram to Node-RED needs more work of course and there are a few things you can do from monitoring general text through "/" commands through to the use of keyboards and media sharing.

cflurin, thanks yes I have been working through the examples and I also saw that undocumented cmd , topic ‘getProfile’ payload ‘active’ which is useful, I have found when using a mobile or tablet to show the dashboard it pays to put the charts on a different page that then enables the thermostat page to load almost instantly.
dave yes once I have this stat working how I want it I’ll take a look at Telegram.

Sorry meant Julian not Dave in last post.

I only joined just now. I have started working on something like this, but it is not yet complete. I also used the Nest interface, I have tweaked it slightly, so it besides the AWAY mode, there is also a BOOST mode.
I have implemented different schedule patterns, but that is all at the moment. I still need to work on switching to different modes and general bug fixing.
To reflect on your requirement, I would review some of them. I don't know what sort of heating you have, but I personally don't see a point "I walk into the room, turn the heating up". Unless you have fancoils, air ventilation, heating system generally are very slow. You are asking your furnace to do something immediately, when in reality the response can only be felt after half an hour or even 1 hour. Modern heating systems usually monitor the outside temperature and calculate the required hot water temperature to keep the house at a constant temperature. This is what I have, and it works great. I don't even have thermostats in the inside. Also keep in mind that heating up the house may take more energy than keeping a constant temperature for a longer period of time. But I understand that in some situations (e.g. old house, bad insulation), there is no other way.

Anyway, I think I do most of the thinks that you need, and with some additional logic, we can get to the "intelligence" you are after. I may do a short video on the current progress, so you have some ideas how it looks at the moment.

1 Like

@nygma2004: What you said is true for a certain kind of houses, but there are many buildings (in the usa for example), which are build only with some wood and "cardboard". In such a house it's possible to save energy with fast reacting heating control rules and single room valve control. So i think a good heating algorithm should consider the "heaviness" of a building.

Also, the heavier a building, the more a weather forecast gets interesting for the heating controller (even more if there is a solar water unit involved) - just in case you want to implement the ultimate heating control :slight_smile:

@moebius Thanks, I will keep this in mind. I want to implement a Boost function with a timer after which the thermostat automatically switches back to a default pattern. Probably an inverse function would be useful here which goes back to an away or minimum state when there is no external trigger, like a motion sensor or presence detection.

It is, of course, the "thermal mass". Our house, for example is extremely "heavy" with lots of stone and brick. But being a Victorian house, it takes a long time to heat up. In summer though, we put on a jumper when we come indoors- it stays cool unless we have very hot temperatures for an extended number of days! Rapid changes in external temperature though make little short-term difference. On the other hand, humidity makes a big difference here in the North of England.

So here is phase 1 of my Nest replacement

Stat_flow.txt (67.1 KB)

Its based on Node-red 0.20.5 Dashboard 2.15.4 widget size setting 50 x 52 so if you try with any different dashboard releases or widget settings you will need to adjust button / thermostat css.

Also you need following 4 .png files in your httpStatic: folder.

up-chevron
down-chevron
Nill
sM

1 Like

hmm how do I attach .png files ? (drag and dropping the files into the post didn't appear to work!)

You could try uploading them using....

Hey Dave (@Dave) ,
Really nice widget! This is definately something I will use in the near future... Do you have any plans to create a Ui widget node for this?
Bart

Hi Bart,
Phase 1 was to marry the 'Nest like dashboard widget' code which is based on a Codepen by Dal Hundal: https://codepen.io/dalhundal/pen/KpabZB to the node-red-contrib-ramp-thermostat including all the necessary button logic to make it functional.

Both the 'Nest like dashboard widget code' or any attempt to create a 'Ui widget node' is well above my pay grade sorry.

Next phase is to add some intelligent and reporting (see some ideas from first post from @hazymat )
I suspect this will take some time because here in the UK Winter is over (hahah next week it will probably snow now I said that) so currently my combi gas boiler is not being used for heating the house, only for hot water for like showers and washing pots, so no any chance for testing.

I tried again to upload the .png files, actually there white on a transparent background so they are difficult to see, there just above the description below (should be able to right click on them and save them somewhere.

up-chevron
up-chevron.png
down-chevron
down-chevron.png
sM
sM.png
Nill
Nill.png