The Ultimate Node-RED Thermostat for Home Assistant

I realized a red-node widget that allows you to control the climate element of the Home Assistant, expanding its functionality.

The source code is on GitHub under an open-source GPLv3 license:
NEST style thermostat with temperature week scheduler

Demo

demoEN

Features

  • Three different options for setting up the thermostat:
    • Week Scheduler (with Away mode)
    • Countdown
    • Manual
  • State report through a NEST style thermostat:
    • OFF
    • ON
      • Idle
      • Heat
      • Away mode (that limits the maximum temperature)
  • Chart

Changelog

v3.4 (2022.02.06)

  • Use “let” instead of “var” to work with Node-Red 2.2

v3.3 (2021.01.06)

  • Fix “Messy graphic” in the first startup (#3)
  • Align the time zone settings used in the nodes (#13)
  • Fix a minor countdown bug

v3.2 (2020.11.23)

  • Fix “change state” in countdown

v3.1 (2020.11.22)

  • Fix “countdown_followed_by”

v3.0

  • Improve the user interface
  • Add Countdown mode
  • Add Manual mode
  • Add Chart
  • Implement 0.1 degree steps in the NEST style thermostat

GitHub

Link: The Ultimate Node-RED Thermostat for Home Assistant

6 Likes

wonderful !
How to use him in Home Assistant ?

Looks very nice!.
I am also interested in how to get in the home assistant UI.
Would be perfect to have as an lovelace card!

But how do I do so @giuseppeg88 ?

This is a node-red widget, so it can only be used in the node-red UI.

Ok. I only noticed that in the readme file it says «hass.io ready» so I thought it was an node red flow that could give entities to ha.

Yes, I’ve been looking for something similar myself as well. The interface on my heating system is incomprehensible, so something like this in a Lovelace add-in would be great.

1 Like

Also want a simple thermostat scheduler for Home Assistant / Hass.io and LoveLace…

I use node-red-contrib-light-scheduler in Node-RED in conjunction with the simple thermostat card in Lovelace.

The light-scheduler essentially just allows you to build out a custom 7 day schedule and then will return Match/No Match (or On/Off depending on the node you use) output which you can use to send calls to HA to turn your heating on or off.

With this, if my heating preset is set to normal (null) then my flow passes into the scheduler. If the preset is boost or away, I can bypass the scheduler and control the heating separately.

1 Like

Looks like an good solution @houseautomated
Would you mind sharing your node red flow?

Sure, I’ve tried to strip out the main parts as I have a lot more being fed into my heating than just this. But the below flow should get the basic setup in place.

Essentially, use an inject node every minute to get the current heating preset and pass that through a switch node.

  • If no preset - Pass through to the schedule and turn heating on/off respectively
  • If boost mode set - Turn on heating for predefined time and then turn off and reset the preset
  • If away mode on - Monitor for when temperature drops below threshold, turn on heating for desired time. I then loop through this flow until the house is occupied again (which turns off away mode)
[{"id":"f5ff055b.61df98","type":"inject","z":"354731be.59f46e","name":"Every minute","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"onceDelay":"10","x":120,"y":960,"wires":[["f394965.3c31768"]]},{"id":"f394965.3c31768","type":"api-current-state","z":"354731be.59f46e","name":"Get heating preset","server":"294865fc.a5524a","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"climate.heating","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":310,"y":960,"wires":[["21fc15b7.524dba"]]},{"id":"21fc15b7.524dba","type":"switch","z":"354731be.59f46e","name":"Heating mode","property":"data.attributes.preset_mode","propertyType":"msg","rules":[{"t":"null"},{"t":"eq","v":"boost","vt":"str"},{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":500,"y":960,"wires":[["73a736bb.5152c8"],["56dc2edb.98cf8"],["1d14c6b1.76f709"]]},{"id":"73a736bb.5152c8","type":"light-scheduler-filter","z":"354731be.59f46e","settings":"","events":"[{\"start\":{\"dow\":1,\"mod\":375},\"end\":{\"dow\":1,\"mod\":495}},{\"start\":{\"dow\":2,\"mod\":375},\"end\":{\"dow\":2,\"mod\":495}},{\"start\":{\"dow\":3,\"mod\":375},\"end\":{\"dow\":3,\"mod\":495}},{\"start\":{\"dow\":4,\"mod\":375},\"end\":{\"dow\":4,\"mod\":495}},{\"start\":{\"dow\":5,\"mod\":375},\"end\":{\"dow\":5,\"mod\":495}},{\"start\":{\"dow\":6,\"mod\":375},\"end\":{\"dow\":6,\"mod\":495}},{\"start\":{\"dow\":0,\"mod\":375},\"end\":{\"dow\":0,\"mod\":495}},{\"start\":{\"dow\":1,\"mod\":990},\"end\":{\"dow\":1,\"mod\":1230}},{\"start\":{\"dow\":2,\"mod\":990},\"end\":{\"dow\":2,\"mod\":1230}},{\"start\":{\"dow\":3,\"mod\":990},\"end\":{\"dow\":3,\"mod\":1230}},{\"start\":{\"dow\":4,\"mod\":990},\"end\":{\"dow\":4,\"mod\":1230}},{\"start\":{\"dow\":5,\"mod\":990},\"end\":{\"dow\":5,\"mod\":1230}},{\"start\":{\"dow\":6,\"mod\":990},\"end\":{\"dow\":6,\"mod\":1230}},{\"start\":{\"dow\":0,\"mod\":990},\"end\":{\"dow\":0,\"mod\":1230}}]","name":"Schedule","onlyWhenDark":true,"scheduleRndMax":0,"sunElevationThreshold":6,"sunShowElevationInStatus":false,"x":700,"y":880,"wires":[["695afa76.9a8594"],["c37439b3.507bf8"]]},{"id":"695afa76.9a8594","type":"api-current-state","z":"354731be.59f46e","name":"Heating is off","server":"294865fc.a5524a","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"climate.heating","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":850,"y":860,"wires":[["36407f2.bbe158"],[]]},{"id":"c37439b3.507bf8","type":"api-current-state","z":"354731be.59f46e","name":"Heating is on","server":"294865fc.a5524a","version":1,"outputs":2,"halt_if":"heat","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"climate.heating","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":850,"y":900,"wires":[["38cfe126.8a1f9e"],[]]},{"id":"38cfe126.8a1f9e","type":"api-call-service","z":"354731be.59f46e","name":"Turn off heating","server":"294865fc.a5524a","version":1,"service_domain":"climate","service":"set_hvac_mode","entityId":"climate.heating","data":"{\"hvac_mode\":\"off\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1020,"y":900,"wires":[[]]},{"id":"36407f2.bbe158","type":"api-call-service","z":"354731be.59f46e","name":"Turn on heating","server":"294865fc.a5524a","version":1,"debugenabled":false,"service_domain":"climate","service":"set_hvac_mode","entityId":"climate.heating","data":"{\"hvac_mode\":\"heat\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1020,"y":860,"wires":[[]]},{"id":"56dc2edb.98cf8","type":"api-call-service","z":"354731be.59f46e","name":"Set heating mode","server":"294865fc.a5524a","version":1,"debugenabled":false,"service_domain":"climate","service":"set_hvac_mode","entityId":"climate.heating","data":"{\"hvac_mode\":\"heat\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":730,"y":960,"wires":[["a23b89ef.64d888"]]},{"id":"a23b89ef.64d888","type":"stoptimer","z":"354731be.59f46e","duration":"43","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":920,"y":960,"wires":[["e7656827.1e0528"],[]]},{"id":"e7656827.1e0528","type":"api-call-service","z":"354731be.59f46e","name":"Reset preset","server":"294865fc.a5524a","version":1,"service_domain":"climate","service":"set_preset_mode","entityId":"climate.heating","data":"{\"preset_mode\":\"none\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1090,"y":960,"wires":[["38cfe126.8a1f9e"]]},{"id":"1d14c6b1.76f709","type":"ha-wait-until","z":"354731be.59f46e","name":"Low temperature","server":"294865fc.a5524a","outputs":1,"entityId":"sensor.xiaomi_temperature","property":"state","comparator":"lte","value":"16","valueType":"num","timeout":0,"timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":710,"y":1020,"wires":[["110751d7.dbfd9e"]]},{"id":"110751d7.dbfd9e","type":"api-call-service","z":"354731be.59f46e","name":"Set heating mode","server":"294865fc.a5524a","version":1,"debugenabled":false,"service_domain":"climate","service":"set_hvac_mode","entityId":"climate.heating","data":"{\"hvac_mode\":\"heat\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":910,"y":1020,"wires":[["12f7a63e.b576fa"]]},{"id":"12f7a63e.b576fa","type":"stoptimer","z":"354731be.59f46e","duration":"43","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":1100,"y":1020,"wires":[["3d8f201.4c2f2e"],[]]},{"id":"3d8f201.4c2f2e","type":"api-call-service","z":"354731be.59f46e","name":"Turn off heating","server":"294865fc.a5524a","version":1,"service_domain":"climate","service":"set_hvac_mode","entityId":"climate.heating","data":"{\"hvac_mode\":\"off\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1280,"y":1020,"wires":[["1d14c6b1.76f709"]]},{"id":"294865fc.a5524a","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Well done!

But it is too bad that the scheduler interface is only accessible in NodeRed, and not in the HA lovelace interface.

In a lot of other domotic operating system, there are nice scheduler for heating, but not for Home Assistant, and I haven’t find any development in this area…

I hope the amazing HA community will give us something nice soon!

I guess that depends on the person. Even with the non-smart programmers I’ve had over the years, I’ve set a schedule and it doesn’t typically get touched until there is a big change in circumstances (working hours, new baby, etc) so doing the initial schedule in Node-RED hasn’t been an issue for me.

We can use Home Assistant to give the heating a top-up outside of the schedule with the boost function - even that is rarely used.

If you have temperature sensors and presence detection you could potentially bypass the schedule altogether and do everything based on whether the house is occupied and your desired temperature. Maybe using input_number sliders to allow you to adjust desired temp / heating hours from Lovelace which Node-RED can then pick up and use in the automation.

Released v3.2 (2020.11.23)

  • Improve the user interface
  • Add Countdown mode
  • Add Manual mode
  • Add Chart
  • Implement 0.1 degree steps in the NEST style thermostat
  • Fix “countdown_followed_by”
  • Fix “change state” in countdown

Code: see the first post.

Hello @giuseppeg88, I use NR, inside HA, but I dont have the slightest idea on how to implement this thermostat either in NR or HA…

2 Likes

Super proect Giuseppy :-D, there is way to add this in HA lovlace interface???

1 Like

@giuseppeg88 how can this be made compatible when you have 2 thermostats? To each have their own page, control etc?

Also, any idea how to make the temp readings be taken from other sensors rather than the original thermostat? Eg I have 1 virtual sensor setup for average of all downstairs temp sensors and 1 sensor average for all upstairs temp sensors

hello and sorry for the stupid question but I’m a beginner with HA and Node Red … but how do I install it ?
is there anyone who can help me in a simple way ?
thanks

I have the same question…

Regarding the installation, you can follow the instructions on the repository on github.
Prerequisite: you need to know how node-red works (there is a lot of information on the Internet) and to install it on your system (there is also an addon for Home Assistant).

To open the Node-RED UI, type your Home Assistant IP address in a web browser followed by " :1880/endpoint/ui/ " as shown below:
http://your_home_assistant_IP_address:1880/endpoint/ui/

Some use the “iframe card” to display this dashboard in lovelace.

1 Like

Released v3.3 (2021.01.06)

  • Fix “Messy graphic” in the first startup (#3)
  • Align the time zone settings used in the nodes (#13)
  • Fix a minor countdown bug

Code: see the first post.