Weird behaviour of Dropdown node with a numeric 0 item

If in a Slider node you select a numeric 0 valued item it returns in the message.payload an array[0] instead of the plain 0 value as expected. If the value is set as a-z string it correctly returns a "0" string.

I'm using dashboard 2.23.2.

It looks like a numeric 0 value fools the node as the option "Allow multiple selection from list" would have been checked (which is not in my case).
Of course I can avoid to use a numeric 0 item and change my code, but I think that this behaviour should be fixed and the node should return 0 as any other numeric values.
I attach the image and the (very simple) code snippet.

PS: can someone please explain me how I can enclose the flow code in one line without pasting in the post all lines or without uploading the file as I did?

slider.txt (922 Bytes)[{"id":"38e5f8d3.fdc958","type":"debug","z":"461c9df1.6c1c94","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":780,"wires":[]},{"id":"52b7a073.e534e","type":"ui_dropdown","z":"461c9df1.6c1c94","name":"","label":"Comfort Level","tooltip":"","place":"Select option","group":"f2fbe3e0.a8092","order":1,"width":"7","height":"1","passthru":true,"multiple":false,"options":[{"label":"Standard","value":3,"type":"num"},{"label":"High","value":1,"type":"num"},{"label":"Standby","value":0,"type":"num"}],"payload":"","topic":"","x":400,"y":780,"wires":[["38e5f8d3.fdc958"]]},{"id":"f2fbe3e0.a8092","type":"ui_group","z":"","name":"template2","tab":"5f806182.bf90a","order":2,"disp":false,"width":7,"collapse":false},{"id":"5f806182.bf90a","type":"ui_tab","z":"","name":"prova tavole-template","icon":"dashboard","order":6,"disabled":false,"hidden":false}]

It works ok for me. I presume that you are seeing the problem when you select Standby.
Can you start node-red in a terminal and post the log here please, then we can see what versions of everything you are using.
To post a flow, or a log or anything similar you can use the </> button and paste it in.
PS that is a dropdown not a slider. Probably worth editing the title.

@Robertotarga - I have reproduced your issue - @Colin the issue is that when you select 'standard' the payload returned is an array with nothing in it
Screen Shot 2020-08-28 at 6.21.26 AM

while every other selection returns a payload as a value

Screen Shot 2020-08-28 at 6.22.46 AM

Not for me it isn't

Running node-red 1.1.3, dashboard 2.23.0, nodejs 14.8.0.
I will upgrade the dashboard in case it is a regression.

@Robertotarga as a temporary get around you could set 'standard' to return a string '0' then add a change node right after it with a jsonata statement $number(payload) which will convert the string'0' to a number 0.

Here is the flow with that setup:

[{"id":"a2c952ca.02dce","type":"debug","z":"30d8fda9.d37f3a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":770,"y":140,"wires":[]},{"id":"2878d671.7e337a","type":"ui_dropdown","z":"30d8fda9.d37f3a","name":"","label":"Comfort Level","tooltip":"","place":"Select option","group":"21523955.079a76","order":1,"width":"7","height":"1","passthru":true,"multiple":false,"options":[{"label":"Standard","value":3,"type":"num"},{"label":"High","value":1,"type":"num"},{"label":"Standby","value":"0","type":"str"}],"payload":"","topic":"","x":380,"y":140,"wires":[["a5ec370b.ab14b8"]]},{"id":"a5ec370b.ab14b8","type":"change","z":"30d8fda9.d37f3a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":140,"wires":[["a2c952ca.02dce"]]},{"id":"21523955.079a76","type":"ui_group","z":"","name":"template2","tab":"1ce4e744.8cdb39","order":2,"disp":false,"width":7,"collapse":false},{"id":"1ce4e744.8cdb39","type":"ui_tab","z":"","name":"prova tavole-template","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Oh, it seems to be a regression in dashboard 2.23.1 or 2.23.2.

I'm using NR 1.1.3, dashboard 2.23.2 and node.js v12.13.0
you are on an older version of the dashboard.

OK, I have confirmed this is a regression. Dashboard 2.23.1 returns the string "Standard" etc instead of the number and 2.23.2 is ok except that it sends an array for Standby, 2.23.0 is ok.

Yes Colin, sorry about that. I should have written "dropdown" instead of slider. As a matter of fact I meant to use a slider, but with this node I assume you can't use literal expression in the steps (can't you?). So I edited the title.

Version of Node-red is 1.0.6 and the dashboard component is 2.23.2.
Opening NR from a terminal I see:

pi@raspberrypi:~ $ node-red
28 Aug 12:52:00 - [info]

Welcome to Node-RED

28 Aug 12:52:00 - [info] Node-RED version: v1.0.6
28 Aug 12:52:00 - [info] Node.js version: v10.19.0
28 Aug 12:52:00 - [info] Linux 4.19.97-v7l+ arm LE
28 Aug 12:52:02 - [info] Loading palette nodes
28 Aug 12:52:06 - [info] Dashboard version 2.23.2 started at /ui
[info] "2020-08-28T10:52:06.191Z" 'Loading knxultimate-api: node-red-contrib-KNX-Ultimate KNX API (, version: 2.3.19'
28 Aug 12:52:06 - [info] Settings file : /home/pi/.node-red/settings.js
28 Aug 12:52:06 - [info] HTTP Static : /home/pi/domotica
28 Aug 12:52:06 - [info] Context store : 'default' [module=memory]
28 Aug 12:52:06 - [info] User directory : /home/pi/.node-red
28 Aug 12:52:06 - [warn] Projects disabled : editorTheme.projects.enabled=false
28 Aug 12:52:06 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
28 Aug 12:52:06 - [error] Unable to listen on
28 Aug 12:52:06 - [error] Error: port in use

Is it OK for you?

Yes zenofmud, You have identified the problem!
Actually the selected item is "standby" and not "standard", but that's not important. Apparently Colin's setup is somehow different from both mine and your NR environment.

You have two options:

  1. wait for a fix
  2. use one of the work arounds
    a - drop the dashboard back to 2.23.0
    b - use the example I provided

If you want to drop the dashboard back

  • open a terminal window
  • change to the .node-red directory
  • enter npm install node-red-dashbaord@2.23.0
  • stop/restart NR
    and that will install the old, working version of the dashboard and you can wait for a fix.

Hi Colin,
it's looks like my node.js v. 10.19 is older that yours wich is v.14.8. Can this be the problem? How can I upgrade node.js to the corect one?

@Robertotarga - read my last post - the problem is a bug that was introduced in the change of the dashboard from v2.23.0 to 2.23.0

Hi zenofmud,
thank you for your assistance here.
As an alternative may I upgrade the whole NR setup following the instructions on the official NR site?:

Yes you can do that and that will upgrade node-red but not the nodes you have installed.

If you upgrade the node-red-dashboard from version 2.23.0 to 2.23.1 or 2.23.2 you will hit this issue so you have the choices I posted above.

just created an issue

I think you must have missed some of the posts, as @zenofmud says the problem is due to a bug in version 2.23.2 (and .1) of node-red-dashboard, not with nodejs or node-red core.

Fixed in master - not yet on npm.

1 Like

OK, Colin, thank you for the prompt resolution of the issue. I'll wait for the upcoming Dashboard release (2.24?).

Just to clarify, it wasn't me that fixed it, it was @dceejay. Not that I am averse to basking in a little of his glory.