No info under sub flow nodes

Hi,
I'm rather new to node red having installed it for home assistant. I managed to get it working, the more I added the more monstrous my flow became so I decided to split it into subflows, which works great, but the nodes in the subflow don't show when / if they have been activated which makes debugging impossible. Is there an option to show the text under node inside the subflow same as it would show if the node was activated in the main flow window?

Hope that makes sense.

do you mean the status under a node - like this...
image

if so, then you need to consider what is happening.

A subflow is a essentially a "class" & when you use a subflow, you create an "instance"

In other words, the subflow cant show you status internally as it wont know which one you are looking at.

In PLC terms, its like a function block, you create multiple instances & each have their own life & own values (so to speak)

In cooking terms, a subflow is a "recipe" and you make "meals" from the recipe.

There is an art to know when to use them and what to put into a subflow. My recommendation is, keep your subflow design atomic (do one task & do it well) (PS, by "do one task" I dont mean have one node inside the subflow - you can have lots of nodes that calculate a complex number for example).

Sticking to that maxim has many side benefits I wont go into. but one of the benefits is as it only has one well defined function, you can actually set a status for the subflow ...

image

and it will appear on the main flow under subflow node instance.

Hope that rambling makes sense?

It does make sense sort off though I guess for my newbie use the subflows are not the right thing. I get node red can do all kinds of magic with what passes through the nodes, but I honestly just want to use it as a "dumb" flow diagram thingy.

I.e. I don't really care what the information going through the nodes is, I only care about it activating the node and showing me under the node when it done so as the only nodes I use are nodes like turn light off/on set color on light etc, for those it's irrelevant what the message payload is. I think I will stick with https://flows.nodered.org/node/node-red-contrib-components as that seems to do what I want.

Thanks again.

1 Like

I personally wouldnt use that node (you cant really see where the wires go) - arent link nodes enough to separate things out for you?

Uhh, I guess link nodes are another thing to look into - no idea how they work (It's less than 2 weeks I installed NR honestly), I got another discussion over on HA forum perhaps that will show you what I'm trying to achieve: https://community.home-assistant.io/t/node-red-best-practice-question/210285

I started with the tangled mess, then went to components, then to subflows.

Basically what I wanted to achieve is having it split on different subflow pages, while still showing when the node has been activated by whatever passing through it under it, as it did/does when I had it in the tangled mess or split into components.

I think link nodes would be a better way to go.

That are core components and very easy to use and can achieve mostly the desired effect.

Note, you can always use debug nodes with the tick box to show status set. Alternatively, you even add a function node with this code in...

node.status({text:msg.payload});
return msg:

You can display whatever you desire under the node. More info here

1 Like

If you want to show the status of only a certain node within a subflow you can catch the status of that node with a status node within the subflow tp forward it with a change node to the optional status output of the subflow.
I actually use this quite a lot with subflows that contain something like a websocket or sse client in addition to function nodes and so on to show if the node within the subflow is connected. You could also add an additional output for debugging to your subflow that sends all status changes within the subflow to that output and than connect a debug node to that output.

Hope this gives you some additional inspiration.

Johannes

1 Like

I've been working with subflows recently so was interested in this thread

I followed that link to the contrib-component node and thought - that looks a cool idea.

Like having subflows but being able to see the inside (and any node statuses within it)

I installed it and had a play and I'm not sure why it has the UI options but it works very simply.

I then read @Steve-Mcl suggestion over using link nodes as an alternative and thought - yep - I'll just use them instead even though less convenient

And then I thought - hang on - using links wouldn't be re-usable like subflows - I'd need to repeat the same set of nodes every time I want it :frowning: (but good for one -off maybe)

And then I thought - same thing would happen with components :frowning:

So its back to subflows for me

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.