Node-RED
Node-RED is a visual programming environment for wiring together hardware devices, APIs, and online services. It's the Swiss Army knife of automation.
Installation
Node-RED is installed natively with the ei23 script (not as a Docker container). This offers advantages for GPIO usage and performance.
Pre-installed
Node-RED is automatically installed with the ei23 script. You don't need to do anything else!
Access
Node-RED is accessible at http://[IP]:1880
Nodes
Nodes are the central components of Node-RED. They are dragged onto the workspace and connected together.
Pre-installed Nodes
The ei23 script automatically installs the following nodes:
| Node | Description |
|---|---|
| node-red-dashboard | Web dashboard for UI elements |
| node-red-contrib-home-assistant-websocket | Home Assistant integration |
| node-red-contrib-boolean-logic | Logical operations |
| node-red-contrib-config | Configuration nodes |
| node-red-contrib-counter | Counter |
| node-red-contrib-dwd-local-weather | German Weather Service |
| node-red-contrib-eztimer | Time control |
| node-red-contrib-influxdb | InfluxDB integration |
| node-red-contrib-looptimer2 | Loop timer |
| node-red-contrib-sunpos | Sun position |
| node-red-contrib-telegrambot | Telegram Bot |
| node-red-contrib-time-range-switch | Time range switch |
| node-red-contrib-timerswitch | Timer switch |
| node-red-node-email | Send emails |
| node-red-node-ping | Ping test |
| node-red-node-serialport | Serial interface |
| node-red-node-smooth | Smooth data |
| node-red-contrib-postgresql | PostgreSQL integration |
Installing Additional Nodes
Additional nodes can be installed via the Palette (Hamburger menu → Manage Palette).
Setup
MQTT Node Configuration
- Drag an mqtt in node onto the workspace
- Double-click the node
- Click the pencil ✏️ next to Server
- Configure:
- Server:
localhostor IP of the MQTT broker - Port:
1883 - Username/Password: If configured
- Server:
- Click Connect → Done
- Enter a Topic (e.g.
home/temperature/#)
Home Assistant Node Configuration
- Drag a server Config node onto the workspace
- Or create it via an HA node
- Configure:
- Base URL:
http://localhost:8123(or IP) - Access Token: Create in HA under Profile → Long-lived tokens
- Base URL:
Inject Node
The Inject node triggers flows manually or on schedule:
- Once: Click the button
- Scheduled: Configure repeat interval
- Timed: At specific times
Debug Node
The Debug node displays data in the debug panel:
- The sidebar "Debug" tab shows all outputs
- Useful for testing and finding errors
Flows
Pages (Tabs)
Flows can be organized in pages:
- Click + next to the tab name
- Name the page (e.g. "Heating", "Lights", "Sensors")
- Organize your nodes thematically
Subflows
Subflows are reusable groups of nodes:
- Select nodes
- Right-click → Selection to Subflow
- The subflow appears as a single node in the panel
Subflows are powerful
Subflows can have parameters and are displayed as a single node. Ideal for repeating logic.
Flow Library
Flows can be saved in the library:
- Select nodes
- Right-click → Save selection to library
- Reuse via library
Variables and Context
Node-RED offers three context levels:
| Level | Scope | Example |
|---|---|---|
| Flow | Within a tab | flow.get("counter") |
| Global | Everywhere | global.get("lastUpdate") |
| Node | Only this node | node.get("state") |
Example: Counter
// Increment counter
let count = flow.get("counter") || 0;
count++;
flow.set("counter", count);
msg.payload = count;
return msg;
Dashboard
The pre-installed node-red-dashboard provides a web interface for UI elements:
Access
The dashboard is accessible at http://[IP]:1880/ui
Available UI Elements
| Element | Description |
|---|---|
| ui_button | Button |
| ui_slider | Slider |
| ui_switch | Switch |
| ui_text | Text display |
| ui_gauge | Gauge |
| ui_chart | Chart |
| ui_dropdown | Dropdown menu |
| ui_text_input | Text input |
Configuration
- Double-click a UI element
- Select the Group and Tab
- Configure size and position
Password Protection
Via the ei23 Script
Manually
Edit /home/[user]/.node-red/settings.js:
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "$2a$08$...", // bcrypt hash
permissions: "*"
}]
}
Generate hash
Backup
Node-RED data is backed up with the ei23 backup. Manually:
# Backup
sudo tar -czf ~/nodered_backup.tar.gz ~/.node-red/
# Restore
sudo tar -xzf ~/nodered_backup.tar.gz -C ~/
sudo service nodered restart
Updates
Node-RED is updated with the ei23 update:
Or manually:
# Update Node-RED and nodes
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --confirm-install --update-nodes
Home Assistant Integration
The pre-installed hass-node-red addon enables integration with Home Assistant:
- In Node-RED: Configure Home Assistant server
- In Home Assistant: Create long-lived token
- URL:
http://localhost:8123(if HA is in Docker)
Example: Light on Motion
Notes
- Node-RED runs on port 1880
- Configuration:
/home/[user]/.node-red/settings.js - Flows:
/home/[user]/.node-red/flows.json - Service:
sudo systemctl status nodered - Logs:
journalctl -u nodered -f