AutoStart Pythonshell

Hello,

I am able to start Node-Red when the Raspberry PI resets or on power up. How can the Python script start when node red is open with a manual inject to start the program. I am using a Raspberry PI to monitor sensors and need to protect for reboot or power loss. The program needs to AutoStart and start collecting data without any interaction. Any ideas?

Typically I ask what it is you are doing that actually needs python?

It is very likely you can forgo the trouble of running python scripts and keep it all nicely in Node-RED - that is the way I recommend

If that is something you want to look into, tell us what you are doing that needs python.

Otherwise, look at the inject node - it has an option to inject once on start up:

image

...and with that you can trigger an exec node that starts the script

I don't understand "with a manual inject" there.

But there is a node to automatically start external processes: node-red-node-daemon.

A Node-RED node that runs and monitors a long running system command.

Similar to the exec node - but this calls the command at start time and then pipes any input to the node to the STDIN of the running command, and feeds any STDOUT to the first output.

Useful for monitoring command line based processes.

Like any other node, you can trigger the daemon node with either a manual inject or an inject at startup (But beware of multiple copies of the process running each time you do a full refresh)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.