After a longer period the inputs from my pi stop reacting.
Then i move a node and click deploy all and problem solved.
Now thinking about a cron job to deploy every night to prevent problems.
Is it possible to send a deploy all command from command line?
Or is there another way to do this?
Not sure how to troubleshoot your problem, but wouldn't it be better to fix the issue instead of giving it first aid?
...could always order a reboot from within node-RED itself.
If you wanted to order a reboot via MQTT, just replace the inject node with a MQTT in node, and possibly a Switch node to watch for the keyword for a reboot.
Do you mean a gpio digital input with a mechanical switch connected to it? If so connect a debug node to the input and next time it fails see if anything is shown in the debug.
Write the MQTT msg with a retain flag. Then, in your cron job, use a small Python or node.js (depending on your preference) script to listen for the topic, reset it and then restart the device.
In addition, I've shared before my own flow for restarting Node-RED and it is really easy on a Pi or other Linux device where you are using systemd to run Node-RED. The only thing you need to do is to ensure that the user id running Node-RED is able to do SUDO on the systemctrl command without requiring a password prompt (use visudo to make the change).
I'm curious what these commands are: node-red-restart / -stop. I couldn't find them among the node-red commandline, nor could I find relevant custom nodes in the palette.
Could you kindly point me in the right direction, please?
Thanks in advance!
node-red-restart, oddly enough, stops the node red service and starts it again, node-red-stop stops it, and node-red-start starts it (and shows the startup log in the terminal).
Note that it is node-red-restart and not
node-red -restart
Similarly for the other commands. They are commands run in a terminal, not nodes.
Start/Stop and restart depend on how you have got Node-RED set up.
But because Node-RED is a node.js app, you can use the package.json file to create suitable scripts that you can then run as npm start and npm restart. On my Windows installs, those scripts control PM2 and on my live install on Debian Linux, they use systemctl as I use systemd there (as you would on a Pi as well which is a form of Debian). Though I have a Mac, I haven't used Node-RED on it so I don't know how you would normally start/stop but since it isn't as likely to be a permanent server but more like a desktop/laptop, you might consider using PM2 as I do on my Windows desktop.