- Updated documentation to clarify the mapping of Zigbee buttons to specific (room, light) pairs using `switchBindings`. - Improved the Zigbee to NVL function to support both single-device and multi-device payloads, enhancing flexibility in handling actions. - Revised the room configuration to include detailed switch bindings and fallback mechanisms for device identification, streamlining the integration process. This update improves the usability and functionality of the Zigbee integration within Node-RED, facilitating better control of lighting systems.
82 lines
3.5 KiB
Markdown
82 lines
3.5 KiB
Markdown
# Node-RED flow check report (live vs repo)
|
||
|
||
Checked live flows on **10.20.30.12** (Feb 2026). Summary below.
|
||
|
||
---
|
||
|
||
## Updated (match repo) – Living Room tab
|
||
|
||
| Node name | Status | Note |
|
||
|----------------------|----------|------|
|
||
| HA to NVL | Updated | Uses `roomConfig`, `entityToRoom` |
|
||
| Zigbee to NVL | Updated | Uses `switchBindings`, multi-device payload, `v.payload.action` |
|
||
| Clear zigbee edge | Updated | Supports `Array.isArray(msg.zigbeeClear)` |
|
||
| STATE TO NVL | Updated | Uses `global.get('roomConfig').roomNames` |
|
||
| NVL to HA Sync | Updated | Uses `roomConfig.lightEntityMap` |
|
||
|
||
You have **duplicate** nodes in the same tab: some of these names exist twice (or three times), and **one copy is old**. The flow may be wired to the **old** instances.
|
||
|
||
---
|
||
|
||
## Not updated / needs action
|
||
|
||
### 1. Load room config – **empty**
|
||
|
||
- **Current:** The "Load room config" function node contains only `return msg;` (12 chars).
|
||
- **Effect:** `global.get('roomConfig')` is never set from `room-config.js`, so other nodes may use fallbacks or wrong data.
|
||
- **Fix:** Paste the full loader code into the "Load room config" function node. Code to paste is in **[node-red/room-config-loader.js](../../node-red/room-config-loader.js)** (see below).
|
||
|
||
### 2. Duplicate nodes in Living Room
|
||
|
||
Same tab contains both updated and old versions:
|
||
|
||
- **HA to NVL:** 1 updated, 1 old
|
||
- **Zigbee to NVL:** 2 updated, 1 old
|
||
- **Clear zigbee edge:** 1 updated, 1 old
|
||
- **NVL to HA Sync:** 1 updated, 1 old
|
||
- **NVL SEND:** 1 node, **old** (hardcoded `roomNames = ['cmd_livingroom']`)
|
||
|
||
If your flow is connected to the **old** nodes, behaviour will not match the repo. Ensure:
|
||
|
||
- Zigbee/HA → **updated** "Zigbee to NVL" / "HA to NVL" → **updated** "STATE TO NVL" (or replace "NVL SEND" with STATE TO NVL and wire that) → nvl-send.
|
||
- Delay → **updated** "Clear zigbee edge" (the one that has `Array.isArray(msg.zigbeeClear)`).
|
||
|
||
### 3. Flow 7
|
||
|
||
All relevant function nodes there are **old** (fixed `livingRoom`, no roomConfig). Update them if you use that tab, or leave as-is if unused.
|
||
|
||
---
|
||
|
||
## Code to paste: Load room config
|
||
|
||
Paste this into the **Load room config** function node (and connect an Inject “once after 0.5 s” to it):
|
||
|
||
```javascript
|
||
// Delete cached version so changes to the file are picked up on redeploy
|
||
delete require.cache[require.resolve('/root/.node-red/room-config.js')];
|
||
const ROOM_CONFIG = require('/root/.node-red/room-config.js');
|
||
|
||
global.set('roomConfig', ROOM_CONFIG);
|
||
node.warn('[Load room config] loaded: ' + ROOM_CONFIG.roomNames.length + ' rooms, ' + ROOM_CONFIG.lightEntityMap.length + ' light mappings');
|
||
return null;
|
||
```
|
||
|
||
Full file: [node-red/room-config-loader.js](../../node-red/room-config-loader.js).
|
||
|
||
---
|
||
|
||
## room-config.js on server
|
||
|
||
`/root/.node-red/room-config.js` is present and contains `roomNames`, `switchBindings`, etc. Upload from repo when you change config:
|
||
`scp node-red/room-config.js root@10.20.30.12:/root/.node-red/room-config.js`
|
||
|
||
---
|
||
|
||
## Checklist
|
||
|
||
1. [ ] Paste **Load room config** code (above) into the "Load room config" node and deploy.
|
||
2. [ ] In Living Room, confirm wires go to the **updated** HA to NVL / Zigbee to NVL / Clear zigbee edge (not the old duplicates).
|
||
3. [ ] Use **STATE TO NVL** (roomConfig) in the NVL path, or replace **NVL SEND** content with [state-to-nvl-send-payload.js](state-to-nvl-send-payload.js).
|
||
4. [ ] Optionally remove or disable the **old** duplicate nodes in Living Room to avoid confusion.
|
||
5. [ ] After changing `room-config.js`, upload it and redeploy (or restart Node-RED).
|