I have a headless Raspberry Pi running Node-RED.
It is used in a teaching and learning context, so I cannot be sure what flows will remain loaded when the user shuts down the Pi.
I would like to ensure that, in addition to whatever flows the user left deployed, a standard flow is imported and deployed. I'll be using this flow to run a startup routine.
Is there a way to do this?
To be clear, you want your standard flow to be the one that runs when the Pi restarts? But you still want to retain any other flows that were created previously?
Seema like the 'Project' feature would work best for this. Flows can then be saved into various projects. The node-red command-line lets you choose which project to load.
@TotallyInformation - Yes
Lesson 1: Standard flow loads. User adds other flows. Then shuts down.
Lesson 2: All of the flows from Lesson 1 load. User deletes Standard Flow. Then shuts down.
Lesson 3: Standard flow loads as well as any others from lesson 2.
And so on. All the flows from a previous lesson load. The Standard flow loads even if it was closed previously.
@paulkeates - Projects is on my list to explore. Can you point me to documentation on "The node-red command-line lets you choose which project to load"
Thanks to you both!
I don't believe you need anything clever to achieve this.
What I would do would be to create a standard deployment of node-red along with the standard flow pre-configured in the node-red library.
Then in lesson 1, the student starts with a blank flow and the first step is to load the standard flow from the library then click deploy.
Since the standard flow is in the library, resetting is as simple as deleting the flow json. Node-RED will create a new blank one on restart. Or, if the standard flow is on its own tab, a messed up standard flow can be deleted and reloaded from the library.
Thanks for the response. I kept my initial description brief...perhaps too brief.
One of the key functions of the standard flow is to say the device's public IP out aloud.
I need this to happen because the device will be used in lots of contexts in which access to the router and other standard methods of finding the IP are not available.
So, if the user closes the standard flow and forgets to add it back, that will massively complicate my classroom setup, as I'll have to work quite hard to find the IP.
The standard flow also implements some key actions and fetches some data readings.
Unless you can think of a better approach to this?