HowTo: NodeRed – Restart FritzBox via NodeRed Dashboard

It doesn’t happen often, but sometimes restarting the FritzBox helps to fix problems in the network or with the internet connection.

There are different ways to restart the FritzBox. You can log into the configuration interface of the FritzBox and trigger a restart via the corresponding menu entry, briefly disconnect the FritzBox from the power supply or you can trigger a restart from NodeRed using the corresponding nodes.

A simple flow how you can restart the FritzBox with a command from the dashboard is contained in the following 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

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 to restart the FritzBox from the dashboard

The following section contains the NodeCode with which you can trigger a restart of your FritzBox. To do this, the connection to your FritzBox must of course already be configured. How you can proceed is described in the article NodeRed / FritzBox – Show caller list in the dashboard.

The NodeCode adds a button to your dashboard. You can adjust its position as desired.

An example view including the button to restart the FritzBox.
View of the NodeCode in the configuration view of NodeRed.

Here is the actual NodeCode. How you can insert this in your configuration is described in the article NodeRed – Import and export node code.

[{"id":"a7e258a0.75b578","type":"debug","z":"78b1bede.9b035","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":3080,"wires":[]},{"id":"9d30b1e8.2ebc6","type":"inject","z":"78b1bede.9b035","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":3080,"wires":[["af919d2a.d740a"]]},{"id":"af919d2a.d740a","type":"fritzbox-in","z":"78b1bede.9b035","device":"358f95ae.ef43ea","name":"","service":"urn:dslforum-org:service:DeviceConfig:1","action":"Reboot","arguments":"{}","x":430,"y":3080,"wires":[["a7e258a0.75b578"]]},{"id":"2afeb431.94044c","type":"comment","z":"78b1bede.9b035","name":"FritzBox restart","info":"","x":180,"y":3040,"wires":[]},{"id":"a17dbc48.84321","type":"ui_button","z":"78b1bede.9b035","name":"","group":"c50fec45.1c008","order":8,"width":0,"height":0,"passthru":false,"label":"FritzBox restart","tooltip":"","color":"","bgcolor":"red","icon":"","payload":"Sure?","payloadType":"str","topic":"","x":180,"y":3140,"wires":[["6061ee6.aa05b1"]]},{"id":"9f1c8829.a06ee8","type":"change","z":"78b1bede.9b035","name":"upstream","rules":[{"t":"set","p":"formerPayload","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":3140,"wires":[["af919d2a.d740a"]]},{"id":"b36048a1.81d988","type":"function","z":"78b1bede.9b035","name":"","func":"if (msg.payload==\"Abort\")\n{\n msg.payload=false;\n} else if (msg.payload==\"OK\")\n{\n msg.payload=true;\n return msg;\n}\n","outputs":1,"noerr":0,"x":630,"y":3140,"wires":[["9f1c8829.a06ee8"]]},{"id":"6061ee6.aa05b1","type":"ui_toast","z":"78b1bede.9b035","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"Abort","raw":false,"topic":"Sure?","name":"Sure?","x":390,"y":3140,"wires":[["b36048a1.81d988"]]},{"id":"358f95ae.ef43ea","type":"fritzbox-config","z":"","name":"fritzBox","host":"fritz.box","port":"49443","ssl":true},{"id":"c50fec45.1c008","type":"ui_group","z":"","name":"Server","tab":"b128bba3.f99e38","order":3,"disp":true,"width":"6","collapse":false},{"id":"b128bba3.f99e38","type":"ui_tab","z":"","name":"Einstellungen","icon":"dashboard","order":6,"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 *