Deploy multiple widgets

I am using a node-red-contrib-ui-led to show status of 20 different devices.

Screenshot 2024-02-05 alle 11.21.36

With this function I can get all devices' name and status:

const devices = global.get("devices","myStore")
for (var x in devices){
    msg.label = devices[x].name
    msg.payload = devices[x].status == 'Online' ? true : false
    node.send(msg)
}
node.done()

How can I deploy all the ui-led gadgets in a loop, without having to put them one-by-one on the flow?

You can't.

You can though use a template node and generate 20 elements that look like LEDs

here is an example of 1 LED in a template. You can use the angularjs ng-repeat directive to create as many as you like (or just copy + paste)

Where is it?

forgot to add the link - updated :point_up_2:

2 Likes

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