Automating the enabling/disabling of flows (tabs)

One of the advantages of the built-in automations in Home Assistant is the "on/off" switch you get when you display an automation in the UI and the ability to have one automation enable/disable another.

Would love to be able to do the same in Node-RED for each flow (=tab). Being able to enable/disable an entire flow (not just a series of connected nodes) makes it much easier to know which automations are active and which are not. It is also much easier and more efficient than having to insert a switch node in every series of connected nodes within the flow. There is no reason that the flow even starts and stops at the toggle node / flow variable if the flow is not doing anything.

My use case is my Christmas flow, my Halloween flow, and so on, but it would be useful for many things that can be packed into a single flow. Each of these flows contains several advanced flows within them (series of connected nodes) that only need to run on a specific day or a specific month.

The enable/disable part is already implemented. Now let us be able to automate it in the spirit of Node-RED. Thanks!

You do know you can disable a flow (tab) already right?

chrome_mldWcnNS1Q

@Steve-Mcl I think the ask here is to be able to enable/disable flows dynamically from with the flow logic.

@DIYtechie this isn't currently possible, but it is something that has come up a couple times - along with being able to dynamically enable/disable individual nodes.

So it may be worth a revisit to understand the challenges in achieving it.

Our default response has been that requires a deploy because the enabled/disabled state is reflected in the flow configuration - and that flows should not be rewriting the flow configuration.

If your flows are being dynamically enabled/disabled then Node-RED restarts, all of the flows will be restored to what was last deployed.

This is similar to how you can mute/unmute individual Debug nodes which takes effect instantly, but won't be persisted unless you hit deploy.

There is also the challenge of how that state gets reflected in the editor so you know the current 'true' state of the flows. If you've just edited the flow to enable/disable it manually, not yet hit deploy, and then your flow gets enabled dynamically, we have a muddled set of states to reflect.

It's potentially quite a large can of worms to open.

First of all, thank you, I really appreciate the swift and detailed response.

I don't understand how everything works underneath so making a feature request is of course a lot easier than implementing one. I'm of course thinking it must be possible and as an automater, I would really love not having to manually enable and disable my Christmas and alarm flows etc.

In order to better understand what you need, can you describe, as an example, what your Christmas flow does?

My Chrismas flow has a few sequences that are triggered by motion and light level sensors and controls the Christmas tree lights and the outside Christmas lights.

My alarm flow has many sequences that sends different notifications if different kinds of sensors are triggered around the house when we're not home.

The Halloween flow triggers different light and sound effects if motion is detected in front of the house.