I need to understand looping. I can see how to do this within a function node, but I want to repeat a set of nodes (slightly changing the parameters). If I used an Inject node set to repeat every second, how can I tell it to stop, after x times, or when a condition is matched?
I am aiming to have an app running from (probably) a windows scheduled batch file. After developing in Node-red, can I somehow package it up, so it can run independently? I have read that you can start node-red with a named flow, but I'm not sure how to export/save a flow, so that this can be specifically run. It seems like every flow in my node-red system that has an inject node set to automatic starts running, even though only one is named.
You can’t stop an inject node, but you could have a counter in a function node that stops sending a message forward after a certain number of times.
You can’t package flows to run independently.
“It seems like every flow in my node-red system that has an inject node set to automatic starts running, even though only one is named.”
You need to explain this in more detail
That means that you can specify a flow file when when you start node-red, not an individual flow tab in a file. Unfortunately the word 'flow' is rather overloaded in node-red.
To test how it works, I have two flows named 'RM' and 'fake' They each have an inject node set to automatic after 1 sec and 2 secs, and each link to a file output that appends to the same file with a simple message saying which flow 'This is RM' or 'This is 'Fake'.
When I click DEPLOY, Both flows append to the file without any further user action.
I'd now like to run it from the command line, so that only RM fires.
I tried 'node-red RM' as a named flow (and node-red RM.json) but this seems to want to create a new flow.
My reasons for this are that in my node-red system I will have lots of flows, but would like to isolate just one for running from the command line.
Thanks for explaining that Colin, it makes perfect sense. I envisage having a very messy node-red environment (the default flow file with lots of tabs with half written code) but would like to maintain a very pure 'production' flow file for the successful flow. I assume the way to do this is to start node red with two separately named flow files.