Files
kkelomatic_home/docs/integration/clear-zigbee-edge.js
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

16 lines
624 B
JavaScript

// Paste into the "Clear zigbee edge" Function node (after 80 ms delay).
// Clears zigbee_swN in nvlInState so the PLC sees one pulse. Supports one room or many (switchBindings).
// msg.zigbeeClear can be: { room, key } or [ { room, key }, ... ]
if (msg.zigbeeClear) {
const state = flow.get('nvlInState') || { rooms: {}, boiler: {} };
const list = Array.isArray(msg.zigbeeClear) ? msg.zigbeeClear : [msg.zigbeeClear];
for (const item of list) {
const r = state.rooms[item.room];
if (r && item.key) r[item.key] = false;
}
flow.set('nvlInState', state);
}
msg.payload = { buildAndSend: true };
return msg;