HowTo: NodeRed – Control FritzBox thermostat via NodeRed

I recently ordered one of the DECT radiator thermostats for the FritzBox out of curiosity.

As usual with Fritz products, installation and commissioning were super easy. You don’t even need ten minutes for the installation.

All kinds of options can then be set in the app and the FritzBox interface. Among other things, fixed times at which the radiator should be switched on. Unfortunately, this option is not so practical for me. What I’ve always used in the past, is to turn on the heating when it’s cold outside (for example, cooler than 15°C) and the television in the living room is switched on (as a kind of presence detection).

I wanted to have this “dynamic” switching behavior again. In the past I did this with a couple of nodes in NodeRed. Good thath there is also a suitable node for controlling the Fritz heating thermostats. You then only have to configure them accordingly.

You can find an example flow for controlling a Fritz DECT radiator thermostat in this article.


Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/sicherheitshinweise/


Requirements

Helpful Articles:
So that you can install new nodes, NodeRed should of course already be installed.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.

RaspberryPi – Setup for nerdiys!
RaspberryPi – The first configuration!

RaspberryPi – Control the RaspberryPi via SSH
NodeRed – Installation of NodeRed on the RaspberryPi
NodeRed – Installing new nodes
NodeRed – Import and export node code

Required tools:
-none-

Required material:

In the following list you will find all the parts you need to implement this article.


Log in to the NodeRed configuration interface

Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

View of the login screen. Here you have to enter the login details that you entered during the configuration of the login. Information about this can be found in the article NodeRed - User Login Setup.

Install the FritzBox node

So that NodeRed can communicate with your FritzBox you have to install the node “node-red-contrib-fritz”. How your node is installed is described in the article NodeRed – Installing new nodes.


NodeCode for controlling a Fritz DECT thermostat

The current status of the NodeCode below is my first draft of a control. I will certainly continue to work on it. Therefore please ask for updates if this post has not been updated for a long time.

In the current version, you can display the actual and target temperatures measured on the radiator. In addition, the desired temperature can of course be set.

Last but not least, the charge status of the batteries in the radiator thermostat is also displayed. I suspect that this is shown in percent. Since the state of charge is currently at 100 and is falling very slowly, I still have to watch how this value develops as it falls.

What I have already installed but not yet been able to trigger is the boost function. This function can be triggered on the thermostat itself by pressing the menu button for two seconds. This will fully heat the radiator for a short period of time. It would of course be practical if this could also be triggered from NodeRed in order to automatically heat up a room quickly.

Below are a few views of the configuration and the actual NodeCode.

View of the flow in the NodeRed configuration view.

View of the controls in the dashboard view.

How you can import the NodeCode below is described in the article NodeRed – Import and Export Node-Code.

[{"id":"a7962ae6.cd51d8","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":970,"y":4440,"wires":[]},{"id":"358305f.dcbedfa","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1190,"y":4580,"wires":[]},{"id":"e2c05c.824aafa8","type":"delay","z":"53e12de.0458dd4","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"10","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1510,"y":4500,"wires":[["ce33b77e.42e888"]]},{"id":"483939cf.9e9258","type":"ui_toast","z":"53e12de.0458dd4","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"KlugesHaus","x":1190,"y":4320,"wires":[]},{"id":"3a992371.47ad1c","type":"ui_button","z":"53e12de.0458dd4","name":"Livingroom boost","group":"ec48ea8.9196518","order":23,"width":0,"height":0,"passthru":false,"label":"Livingroom boost","tooltip":"","color":"","bgcolor":"","icon":"","payload":"boost","payloadType":"str","topic":"","x":1210,"y":4540,"wires":[["e2c05c.824aafa8"]]},{"id":"db46f953.f26e68","type":"ui_text","z":"53e12de.0458dd4","group":"ec48ea8.9196518","order":29,"width":0,"height":0,"name":"","label":"Bat livingroom:","format":"{{msg.payload}}","layout":"row-spread","x":980,"y":4260,"wires":[]},{"id":"8b75b2d5.c8baa","type":"ui_text","z":"53e12de.0458dd4","group":"ec48ea8.9196518","order":25,"width":0,"height":0,"name":"Is temp livingroom","label":"Is temp livingroom:","format":"{{msg.payload}}°C","layout":"row-spread","x":990,"y":4400,"wires":[]},{"id":"533ab806.c07cb8","type":"ui_dropdown","z":"53e12de.0458dd4","name":"","label":"Livingroom target temp","tooltip":"","place":"Temperatur","group":"ec48ea8.9196518","order":28,"width":0,"height":0,"passthru":false,"multiple":true,"options":[{"label":"","value":13,"type":"num"},{"label":"","value":14,"type":"num"},{"label":"","value":15,"type":"num"},{"label":"","value":16,"type":"num"},{"label":"","value":17,"type":"num"},{"label":"","value":18,"type":"num"},{"label":"","value":19,"type":"num"},{"label":"","value":20,"type":"num"},{"label":"","value":21,"type":"num"},{"label":"","value":22,"type":"num"},{"label":"","value":23,"type":"num"},{"label":"","value":24,"type":"num"},{"label":"","value":25,"type":"num"}],"payload":"","topic":"","x":1220,"y":4500,"wires":[["e2c05c.824aafa8"]]},{"id":"e5048a7a.b2d4a8","type":"ui_gauge","z":"53e12de.0458dd4","name":"Livingroom Temperature","group":"ec48ea8.9196518","order":21,"width":0,"height":0,"gtype":"gage","title":"Livingroom ","label":"°C","format":"{{value}}","min":"10","max":"25","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1230,"y":4400,"wires":[]},{"id":"72765989.1deb48","type":"pushbullet","z":"53e12de.0458dd4","config":"139243fe.5b95ac","pushtype":"note","title":"KlugesHaus","chan":"","name":"","x":1190,"y":4360,"wires":[]},{"id":"fab61adb.8e4ef8","type":"trigger","z":"53e12de.0458dd4","op1":"Heizung WZ Batterie leer","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"0","bytopic":"all","name":"","x":990,"y":4340,"wires":[["72765989.1deb48","483939cf.9e9258"]]},{"id":"e7e1539f.66fea","type":"comment","z":"53e12de.0458dd4","name":"Get device info / Geräteinfo anfordern","info":"","x":230,"y":4160,"wires":[]},{"id":"7b162249.11acbc","type":"fritz-thermostat","z":"53e12de.0458dd4","connection":"c2e6322e.33404","name":"","action":"getDevice","x":450,"y":4220,"wires":[["56356228.cf8fec","2c507a36.fbb3c6","45d087bf.aab698","cdfaff2e.e8955","8c417156.f97f","4839f59f.2d4bac","56a0e5c3.3ae8cc","6147fb8d.a3eda4","7e243a3.2ef85c4"]]},{"id":"56356228.cf8fec","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":4180,"wires":[]},{"id":"988fe74d.d62688","type":"inject","z":"53e12de.0458dd4","name":"inject heater_id","topic":"099950439688","payload":"","payloadType":"str","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":4220,"wires":[["7b162249.11acbc"]]},{"id":"ce33b77e.42e888","type":"change","z":"53e12de.0458dd4","name":"inject heater_id","rules":[{"t":"set","p":"ain","pt":"msg","to":"099950439688","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":4560,"wires":[["88de62a8.94557","36116ab4.f72696"]]},{"id":"88de62a8.94557","type":"fritz-thermostat","z":"53e12de.0458dd4","connection":"c2e6322e.33404","name":"","action":"setTempTarget","x":1470,"y":4640,"wires":[["94392c0d.00301"]]},{"id":"2c507a36.fbb3c6","type":"change","z":"53e12de.0458dd4","name":"battery","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.battery","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":4260,"wires":[["4447bfbb.2f313","db46f953.f26e68"]]},{"id":"4447bfbb.2f313","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":4260,"wires":[]},{"id":"45d087bf.aab698","type":"change","z":"53e12de.0458dd4","name":"name","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":4300,"wires":[["8ac5de97.e5d21"]]},{"id":"8ac5de97.e5d21","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":4300,"wires":[]},{"id":"cdfaff2e.e8955","type":"change","z":"53e12de.0458dd4","name":"batterylow","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.batterylow","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":4340,"wires":[["df36ec43.f77e","fab61adb.8e4ef8"]]},{"id":"df36ec43.f77e","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":4340,"wires":[]},{"id":"8c417156.f97f","type":"change","z":"53e12de.0458dd4","name":"present","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.present","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":4380,"wires":[["dd12c973.b2b518"]]},{"id":"dd12c973.b2b518","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":4380,"wires":[]},{"id":"4839f59f.2d4bac","type":"change","z":"53e12de.0458dd4","name":"is_temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature.celsius","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":4540,"wires":[["64cf4cb.66c1eb4"]]},{"id":"5290e091.d6486","type":"function","z":"53e12de.0458dd4","name":"convert_t_to_celsius","func":"msg.payload=msg.payload0.5;\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":4580,"wires":[["533ab806.c07cb8","358305f.dcbedfa","e5048a7a.b2d4a8"]]},{"id":"56a0e5c3.3ae8cc","type":"change","z":"53e12de.0458dd4","name":"target_temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.hkr.tsoll","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":4580,"wires":[["5290e091.d6486"]]},{"id":"addcb097.29cee","type":"function","z":"53e12de.0458dd4","name":"convert_t_to_celsius","func":"msg.payload=msg.payload0.5;\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":4620,"wires":[["dad67a3a.2241d8"]]},{"id":"6147fb8d.a3eda4","type":"change","z":"53e12de.0458dd4","name":"power_down_temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.hkr.absenk","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":4620,"wires":[["addcb097.29cee"]]},{"id":"dad67a3a.2241d8","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1190,"y":4620,"wires":[]},{"id":"e9015a7c.bdb0d8","type":"function","z":"53e12de.0458dd4","name":"convert_t_to_celsius","func":"msg.payload=msg.payload*0.5;\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":4660,"wires":[["7e2bb922.138358"]]},{"id":"7e243a3.2ef85c4","type":"change","z":"53e12de.0458dd4","name":"comfort_temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.hkr.komfort","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":4660,"wires":[["e9015a7c.bdb0d8"]]},{"id":"7e2bb922.138358","type":"debug","z":"53e12de.0458dd4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1190,"y":4660,"wires":[]},{"id":"94392c0d.00301","type":"debug","z":"53e12de.0458dd4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1630,"y":4640,"wires":[]},{"id":"36116ab4.f72696","type":"delay","z":"53e12de.0458dd4","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":400,"y":4320,"wires":[["7b162249.11acbc"]]},{"id":"36ee37a8.465248","type":"link in","z":"53e12de.0458dd4","name":"set heater_temp","links":["de5934df.32da48"],"x":1355,"y":4560,"wires":[["ce33b77e.42e888"]]},{"id":"ec242dc3.9023f","type":"inject","z":"53e12de.0458dd4","name":"boost","topic":"","payload":"boost","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1190,"y":4460,"wires":[["e2c05c.824aafa8"]]},{"id":"64cf4cb.66c1eb4","type":"function","z":"53e12de.0458dd4","name":"convert_t_to_celsius","func":"msg.payload=msg.payload/10;\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":4540,"wires":[["a7962ae6.cd51d8","8b75b2d5.c8baa"]]},{"id":"ec48ea8.9196518","type":"ui_group","z":"","name":"Heizung","tab":"748155f1.44babc","order":7,"disp":true,"width":"6","collapse":false},{"id":"139243fe.5b95ac","type":"pushbullet-config","z":"","name":"FabsPushbullet"},{"id":"c2e6322e.33404","type":"fritz-api","z":"","name":"fritzBox","host":"http://fritz.box","strictSSL":true},{"id":"748155f1.44babc","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

Fab

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at ko-fi.com

Leave a Reply

Your email address will not be published. Required fields are marked *