Deploy/ launch a node-red flow with a shortcut on raspberry

Hello guys,
I'm in the projet of making a kind of on-board computer for my tractor with a Raspberry pi, the main purpose of this will be to collect data from the baler attached to the tractor. Anyway, is just a matter of detecting a signal on a GPIO pin, and make an action. I had think that node-red would be a good idea, but I would-like to be able to have a shortcut on the Rpi Desktop that will deploy the flow on node red and launch the dashboard of the baler. I was thinking of a script but I'm quite lost with node-red, I only used it one time during my studies.

cheers

Why not just have node-red running all the time and have a shortcut to the browser to open the dashboard url?

2 Likes

yes, but I would have the possibility to make other flows for other implements..
knowing that each flows will use the same pins

In that case you will have to write a script to start node red with the flow file you want. Also you will need to be able to kill that instance when you want to.

First thank for your answers.
I've seen that you can lauch node-red with a specific settings.json file, it's with this option or there is another option ?

Pretty sure that if you run
node-red path/to/flowfile.json
that it will use that file. You can easily test that.

You might want to go a bit further, you can give Node-RED a completely different userDir folder which contains flow, credentials, projects, settings.

node ../node_modules/node-red/red.js --userDir ../data

In the above case, I am executing a version of Node-RED installed to a specific folder, the script to call it would need to be in the same folder as Node-RED was installed to. Adjust the path to Node-RED and the userDir according to need.

Possibly a bit of a different approach than most are suggesting here, but what about having the flows coexist and use a switch node to evaluate what flow should be receiving the data at a given time? You could set up a dropdown on the dashboard and send the output to the variable.

Thanks for all of your answers, I don't know now how I will do it but I'm pretty sure I will find a solution with your answer.