Switch a flow on or off

I would like to use a dashboard switch to allow or stop a flow of time triggered analog data from a sensor input to a save to file node.

It seems like a fairly simple task to request but I can't picture how I can do it.

On the dashboard switch properties I can see True and False or could make it a number 0 and 1, but what node can I use to "switch" the flow?

The Function Switch node seems like a logical choice but I need an in and an out for the flow, and I need somewhere to connect the output of the Dashboard Switch?

Does it have to do with Topic?
Do I use the input of the Function Switch for both the flow and the switch and somehow tell it what to do the the properties settings of the Function Switch?
I have not yet grasped the concept of Topic. Can anyone suggest a simple tutorial that could help?

Thank you.

The cookbook is always a good place to start.
Take a look at this flow and it should give you a start on how a dashboard switch could control a different flow


Thank you.

So there is no connecting line between the change node and the switch node.
It just magically watches the value of state without any connection.

Well it’s not magic.


Or you could use a function node as a simple gate (and keep the wiring visible).
Up to you

I recommend using node-red-contrib-simple-gate for this. You can feed the signal from the switch straight into it to control whether it allows messages to pass or not.