Files
kkelomatic_home/node-red/reload-room-config-docs.md
nearxos d64d0f8923 Enhance Zigbee to NVL integration with button mapping and configuration updates
- 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.
2026-02-08 22:30:19 +02:00

2.4 KiB
Raw Permalink Blame History

Reload room config without restarting Node-RED

After you edit room-config.js on the server (and save/upload it), you can have Node-RED reload it into global.roomConfig so all flows use the new config without restarting Node-RED.


When room-config.js is saved on the server, it is reloaded automatically. No extra nodes to install—use the built-in Watch node.

Add the “Config reload on save” flow

Add these nodes and wire in order:

Order Node type Name Config
1 watch (built-in) Watch room-config In the node config, enter the file to watch. One of: /root/.node-red/room-config.js (single file) or /root/.node-red (directory; then add the filter Function below so only room-config.js triggers reload). The Watch node puts the changed file path in msg.payload and msg.filename, and the short name in msg.file.
2 Exec Read room-config as JSON Command: node -e "console.log(JSON.stringify(require('/root/.node-red/room-config.js')))" · Append: payload (so output becomes msg.payload).
3 Function Reload room config from payload Paste the code from reload-room-config-function.js.

Wiring: Watch → Exec → Reload room config from payload (Function).

If you watch the directory /root/.node-red instead of the single file, insert a Function between Watch and Exec so only changes to room-config.js trigger a reload:

// Only pass through when the changed file is room-config.js
if (msg.file !== 'room-config.js') return null;
return msg;

After deploy, saving (or uploading) /root/.node-red/room-config.js will trigger the Watch → Exec → reload. Config updates with no restart and no manual reload.


Option B: Manual reload (no file watcher)

Use this if you prefer not to install the watch node.

  1. Inject e.g. “Reload config” (click to trigger).
  2. Exec same command as in Option A, step 3.
  3. Function same “Reload room config from payload” code as in Option A, step 4.

Wiring: Inject → Exec → Function.

Trigger the Inject after you upload a new room-config.js.


Note

room-config.js must export a plain object (no functions, no non-JSON values). The repo version is JSON-serializable.