# Node Status not showing 0 (Zero)

**URL:** https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746
**Category:** General
**Created:** [27 July 2019 10:43 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746 "2019-07-27T10:43:45Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [27 July 2019 10:43 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/1 "2019-07-27T10:43:45Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/79f10834a1d14579663423d77dc4884613b39bf1.png)

```auto
[{"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"]]}]

```

```auto
node.status({fill:"blue", shape:"ring", text:msg['payload']});
return msg;

```

V0.20.7

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [27 July 2019 11:20 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/2 "2019-07-27T11:20:15Z")

</div>

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;  
node.status({});  
}

return msg;

[![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4d1b654cc38ee406b1f8140d2977e9b04402cfcc.jpeg "hotNipi")](https://discourse.nodered.org/u/hotNipi)

[hotNipi](https://discourse.nodered.org/u/hotNipi)

[1](https://discourse.nodered.org/t/node-red-1-0-0-beta-2-released/11504/18#)

[May 27](https://discourse.nodered.org/t/node-red-1-0-0-beta-2-released/11504/20)

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  
`node.status({});`

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [27 July 2019 12:20 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/3 "2019-07-27T12:20:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [28 July 2019 07:21 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/4 "2019-07-28T07:21:03Z")

</div>

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

```auto
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).

However...

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

```

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

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [28 July 2019 07:50 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/5 "2019-07-28T07:50:43Z")

</div>

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.

Source: [Creating Nodes : Node-RED](https://nodered.org/docs/creating-nodes/)

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?

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [28 July 2019 07:52 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/6 "2019-07-28T07:52:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [28 July 2019 07:54 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/7 "2019-07-28T07:54:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [28 July 2019 07:56 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/8 "2019-07-28T07:56:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [28 July 2019 08:27 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/9 "2019-07-28T08:27:03Z")

</div>

Yes please

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [28 July 2019 08:54 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/10 "2019-07-28T08:54:27Z")

</div>

I've raised an issue and posted link to here

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [6 August 2019 14:27 UTC](https://discourse.nodered.org/t/node-status-not-showing-0-zero/13746/11 "2019-08-06T14:27:16Z")

</div>

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