The temperature dropped below 0°C for the first time today, so it is time to revisit my $5 Nest alike thermostat. For some time, I have been looking into integrating Google Assistant into the mix. After discovering gBridge, I can do it properly! Oh, Alexa users read on, as if you used my older project, this one has been redesigned.
Feel free to read on, but I have redesigned this project and an updated tutorial is available here: DIY Smart Heating.
EDIT 07/02/2020: gBridge is shutting down on 15th March, so please check this post for possible alternatives for Google Home.
Smart heating on the budget, a very tight budget
This project originally worked with Amazon Echo devices and NodeRED so I have not shared it with any Google communities. Let’s start with a short recap.
Features
- Complete Google Home integration
- Google Assistant integration
- Web UI with Nest alike interface
- Amazon Alexa compatible
Google Calendar support(coming soon)Android Notification support(coming soon)Tasker integration(coming soon)A new thermostat box(coming soon)
My thermostat is 30 years old and comes without any features, the goal was to keep the thermostat operational and add the smart controls on the cheap. At the heart of the system, I have a sonoff basic ($4.99), flashed with Tasmota firmware, which has been coupled with DHT11 Temp & Humidity sensor ($1).
The details of how to wire it has been explained in the main post. So if you want to know the details, read the hardware section of that post. The sonoff works in parallel with thermostat, so you can actually use both at the same time should you encounter any issues.
I’m running a NodeRED server (You can run it on Raspberry Pi Zero ($5) which is responsible for processing all the data. As you can see you could put it all together for about $11!
What do you need?
To “smart-up” your old thermostat, you will need a couple of things:
- Sonoff Basic (AliExpress, Banggood, Gearbest, Itead, AmazonUK, AmazonUS)
- DHT11 sensor
- RaspberryPi (any (including $5 Zero, RPI2+ recommended)
In this write-up, I used the flow which enables Alexa and Google Assistant, but in the download section below, you will find versions for Alexa and Google Assistant only. Just pick the file you want to use in your setup.
Buy Sonoff Basic R3
Buy it using these links to support NotEnoughTech.
What has changed?
If you an Alexa user, you should update your flow too. Especially this one has been simplified, updated to NodeRED 1.0 and ready for future updates. It’s worth paying attention to this part so you would know what’s what.
NEST dashboard
Updating the original widget, needed 5 payloads. I have modified the template, so I can feed this just once. It will reduce the number of cycles needed, free the CPU a little and makes it easy to update.
The modified update node gathers all information and pushes it to the dashboard as one payload:
You notice, that I push all my data to flow variables. I can update these from different sources and I'm able to access the latest data set this way. It should reduce any issues.
Google Home & Google Assistant support
You will notice more MQTT nodes in this flow. This is because gBridge uses MQTT to integrate your devices with Google Home and Google Assistant. You can register a free account (up to 4 devices) and create a virtual device that uses ON|OFF and Temp Control traits.
- Update the target temp set by Google Home or Google Assistant
- Update the status of the heating from Google Home widget
- Update the status of the heating from Google Assistant voice command
- Pass state of the heating to Google Home (On|OFF)
- Update Google with the ambient humidity
- Update Google with the ambient temperature
You should read this post if you want to understand how these work, as some editing (topics) needs to be done! Changes made in Google Home app, or via voice commands will sync with Alexa and the Web GUI and the other way around.
The only quirk, for now, is the voice commands:
Turn "Heating" onhas no effect Set "Heating" on|off works
The rest of the commands like Set "Heating" to 20°C
works without any issues.
Changes in Temp and Humidity updates
Google requires you to pass data as a float with a single decimal value. I needed to hunt the values around and make sure it's not passed as a string. I also used a function node to convert the value:
var humid = msg.payload.DHT11.Humidity; var x = humid.toFixed(1); flow.set('HumidAmbient',x ); msg.payload = x; msg.topic = "Humidity"; return msg; var temp = msg.payload.DHT11.Temperature; var x = temp.toFixed(1); flow.set('TempAmbient',x ); msg.payload = x; msg.topic = "Temperature"; return msg; var target = msg.target; var x = target.toFixed(1); msg.payload = x; return msg;
Sonoff controls
Lastly, I have duplicated the sonoff controller, as the payloads delivered by Google via gBridge are different. It was easier to set an extra output and duplicate the node than try to combine this.
Settings in NodeRED 1.0
NodeRed 1.0 comes with new features, so I wanted to streamline the way you set the parameters. In this case, there are 3 values you need to set:
- default temp - preset temp value to set your thermostat when you say
set "heating" on
without temperature specified - ecoLow - define the low end of the temp where the
"eco"
leaf shows up - ecoHigh - define the low end of the temp where the
"eco"
leaf shows up
GUI
For now, I'm keeping the existing dashboard. You can access it via any web browser providing you can open up the 1880 port. I have added a 72h chart, just in case, you would like to see the heating trends. You can also include the target temp (add a unique topic msg.topic = "Target";
) to trace the heating behaviours.
Note about hysteresis
This is a less self-balancing system. The temperature updates are sent every 5 minutes with a mean value taken from 15 readings. This and the fact that the radiators keep warm for some time after being turned off seems to be balancing system well and I have not noticed any issues.
I actually added a function node so you could check how often the heating is on:
var state = msg.hvac; if(state == "heating"){ var x = 5; } if(state === "off"){ var x = 0; } msg.payload = x; msg.topic = "Hysteresis"; return msg;
If the system is on, the graph will draw a green line at the 5th position otherwise 0.
Things to come
It's a great opportunity to follow me on social media, as I will be adding extra features (including a much more pleasing to eye thermostat). If you want to time your thermostat, use Google Home and Alexa Routines for now, but soon you should be able to set a Google Calendar to control the heating patterns.
Android device will get a designated app and persistent notification controls so you could control the heating from the notification shade as well as fancy WebUI.
Lastly, there will be a proper (probably ESP32) based box with per room controls! Yes, I'm planning valve controls and per room temperature setting. Try this with your NEST!
Conclusion
I'm ready for the winter ahead. I have used this system for a year now and it has been great. I had a single failure (self-inflicted, issues with another project) which was resolved by an automatic reboot policy at 4 am (just in case) so whether you are in the Alexa team or Google Home you have now access to cheap as chips NEST alike thermostat.
If you are like me, you will also like the fact that this flow simply lets you use all 3 systems *(Amazon Echo, Google Home and NodeRED) and they all integrate well! Finally! If you have any questions about the project, leave it in this Reddit thread.
Project Download
Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.