HowTo: Node Red - Restarting the FritzBox from the dashboard

It does not happen often, but sometimes a reboot of the FritzBox helps to fix problems in the network or with the internet connection.

There are several ways to restart the FritzBox. You can log into the configuration interface of the FritzBox and trigger a restart via the corresponding menu entry, disconnect the FritzBox from the power supply for a short time or you can also trigger a restart from NodeRed with the help of the corresponding nodes.

A simple flow how to restart the FritzBox via a command from the dashboard is included in the following article.


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/

Affiliate links/advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


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.

The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH

NodeRed – Installing NodeRed on the RaspberryPi
NodeRed - import and export node code

Required tool:
-no-

Required material:

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


Log into the NodeRed configuration interface

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

View of the login dialog. Here you have to enter the login data that you specified during the configuration of the login. You can find information about this in the article NodeRed - set up user login.

Install FritzBox node

In order for NodeRed to communicate with your FritzBox, you need to install the node "node-red-contrib-fritz". How to install nodes is described in the article NodeRed – Install new nodes described.


NodeCode to restart the FritzBox from the Dashboard

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

The NodeCode adds a button to your dashboard. You can set its position as you wish.

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 it into your configuration is described in the article NodeRed - import and export node code described.

[{"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")
{
 msg.payload=false;
} else if (msg.payload=="OK")
{
 msg.payload=true;
 return msg;
}
","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}]

Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS 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 think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.