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.
This commit is contained in:
22
node-red/reload-room-config-function.js
Normal file
22
node-red/reload-room-config-function.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// Paste into a Function node named "Reload room config from payload".
|
||||
// Input: msg.payload = JSON string (from Exec node that runs the script below).
|
||||
// Sets global roomConfig so all flows see the new config without restarting Node-RED.
|
||||
|
||||
const raw = msg.payload;
|
||||
if (typeof raw !== 'string') {
|
||||
node.warn('[Reload config] expected string payload, got ' + typeof raw);
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const config = JSON.parse(raw.trim());
|
||||
if (!config.roomNames || !Array.isArray(config.roomNames)) {
|
||||
node.error('[Reload config] invalid config: missing roomNames');
|
||||
return null;
|
||||
}
|
||||
global.set('roomConfig', config);
|
||||
node.warn('[Reload config] OK: ' + config.roomNames.length + ' rooms, ' + (config.lightEntityMap ? config.lightEntityMap.length : 0) + ' light mappings');
|
||||
return msg;
|
||||
} catch (e) {
|
||||
node.error('[Reload config] parse error: ' + e.message);
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user