# Subflow node.status

**URL:** <https://discourse.nodered.org/t/subflow-node-status/16927>\
**Category:** Feature Requests\
**Created:** [20 October 2019 14:58 UTC](https://discourse.nodered.org/t/subflow-node-status/16927 "2019-10-20T14:58:32Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dave/32/10827_2.png) [@Dave](https://discourse.nodered.org/u/Dave)\
**Post date:** [20 October 2019 14:58 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/1 "2019-10-20T14:58:32Z")

</div>

I have been developing some subflows recently, the biggest thing I miss is the ability to use node.status in function nodes and the fact that there is no indication on trigger nodes etc etc, it makes tracking down problems very difficult in fact on several occasions I have had to resort to pasting the flows from my subflow back into a normal page (deleting all of the $parent. statements etc) just to find why a subflow is not working as expected.

I know I can add the status node which displays stuff under/on the subflow node and I can add an extra output or two to the subflow node and feed them to a debug nodes outside the subflow which is useful but in reality it doesn't replace the need for node.status indication.

I am guessing there has to be a big reason why 'node.status' does not work in subflows but thought I would ask if theirs any chance in the future this could be implemented.

* * *

I also noticed that in 10.0.2 the dotted lines are now normal lines ... actually I didn't mind the dotted lines it was a reminder that I was working on a subflow another point that has cought me out several times is in a subflow global.get( does not need $parent. but flow.get( does .. ok I get that global is everywhere, flow.get( is specifically from the flow containing the subflow node but its still a bitch when you forget.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 October 2019 15:24 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/2 "2019-10-20T15:24:28Z")

</div>

> [@Dave](#):
>
> I am guessing there has to be a big reason why 'node.status' does not work in subflows but thought I would ask if theirs any chance in the future this could be implemented

Imagine a flow file that uses ten instances of the subflow. If you open the subflow in the editor which one of the ten instances would you like to see the status for?

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dave/32/10827_2.png) [@Dave](https://discourse.nodered.org/u/Dave)\
**Post date:** [20 October 2019 16:14 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/3 "2019-10-20T16:14:12Z")

</div>

Hmmm I never used one subflow multiple times so I guess your right it would be a problem.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [20 October 2019 19:32 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/4 "2019-10-20T19:32:59Z")

</div>

When _building_ the sub-flow where you assign how many inputs/outputs there are, there is a button with `status node`.

Add a `status-all` node and connect it to the newly created `status` _node_ and you will see any `node.status( )` messages below the sub-flow node.

---

<div class="post-metadata">

**Author:** ![zoltansz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zoltansz/32/7487_2.png) [@zoltansz](https://discourse.nodered.org/u/zoltansz)\
**Post date:** [2 September 2020 07:49 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/5 "2020-09-02T07:49:15Z")

</div>

Wow! This is fantastic! Thx for the info!

---

<div class="post-metadata">

**Author:** ![danielo515](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/danielo515/32/31899_2.png) [@danielo515](https://discourse.nodered.org/u/danielo515)\
**Post date:** [30 January 2021 14:47 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/6 "2021-01-30T14:47:21Z")

</div>

How did you know? I would never guessed.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 January 2021 15:46 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/7 "2021-01-30T15:46:03Z")

</div>

Possibly from reading the docs  
[https://nodered.org/docs/user-guide/editor/workspace/subflows](https://nodered.org/docs/user-guide/editor/workspace/subflows)

---

<div class="post-metadata">

**Author:** ![danielo515](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/danielo515/32/31899_2.png) [@danielo515](https://discourse.nodered.org/u/danielo515)\
**Post date:** [30 January 2021 16:43 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/8 "2021-01-30T16:43:20Z")

</div>

Do you mean this?

> Status node  
> The toolbar provides an option to add a ‘status’ output to a subflow. This can be used to update the Status of subflow instance nodes.

That's all the info on the docs. Maybe it's just me, but that doesn't give me a clue about how to use it

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 January 2021 17:05 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/9 "2021-01-30T17:05:03Z")

</div>

Well it does assume you know what a node status is, and how to use a Status node. I assumed that by the time anyone got as far as using subflows they would know about node status and the use of Status nodes.  
However it does appear that Status nodes are not well documented (or even not documented at all) in the User Guide, so it appears my assumption was ill founded. Pull Requests for enhancements to the docs are always welcome, I believe, and that might be a good way to start getting involved in the project.

---

<div class="post-metadata">

**Author:** ![danielo515](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/danielo515/32/31899_2.png) [@danielo515](https://discourse.nodered.org/u/danielo515)\
**Post date:** [30 January 2021 22:07 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/10 "2021-01-30T22:07:35Z")

</div>

> [@Colin](#):
>
> However it does appear that Status nodes are not well documented (or even not documented at all)

There is where my confusion comes from. I saw the reference to status, but I was expecting a link to a more detailed explanation about how to use status nodes and how they work. I searched both docs and Google for documentation about the status node, but I didn't found any.  
Sure I can make a PR now that I know how it works, but before thar I had no choice but ask.

---

<div class="post-metadata">

**Author:** ![Jpsy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpsy/32/22707_2.png) [@Jpsy](https://discourse.nodered.org/u/Jpsy)\
**Post date:** [2 February 2021 11:26 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/11 "2021-02-02T11:26:01Z")

</div>

Here is an example of how to use the status node of a subflow:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/a/baef4b98890deb566c291f2271db43622789d658.png)

The function node contains:

```auto
let statusMsg = { fill:"green", shape:"dot", text:"My status message" };
return [msg, {payload:statusMsg}];

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 March 2021 02:35 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/12 "2021-03-26T02:35:58Z")

</div>

(Been away in case you hadn't noticed)

There is an option for the status to be sent to an output.

---

<div class="post-metadata">

**Author:** ![Moosbueffel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/moosbueffel/32/36732_2.png) [@Moosbueffel](https://discourse.nodered.org/u/Moosbueffel)\
**Post date:** [18 August 2021 13:49 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/13 "2021-08-18T13:49:42Z")

</div>

@Jpsy I was so glad to find your solution, but it doesn't work. I explicitely copied your code. What I have in my subflow:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0d581cbb7be4ff5373e29c8f71afc40e6782c16c.png)

```auto
// show status message at subflow node
let value = msg.payload === true ? "on" : "off";
let statusMsg = { fill:"green", shape:"dot", text:"Automatic: "+ value };

return {payload:statusMsg};

```

This is a working code in the case of getting my on/off result out of the subflow. But no status message and no output on "output 3".

What i find out:  
I copied the flow out of subflow in a testflow. Of course I got an additional button on the dashboard. Using original switch, nothing happens as before. But if I use the new switch (from outside the subflow) I get also the message and status out of the subflow!?

I'm confused? What's wrong? Is it not allowed to use dashboard nodes inside subflows??

Here the whole subflow, but it need the gate-node:

```auto
[{"id":"bf2492af.6b49a8","type":"subflow","name":"invert boolean","info":"","category":"","in":[{"x":40,"y":80,"wires":[{"id":"9e8c468b.c1fd98"}]}],"out":[{"x":360,"y":80,"wires":[{"id":"9e8c468b.c1fd98","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"9e8c468b.c1fd98","type":"function","z":"bf2492af.6b49a8","name":"invert boolean","func":"msg.payload = !msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":80,"wires":[[]],"info":"Invertiert den boolschen Wert am Eingang"},{"id":"349f3267.282b16","type":"subflow","name":"auto on/off","info":"","category":"","in":[{"x":60,"y":420,"wires":[{"id":"e7642ff8.6ecc6"},{"id":"8050d627.fe0958"}]}],"out":[{"x":860,"y":360,"wires":[{"id":"196bf120.478bff","port":0}]},{"x":860,"y":420,"wires":[{"id":"8050d627.fe0958","port":0}]},{"x":840,"y":80,"wires":[{"id":"5bfd9175.e4ebb8","port":0}]}],"env":[],"meta":{},"color":"#DDAA99","status":{"x":840,"y":40,"wires":[{"id":"89b32369.7cf2a","port":0}]}},{"id":"150dfb6.a90a385","type":"ui_switch","z":"349f3267.282b16","name":"","label":"A-Boiler on/off","tooltip":"","group":"c14af889.9a4db","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"switch","topicType":"str","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":true,"x":440,"y":300,"wires":[["196bf120.478bff"]]},{"id":"5bfd9175.e4ebb8","type":"ui_switch","z":"349f3267.282b16","name":"","label":"Automatic mode","tooltip":"","group":"c14af889.9a4db","order":4,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"switch","topicType":"str","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":true,"x":160,"y":80,"wires":[["f3016ff7.47c398","6b7ffefc.0e89f8","36de4653.d2419a","89b32369.7cf2a"]]},{"id":"e3435a58.cf6b4","type":"change","z":"349f3267.282b16","name":"control switch","rules":[{"t":"set","p":"enabled","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":240,"wires":[["150dfb6.a90a385"]],"info":"Enable/disable switch and control on/off\n\n **Enable** when `automatic == off` \n **Disable** when `automatic == on` \n\nSet **switch ON** , when `automatic == off` \nSet **switch OFF** , when `automatic == on`"},{"id":"8050d627.fe0958","type":"jvmg_gate","z":"349f3267.282b16","name":"Boiler automatic","default":true,"trigger":"a94dd678.e92fe8","x":700,"y":420,"wires":[[]]},{"id":"196bf120.478bff","type":"jvmg_gate","z":"349f3267.282b16","name":"Boiler Manual","default":true,"trigger":"7efb2b1d.1838e4","x":700,"y":360,"wires":[[]]},{"id":"f3016ff7.47c398","type":"jvmg_key","z":"349f3267.282b16","name":"Automatic control","trigger":"a94dd678.e92fe8","x":690,"y":140,"wires":[]},{"id":"1ee5b905.b843df","type":"jvmg_key","z":"349f3267.282b16","name":"Manual control","trigger":"7efb2b1d.1838e4","x":680,"y":200,"wires":[]},{"id":"6b7ffefc.0e89f8","type":"subflow:bf2492af.6b49a8","z":"349f3267.282b16","name":"","env":[],"x":440,"y":180,"wires":[["1ee5b905.b843df","e3435a58.cf6b4"]]},{"id":"e7642ff8.6ecc6","type":"function","z":"349f3267.282b16","name":"latch","func":"\nif (msg.payload === 'repeat') {\n msg.payload = context.get(\"lastValue\");\n msg.topic = 'repeat'\n} else {\n context.set(\"lastValue\",msg.payload);\n}\nnode.status({text:msg.payload});\nreturn msg;","outputs":1,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\n\ncontext.set(\"lastValue\",false);","finalize":"","libs":[],"x":410,"y":360,"wires":[["8050d627.fe0958"]],"info":"\n\nSave the last value in a context variable. \nIf keyword 'repeat' received, this lase value will be send again."},{"id":"36de4653.d2419a","type":"switch","z":"349f3267.282b16","name":"if true","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":210,"y":240,"wires":[["4b0ce538.4978cc"]]},{"id":"4b0ce538.4978cc","type":"change","z":"349f3267.282b16","name":"send 'repeat'","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"repeat","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":170,"y":320,"wires":[["e7642ff8.6ecc6"]]},{"id":"89b32369.7cf2a","type":"function","z":"349f3267.282b16","name":"","func":"// show status message at subflow node\nlet value = msg.payload === true ? \"on\" : \"off\";\nlet statusMsg = { fill:\"green\", shape:\"dot\", text:\"Automatic: \"+ value };\n\nreturn {payload:statusMsg};\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":40,"wires":[[]]},{"id":"c14af889.9a4db","type":"ui_group","name":"Ute","tab":"297873db.981d0c","order":1,"disp":true,"width":"6","collapse":false},{"id":"a94dd678.e92fe8","type":"jvmg_trigger","trigger":"Automatic"},{"id":"7efb2b1d.1838e4","type":"jvmg_trigger","trigger":"Manual"},{"id":"297873db.981d0c","type":"ui_tab","name":"Sonoff","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 September 2021 09:48 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/14 "2021-09-10T09:48:11Z")

</div>

Me, reading the docs????!!!!! 😉

I'm male. It's in our genetics to not read that stuff. 😉

---

<div class="post-metadata">

**Author:** ![Putzeimer](https://avatars.discourse-cdn.com/v4/letter/p/a9a28c/32.png) [@Putzeimer](https://discourse.nodered.org/u/Putzeimer)\
**Post date:** [6 February 2023 00:35 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/15 "2023-02-06T00:35:09Z")

</div>

Maybe a nicer way of using status in a subflow is by using a status node:  
 ![subflow-status](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/d/9d8101d1d08595a213b3f98aea41af07fc264b87.png)

In the function node use:

```auto
node.status({ fill: 'yellow', shape: 'dot', text: 'Status message' });

```

No need to add an extra output to the function node.

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [6 February 2023 16:32 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/16 "2023-02-06T16:32:05Z")

</div>

> [@Putzeimer](#):
>
> nicer way of using status in a subflow is by using a status node

Is this a distinction without a difference or does it really matter?  
🤷‍♂️

---

<div class="post-metadata">

**Author:** ![Putzeimer](https://avatars.discourse-cdn.com/v4/letter/p/a9a28c/32.png) [@Putzeimer](https://discourse.nodered.org/u/Putzeimer)\
**Post date:** [6 February 2023 17:03 UTC](https://discourse.nodered.org/t/subflow-node-status/16927/17 "2023-02-06T17:03:33Z")

</div>

> [@LosinIt](#):
>
> Is this a distinction without a difference or does it really matter?

None that I'm aware of. I guess it's more a choice of personal preference than a technical issue. I suppose that the solution with a status node is more the _node-red way_, but in the end, both solutions do the same.
