Node Status not showing 0 (Zero)

I just noticed that I don't seem able to get node.status to display the number 0 (all other numbers work fine)


[{"id":"1191ad9f.48c342","type":"inject","z":"8376d5c1.273ed8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":440,"wires":[["84aedd8f.11963"]]},{"id":"84aedd8f.11963","type":"function","z":"8376d5c1.273ed8","name":"","func":"node.status({fill:\"blue\", shape:\"ring\", text:msg['payload']});\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":440,"wires":[["ef476a35.b56e78"]]},{"id":"ef476a35.b56e78","type":"debug","z":"8376d5c1.273ed8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":440,"wires":[]},{"id":"e62c4e54.d3746","type":"inject","z":"8376d5c1.273ed8","name":"","topic":"","payload":"1232456","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":420,"y":500,"wires":[["84aedd8f.11963"]]}]
node.status({fill:"blue", shape:"ring", text:msg['payload']});
return msg;


I think you'll find it's an issue in that release.
I reported it to Nick for v1.0.0-beta.2.
See below...

I've just upgraded to NR v1.0.0-beta-2 and found the fill and/or shape attribute doesn't work.
Here's a snippet that used to work fine in the previous release.
Cheers from David

var fsm_state = flow.get("state_counter");

if (fsm_state === 0 || fsm_state == 1){
msg.payload = 1;
node.status({fill:"red",shape:"dot",text:"Red ON"});

else {
msg.payload = 0;

return msg;



May 27

After some testings I found that fill and shape attribute doesn't work after first occurrence. And somehow the debug node can still handle the status with shape correctly.

Works until you once set empty object to status

It might be related but mine is just failing to display the number 0 - all other numbers work fine - text/string 0 works fine

Just compared your flow with my FSM traffic lights coding and found...

node.status({fill:"blue", shape:"ring", text:""+msg.payload});
return msg;

Works fine (but the fill and shape don't appear - known issue, I think).


node.status({fill:"blue", shape:"ring", text:msg.payload});
return msg;

Fails to show anything when zero is input (as in your original post).

Hmmmm that might indeed be when text is expecting a string. The ""+variable approach casts the variable to a string, while the other keeps it as integer.

Interesting, because when it is about creating custom nodes the best practice is that the node should be forgiving:

  • be forgiving in what types of message properties it accepts. Message properties can be strings, numbers, booleans, Buffers, objects, arrays or nulls. A node should do The Right Thing when faced with any of these.


Should this be considered a best practice for commonly used, exposed runtime functions as well? Like the text parameter expects a string, but if something else gets passed to it it will try to create a string from it first before displaying?

Thanks for the detailed response.
I've learnt a bit more today - thanks.

Sounds like a bug to me, and yes it should be forgiving.

Should Simon or myself report it, or have you noted it in your 'little-RED' book ??

Yes please

I've raised an issue and posted link to here

1 Like

Now fixed on github. Will be in the next 0.20.x or 1.0 release - whichever comes first.