Scheduled Restart or Shutdown Raspberry pi using Node-RED

Raspberry pi scheduled Shutdown or Restart using Node-RED

Node-RED is a flow-based low-code platform for IoT-based system prototyping and testing. We can restart or shut down raspberry pi using Node-RED by using the rpi-shutdown node.

To install the nodes, simply run the following npm command in the Raspberry pi terminal or ssh.

npm install node-red-contrib-rpi-shutdown

Or, we can install the latest stable library from the manage palette option in Node-RED. For this, go to the MENU - MANAGE PALETTE - INSTALL option, search for node-red-contrib-rpi-shutdown and click the install button. 

Scheduled restart or shut down Raspberry pi using Node-RED
Restart or shut down Raspberry pi using Node-RED
The package contains two nodes, Shutdown RPi and Restart RPi. We can trigger the shutdown or restart command under any condition or by setting a schedule using inject node.

Nodes to shut down or restart your Raspberry Pi

These nodes only support raspberry pi boards.alert-warning

Example flows for restart and shutdown of the Raspberry pi

Import the following flow on the Node-RED server running on Raspberry pi to set up restart or shut down configuration. 

[{"id":"3f09ab070dd9ceea","type":"tab","label":"Shutdown/Restart RPi","disabled":false,"info":"","env":[]},{"id":"c7cdf82876806fcb","type":"shutdown","z":"3f09ab070dd9ceea","name":"","x":380,"y":200,"wires":[]},{"id":"fa94ebba60d211c9","type":"restart","z":"3f09ab070dd9ceea","name":"","x":370,"y":260,"wires":[]},{"id":"5ab85d78890755ee","type":"inject","z":"3f09ab070dd9ceea","name":"Shutdown","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":200,"wires":[["c7cdf82876806fcb"]]},{"id":"0dedf5962bd32b56","type":"inject","z":"3f09ab070dd9ceea","name":"Restart","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":260,"wires":[["fa94ebba60d211c9"]]}]code-box

Visit the official page of the node-red-contrib-rpi-shutdown node for more detailed information.

0/Post a Comment/Comments