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:
@@ -103,9 +103,10 @@ If `isOn` is false when you expect ON, check that the trigger-state output is ex
|
||||
|
||||
## Zigbee to NVL (function code)
|
||||
|
||||
- **Room:** `livingRoom`.
|
||||
- **Action map:** `single→1, double→2, hold→3, release→4, triple→5, quad→6` → sets `zigbee_swN`.
|
||||
- **Edge behaviour:** Passes `msg.zigbeeClear = { room: 'livingRoom', key: 'zigbee_swN' }` so **Clear zigbee edge** (after 80 ms) clears that flag and calls **Build NVL_In** again; PLC sees one pulse.
|
||||
- Uses **room-config.js** `switchBindings` (and optional `deviceIdToName` / `switchBindingsByDeviceId`) so each button maps to (room, light). See [zigbee-to-nvl-function.js](zigbee-to-nvl-function.js).
|
||||
- **Payload formats supported:** (1) single device `{ action: "1_single", friendly_name: "Office Switch" }`; (2) multi-device object keyed by IEEE `{ "0xa4c...": { action, ... } }`; (3) plain action string `"1_single"` with device name in `msg.topic` (e.g. `zigbee2mqtt/Office Switch/action`).
|
||||
- **If your multi-device node never sends `action`:** the node may only output device list/state. Use an **MQTT In** node subscribed to `zigbee2mqtt/+/action` and feed that into Zigbee to NVL; then `msg.payload` will be the action string (e.g. `1_single`) and `msg.topic` will be e.g. `zigbee2mqtt/Office Switch/action` (the function parses the friendly name from the topic).
|
||||
- **Edge behaviour:** Passes `msg.zigbeeClear` (single object or array) so **Clear zigbee edge** (after 80 ms) clears the flags; use [clear-zigbee-edge.js](clear-zigbee-edge.js).
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user