Node-RED dashboard- Adding an LED node hides all other dashboard nodes

Hi!

I have just created a dashboard for my flow. Initially I had deployed a bunch of various text, switch, button and slider nodes and was successfully able to segregated them into dashboard groups as well.
However, I also need LED nodes to display Boolean signals. So I installed the node-red-contrib-ui-led node and used it in one of my groups. On re deploying my flow, only the LED nodes are visible in the dashboard and none of the other nodes can be accessed. The LED nodes do represent the status successfully but the rest of my dashboard disappears. I can get back my original dashboard by removing the LED nodes from my flow.

Is there any fix for this?

Thanks in advance

What version of dashboard are you using? Try updating the dashboard if you don't have the latest.
There where some issues with the led node and dashboard, but not sure if your problem relates to this.

I am using the latest version of the dashboard nodes.

It is helpful if you give the actual version of the dashboard. This could help someone in the future since the version could change at any time. You should also provide the Node-RED and node.js versions. All three of these are displayed in the node-red startup lo making it easy to copy and paste them.

Is the led node of the same dashboard tab as your other ui nodes? Can you provide a copy of your flow?

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

I'm using node-red to display some information about the machines in an industrial environment. LEDs to display sensor status or the indicator light status were a must.

I tried with the LED node, but I found out that they're using image files, and if you have to use several nodes, they slow down the dashboard to the point of tears.

I found an alternate solution that works much faster, though: instead of using an LED node, I pass a text string that contains the LED value in HTML using a fontawesome icon, formatted with the color, then use a regular text node to display label and value.

To do so, I use a function node, but you can also change a switch node (depending on numerical/boolean value) and a change node (to set the LED string value).

As an example, here are the different strings for green, yellow, and red lamps (I also use a grey one as default when I want to display an off LED, not pictured here):

// prepare the lamp string
    var led = "<i class=\"fa fa-2x fa-circle\"></i>";
    var glamp = "<a class=" + msg.machine.lamp.greenstyle + ">" + led + " " + "</font>";
    var ylamp = "<a class=" + msg.machine.lamp.yellowstyle + ">" + led + " " + "</font>";
    var rlamp = "<a class=" + msg.machine.lamp.redstyle + ">" + led + "</font>";

This is, by far, MUCH more efficient than the LED node, looks crispier (it's a vector icon, after all) and better (in my opinion, you can also customize the colour just by changing the LED value strings).

image

(EDIT) NOTE: This code fragment is to display the signal light on each machine. Therefore, I have a green, a yellow, and red lamps, and by adjusting the class value, I can have them off (in grey), on (in their colour) or blinking (animated between grey and their colour, as defined in the CSS). In the CSS, I also scaled up the icons to be bigger than the surrounding text, so they're more visible.

2 Likes

Oh ok! Thanks for this suggestion

I also found another solution. Seems to me that the problem was I had installed two separate dashboard modules, one the simple dashboard and the other the node-red contrib dashboard. They have the same nodes but the node-red LED works only with the node-red contrib dashboard nodes. So I had to uninstall all my modules and install only the node-red contrib dashboard module. Worked fine after that. I guess the key is to avoid overlap of nodes on two different modules!

I didn't think that node-red-contrib-ui-led LEDs are image files. Can you explain more please?

I recall opening the code to examine it using the browser, it looked like a rasterized image, not a vector one. In any case, the performance of NR was much lower due to those LED nodes. When I switched to my way of doing things using the Text node with the icon strings instead of LEDs, the CPU usage and rendering time for the page dropped dramatically.

That's why we asked the dashboard version, it was noticed then.

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