Help with sub-flow and `node.status`

I am wanting to make the node show either a red or green filled circle depending on the condition.

The message I send...... Is the important stuff in payload or do I have to put it in status?
(Semi rhetorical, but I have to ask)

Haven't used it in a subflow, but assume it's the same...

[{"id":"685d4506.0d2e2c","type":"function","z":"c9c4eeb8.bad8e","name":"","func":"if (msg.payload == \"yes\") {\n    node.status({fill:\"green\",shape:\"dot\",text:\"Yes\"});\n} else if (msg.payload == \"no\") {\n    node.status({fill:\"red\",shape:\"dot\",text:\"No\"});\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":430,"y":2140,"wires":[[]]},{"id":"76b5853a.f401fc","type":"inject","z":"c9c4eeb8.bad8e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"yes","payloadType":"str","x":240,"y":2120,"wires":[["685d4506.0d2e2c"]]},{"id":"c6343d.5d309bc","type":"inject","z":"c9c4eeb8.bad8e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"no","payloadType":"str","x":240,"y":2180,"wires":[["685d4506.0d2e2c"]]}]
1 Like

Yeah, ok.

It is msg.payload and has to be like this:
msg.payload = ({fill: "green",text:"Good"});

And that is sent to the node.status output.

Sorry folks.

All good now.

Like that it seems to work.
(I get the message and colours as shown)

Thanks Paul. Alas not quite from what I got working.

I'm not seeing any node.status indicator in your screenshot above, all you seem to be doing is creating conditional statements to format the payload.

My bad for not editing the piccie.

That appears when I tick the box to have a status output.

But I'm still not seeing a red or green filled node.status circle, like you described in post #1?

Ok, this is what I am seeing when I am testing it.

Aah right, I see what you are doing now. You are using the subflow status node :+1:

Sorry, I thought that was understood.

No problems.

All good.

Thanks though for the checking.

1 Like

I should have spotted the status node in your screenshot. It's been a long day!!
You are probably more familiar with subflows than me, I must learn to make more use of them.

Don't worry. I am as guilty of that as anyone.

Don't stress. All good.
But again: Thanks for the replies. I like/need sanity checks to keep me on the straight and narrow.

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