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:
@@ -1,13 +1,24 @@
|
||||
// Paste this into a Function node named "Load room config".
|
||||
// Connect an Inject node (once after 0.5 s) to it so it runs at startup.
|
||||
//
|
||||
// Since functionExternalModules is true in settings.js, you can require files.
|
||||
// room-config.js must be on the Node-RED server at /root/.node-red/room-config.js
|
||||
// Load room config into global (no require - Function nodes can't use it).
|
||||
// 1. Open node-red/room-config.js in the repo.
|
||||
// 2. Copy the whole object: from "const ROOM_CONFIG = {" up to "};" (do NOT copy "module.exports").
|
||||
// 3. Replace the ROOM_CONFIG below with your paste. Keep the two lines at the end.
|
||||
|
||||
// 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');
|
||||
const ROOM_CONFIG = {
|
||||
roomNames: ['cmd_livingroom', 'cmd_out'],
|
||||
lightEntityMap: [
|
||||
{ room: 'light_livingRoom', light: 1, entityId: 'input_boolean.living_room_new' },
|
||||
],
|
||||
entityToRoom: { living_room_new: 'cmd_livingroom' },
|
||||
deviceToRoom: { 'Office Switch': 'cmd_livingroom' },
|
||||
deviceIdToName: {},
|
||||
switchBindings: {
|
||||
'Office Switch': {
|
||||
1: { room: 'cmd_livingroom', light: 1 },
|
||||
2: { room: 'cmd_livingroom', light: 1 },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
global.set('roomConfig', ROOM_CONFIG);
|
||||
node.warn('[Load room config] loaded: ' + ROOM_CONFIG.roomNames.length + ' rooms, ' + ROOM_CONFIG.lightEntityMap.length + ' light mappings');
|
||||
node.warn('[Load room config] loaded: ' + ROOM_CONFIG.roomNames.length + ' rooms');
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user