Bug Setting Dashboard Switch On / Off Payload

Drag a new Dashboard Switch into the editor and set On Payload numeric 1, Off Payload numeric 0.

Click Done.
The node shows an error.
Go back into the config, the values have reverted to true/false.

If you set payload to "1" and "0" it still reverts to true and false but in this case no error is shown ("true" is a valid string).

Is it me or is this a bug?

There is work-around: Set the Payloads to strings "foo" and "bar".
Deploy.
Set the payloads to the required number.
Deploy.

Node-red 3.0.2
Node-red-dashboard 3.2.0
Node.js 16.17.0

Please stop node red and start it again in a terminal. Post the terminal output here.

I do have flexdash installed but this issue is with the standard dashboard switch node.

pi@PiZeroTwoOne:~ $ node-red
21 Sep 21:27:23 - [info]

Welcome to Node-RED
===================

21 Sep 21:27:23 - [info] Node-RED version: v3.0.2
21 Sep 21:27:23 - [info] Node.js  version: v16.17.0
21 Sep 21:27:23 - [info] Linux 5.15.61-v8+ arm64 LE
21 Sep 21:27:26 - [info] Loading palette nodes
21 Sep 21:27:28 - [info] Node-RED FlexDash plugin version 0.4.107
21 Sep 21:27:32 - [info] Node-RED FlexDash version 0.4.107
21 Sep 21:27:32 - [info] Node-RED FD Core Widgets version 0.4.48
21 Sep 21:27:35 - [info] Worldmap version 2.29.0
21 Sep 21:27:39 - [info] Dashboard version 3.2.0 started at /ui
21 Sep 21:27:42 - [info] Settings file  : /home/pi/.node-red/settings.js
21 Sep 21:27:42 - [info] HTTP Static    : /home/pi/.node-red-static > /
21 Sep 21:27:42 - [info] Context store  : 'default' [module=memory]
21 Sep 21:27:42 - [info] User directory : /home/pi/.node-red
21 Sep 21:27:42 - [warn] Projects disabled : editorTheme.projects.enabled=false
21 Sep 21:27:42 - [info] Flows file     : /home/pi/.node-red/flows.json
21 Sep 21:27:42 - [info] FlexDash UI version 0.4.61

21 Sep 21:27:42 - [info] Server now running at http://127.0.0.1:1880/
21 Sep 21:27:42 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

21 Sep 21:27:42 - [info] Starting flows
21 Sep 21:27:42 - [info] [flexdash dashboard:FlexDash] path       : /flexdash
21 Sep 21:27:42 - [info] [flexdash dashboard:FlexDash] flexdash   : /home/pi/.node-red/node_modules/@flexdash/node-red-flexdash/flexdash
21 Sep 21:27:42 - [info] [flexdash dashboard:FlexDash] socket.io  : /flexdash/io/
21 Sep 21:27:42 - [info] [flexdash dashboard:FlexDash] sio options: {"cors":{"origin":true,"methods":["GET","POST"],"credentials":true},"path":"/flexdash/io/"}
21 Sep 21:27:42 - [info] [flexdash dashboard:FlexDash] port       : Node-RED port
21 Sep 21:27:42 - [info] [flexdash dashboard:FlexDash] FlexDash ready!
FD 74279b3ff4e3bed4 dashboard "FlexDash"
21 Sep 21:27:42 - [info] Started flows
21 Sep 21:27:44 - [info] Upgrade request for /comms got /flexdash/io/
21 Sep 21:27:47 - [info] Upgrade request for /ui/socket.io/ got /flexdash/io/

I just tried another Raspberry Pi with a fresh installation of Node-red, installed node-red-dashboard.

No problem with the switch node on this one.

Stopped Node-red, Installed Flexdash, start Node-red.

Now Switch node gives the error.

So it does somehow seem to be related to Flexdash.

Edit - uninstalling Flexdash doesn't make the problem go away again.

It's the same with me, on a mac computer.
It is only the first time, if 1 & 0 is inserted, it is changed back to true & false, after that 1 & 0 can be inserted again.
But if you start with e.g. 5 & 3, they are accepted and there are no errors.

Last login: Thu Sep 22 08:46:06 on ttys000
poulborg@Poul-MacBook-Pro ~ % node-red
22 Sep 09:26:18 - [info] 

Welcome to Node-RED
===================

22 Sep 09:26:18 - [info] Node-RED version: v3.0.1
22 Sep 09:26:18 - [info] Node.js  version: v14.18.0
22 Sep 09:26:18 - [info] Darwin 21.6.0 x64 LE
22 Sep 09:26:18 - [info] Loading palette nodes
22 Sep 09:26:19 - [info] Node-RED FlexDash plugin version 0.4.107
22 Sep 09:26:19 - [info] Node-RED FlexDash version 0.4.107
22 Sep 09:26:19 - [info] Node-RED FD Core Widgets version 0.4.48
22 Sep 09:26:19 - [info] Dashboard version 3.2.0 started at /ui
22 Sep 09:26:19 - [info] Settings file  : /Users/poulborg/.node-red/settings.js
22 Sep 09:26:19 - [info] Context store  : 'default' [module=memory]
22 Sep 09:26:19 - [info] User directory : /Users/poulborg/.node-red
22 Sep 09:26:19 - [warn] Projects disabled : editorTheme.projects.enabled=false
22 Sep 09:26:19 - [info] Flows file     : /Users/poulborg/.node-red/flows.json
22 Sep 09:26:19 - [info] FlexDash UI version 0.4.61

22 Sep 09:26:19 - [info] Server now running at http://127.0.0.1:1880/
22 Sep 09:26:19 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

22 Sep 09:26:19 - [info] Starting flows
22 Sep 09:26:19 - [info] [flexdash dashboard:FlexDash] path       : /flexdash
22 Sep 09:26:19 - [info] [flexdash dashboard:FlexDash] flexdash   : /Users/poulborg/.node-red/node_modules/@flexdash/node-red-flexdash/flexdash
22 Sep 09:26:19 - [info] [flexdash dashboard:FlexDash] socket.io  : /flexdash/io/
22 Sep 09:26:19 - [info] [flexdash dashboard:FlexDash] sio options: {"cors":{"origin":true,"methods":["GET","POST"],"credentials":true},"path":"/flexdash/io/"}
22 Sep 09:26:19 - [info] [flexdash dashboard:FlexDash] port       : Node-RED port
22 Sep 09:26:19 - [info] [flexdash dashboard:FlexDash] FlexDash ready!
FD f887b71172c0c3e7 dashboard "FlexDash"
   75bd8ba5d801c98c   missing node config
   8b6f65fdbeaafcb5   flexdash tab "Wintergarden_Tab"
   6b7ab15067ef2196   flexdash tab "Ny_Tab"
FD 8b6f65fdbeaafcb5 tab "Wintergarden_Tab" fd=f887b71172c0c3e7
   03650882b85546b3   flexdash container "Fan_Grid"
   64b78693b66f29a8   flexdash container "Ny_Container1"
FD 6b7ab15067ef2196 tab "Ny_Tab" fd=f887b71172c0c3e7
   e2c48cc94e728a99   flexdash container "Ny_Grid"
   6f1f4b7856f632b3   flexdash container "Ny_Grid1"
FD e2c48cc94e728a99 StdGrid "Ny_Grid" tab=6b7ab15067ef2196
   7f4ed4893a27af68   flexdash container "Ny_container_Panel"
FD 7f4ed4893a27af68 Panel "Ny_container_Panel" parent=e2c48cc94e728a99 tab=8b6f65fdbeaafcb5
   add8bc748eb4426e   fd-push-button "test"
   da9e8ce76c987913   fd-push-button "test"
FD 64b78693b66f29a8 StdGrid "Ny_Container1" tab=8b6f65fdbeaafcb5
   5c1d741e5f65137d   flexdash container "Container_Panel"
FD 6f1f4b7856f632b3 StdGrid "Ny_Grid1" tab=6b7ab15067ef2196
   fc52f188aecfe533   fd-push-button "test"
   65f596312cc7678a   fd-push-button "test"
FD 03650882b85546b3 StdGrid "Fan_Grid" tab=8b6f65fdbeaafcb5
   e77a7833a0f93ef3   flexdash container "Container_panel1"
FD 5c1d741e5f65137d Panel "Container_Panel" parent=64b78693b66f29a8
   84af736ee075f753   fd-push-button "Fan Light"
   bca6bae91813d1aa   fd-push-button "Fan Off"
   cea9306ba0eace50   fd-push-button "Fan Low"
   b51cacc5e04d1208   fd-push-button "Fan Mid"
   afe465fab8e13774   fd-push-button "Fan High"
FD e77a7833a0f93ef3 Panel "Container_panel1" parent=03650882b85546b3 tab=adf8ed265a01336a
   26ba53d8c285a12d   fd-push-button "Fan Off"
   ed340d89a70482d2   fd-push-button "Fan Low"
   cfac873b75158ec4   fd-push-button "Fan Mid"
   7e96c342633da0bf   fd-push-button "Fan High"
   450ffa3780393a8f   fd-label "Label"
22 Sep 09:26:19 - [info] Started flows
22 Sep 09:26:20 - [info] Upgrade request for /comms got /flexdash/io/
22 Sep 09:26:22 - [info] Upgrade request for /ui/socket.io/ got /flexdash/io/


Have you seen this @tve ?
A possible problem with libraries installed for Flexdash?

Thanks for flagging me, however, this has nothing to do with FlexDash :smiley:

I just launched NR 3.0.1 with nothing but node-red-dashboard installed (all in a clean docker container). I dragged a button node into the flow, created the group & tab and deployed.
Then I dragged a switch node into the flow. First odd thing is that it has the warning triangle even though when you edit it everything looks fine. If I just click Done it continues to show the triangle and if I reopen the on/off values are highlighted.
Then I drag another button node in. It has the red triangle (not sure why). Open it and hit done and the triangle goes away.
If I edit the switch node I can't make it have the bad state again. If I drag a new switch node into the flow it also behaves correctly.

The whole thing is not trivial to reproduce, small changes in the order of actions makes the problem go away. If I had to place a bet it would be that there's a race condition due to the async loading of nodes...

Short summary:

  • This error is related in some way to the installation of Flexdash.
  • There is a simple and viable work-around

Well it's not trivial because it requires a clean Node-red installation which takes time. Simple and reproducible though.

On a fresh installation of Raspberry PiOS, with Node-red and node-red-dashboard, no VM, no Docker:

Steps to test for the problem:
Drag switch node onto editor
Create new dashboard tab and group
Enter Payload as number 1 and 0
Done
Does the node show the error notification?
If you go back into the config have the Payloads reverted to true and false?

On the fresh installation the switch node does not show an error.
cd ~/,node-red; npm install @flexdash/node-red-fd-corewidgets
Now the error occurs.
cd ~/,node-red; npm uninstall @flexdash/node-red-fd-corewidgets
The error persists.

What did I do to cause the error? I installed Flexdash.

I think that's just because a new dashboard node is not associated with a tab/group and is unrelated to this issue.

I don't understand "the async loading of nodes" but in the above tests there are no flows and no nodes deployed.

My guess is that there is a different version of a file common to Dashboard installed with Flexdash which leads to the error. I can't identify this file anywhere in ~/.node-red or /lib/node_modules.
I don't know where else to look.

I have not tested first installing Flexdash then Dashboard.

Yeah, but I can see the issue without installing flexdash.

Launch Node-RED:

docker run --rm -ti -p 1990:1880 \
  --entrypoint bash \
  nodered/node-red:3.0.1 \
  -c "npm i node-red-dashboard; npm start --cache /data/.npm -- -v -userDir /data"

Go to admin and skip intro

Configure a button node

Click through adding the group, then the tab, then deploy

Button deployed

Add switch node and set on/off payloads

Click Done - observe red triangle

Edit switch node - observe red outlined issue

NO FLEXDASH IN SIGHT! :boom:

1 Like

Yes you are right.

So the steps to reproduce this become:

Fresh NR installation including Dashboard.
Do something.
Switch node with Payload values 1 and 0 revert to true/false when you click Done.

It has been observed when something = "install a third party dashboard" or something = "add a button, deploy".

I apologise for traducing your excellent dashboard :grinning:

Can the error be seen with an existing installation by moving away the .node-red directory, restarting node red and installing the dashboard?

Sorry Colin, what do you mean by "moving away the .node-red directory"?

Rename it so that when node-red restarts it will make a new one with empty flows. Then after the tests you can remove the new one and rename the original back again. If there is nothing of importance in the current .node-red folder then you can just delete it.

After deleting the .node-red directory, the problem still occurs when a switch node is configured.
Same result after deleting .node-red and re-running the Node-red install script.

In fact I'm having trouble finding a circumstance in which the error does not show up.

There was a point yetsterday when I had one RPi showing the problem and one not.

Not any more. At some point I did sudo apt update && sudo apt -y full-upgrade, no idea if it's relevant, nor which packages were updated.

Ok, so it isn't necessary to start with a new install to see the problem. Has an issue been reported on the dashboard github page?

I have not reported it. I didn't think that "This happens but I can't really describe what triggers it" would be much use, and only one other person says they see the problem.

I'll look at it again when I reinstall the OS.

I can't test it at the moment as I am away. I thought we had determined that it can be reliably reproduced by removing the .node-red folder and restarting node red.

Reproduced yes but that's not quite the same as the initial cause.

I need to start again with a fresh OS installation. I'll try and do it today.

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