Subflow disappointment

I just finished developing a subflow which controls my TFT display, its self contained using mqtt to send info to the display and receive info like when the screen is pressed etc, the subflow has just 3 outputs to interact with the main flow all the other necessary variables in the subflow are from flow.set(.parent,bla bla flow.get('.parent,bla.bla, it works great, but one of the reasons I transferred the code into a subflow was the thought that I could disable the subflow just like a normal flow, but shock theirs no disable switch ,
Is there any other way I can disable this subflow ?

You will be able to disable them in 1.0.

The latest 1.0 beta allows you to enable/disable individual nodes (and subflows).
Prior to that you could only disable tabs (and yes subflow "tabs" didn't count as real flow tabs so can't be disabled. But seeing as it's a subflow - could you not just unwire it's one input and it won't be triggered...

2 Likes

I am on node-red 0.20.7 so it looks like I need take a look at 1.0.3

(the subflow node doesn't have any input its triggered from the TFT screen via mqtt)

Most solutions (pre-1.0) include a switch node right before the subflow -- the switch test expression can refer to a flow or global variable (e.g. isTFTenabled flag) and drop any incoming messages unless that variable is set.

Then you can build other flows to set that flag -- like setting it to true/false based on the position of a dashboard switch, or the time of day, or toggled by an inject node in the editor...

Sorry, missed that little detail... In that case, your go/nogo switch will have to be included inside the subflow -- which is unfortunate, since you'll have to use global context.

2 Likes

I'll play Devil's advocate here.

Suggestion @Dave.

Although you are trying to avoid it, have an input to the sub-flow as @shrickus was hoping.
But use that input as suggested.

Then in the subflow use that input signal to control of the sub-flow is used or not/accepts inputs.

That is a way around the problem as it stands.

I have seen this in the "edit" dialog, that's good. Is there an api as well so I can do it from code?

No, the code solution is to create gate like nodes as above

Thanks for all the suggestions, the reason I wanted to disable the subflow was to include the same subflow on a different pi and have that one send the info to the TFT, currently just for testing, I don't really want extra switches and stuff.

I found a simple solution for that until I upgrade to nr 1.0. I just exported the subflow into the Library then deleted the subflow, same on the second pi, then I just import the subflow on which ever pi I want TFT to work with. sorted.

1 Like