node-red-contrib-ui-led
raw JSON → 0.4.11 verified Fri May 01 auth: no javascript maintenance
A Node-RED dashboard widget that displays a customizable LED status indicator with color mapping based on msg.payload values. Version 0.4.11 is currently latest with no active development since 2021. Requires node-red-dashboard >=2.23.3. Supports custom color-value mappings, dynamic overrides via msg.colorForValue, and aesthetic sizing options. Unlike generic dashboard widgets, this node provides immediate visual feedback with simple boolean or custom state-to-color logic. Released under MIT license.
Common errors
error Error: Cannot find module 'node-red-dashboard' ↓
cause node-red-dashboard is a peer dependency not installed automatically.
fix
Run 'npm install node-red-dashboard' in your Node-RED user directory.
error LED not showing on dashboard; widget appears gray ↓
cause msg.payload not boolean true/false, or node not configured in a dashboard group.
fix
Ensure inject node sends payload true/false, and ui_led is placed in a dashboard group.
error TypeError: Cannot read properties of undefined (reading 'length') ↓
cause Custom color mappings object format incorrect in msg.colorForValue.
fix
Use object with string/number keys and CSS color values, e.g., {true: 'green'}.
Warnings
breaking Requires node-red-dashboard >=2.23.3. Older versions of dashboard are incompatible. ↓
fix Update node-red-dashboard to >=2.23.3.
gotcha msg.payload strict boolean mapping: only true/false map to green/red by default. Other values result in gray. ↓
fix Use custom color mappings to handle non-boolean payloads.
deprecated No active development since 2021; may not work with future Node-RED or dashboard versions. ↓
fix Consider forking or using alternative dashboard LED nodes.
gotcha Custom color mappings in config are static; dynamic override via msg.colorForValue requires enabling 'Allow Color For Value map in msg'. ↓
fix Enable the option in node config and pass an object mapping values to CSS colors.
Install
npm install node-red-contrib-ui-led yarn add node-red-contrib-ui-led pnpm add node-red-contrib-ui-led Imports
- node-red-contrib-ui-led wrong
Global install or importing in JavaScript codecorrectInstall via npm: npm install node-red-contrib-ui-led (in ~/.node-red directory)
Quickstart
npm install node-red-contrib-ui-led
# After installation, in Node-RED editor:
# 1. Drag a 'ui_led' node from the dashboard palette onto the flow.
# 2. Configure the node: set group, size, and optionally customize color mappings.
# 3. Wire an inject node to the ui_led node.
# 4. Set inject node's payload to true (green) or false (red) or any custom value.
# 5. Deploy and observe the LED on the dashboard.
// Example flow JSON (partial):
[{"id":"node1","type":"inject","z":"flow1","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool"},{"id":"node2","type":"ui_led","z":"flow1","group":"dashboard_group","order":0,"width":0,"height":0,"name":"","label":"","layout":"row left","allowColorForValueInMsg":false,"x":350,"y":200,"wires":[]}]