From f2fa9abd97b30433fdc24c62fb41e2fc9ebb0757 Mon Sep 17 00:00:00 2001 From: Ilya Kirov Date: Mon, 28 Oct 2024 23:13:23 +0300 Subject: [PATCH] fix: ZBOSS: fix ZDO bind/unbind commands for groups (#1226) * ZBOSS: fix ZDO bind/unbind commands for groups * fix lint --- src/adapter/zboss/adapter/zbossAdapter.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/adapter/zboss/adapter/zbossAdapter.ts b/src/adapter/zboss/adapter/zbossAdapter.ts index f81b455429..30c546181a 100644 --- a/src/adapter/zboss/adapter/zbossAdapter.ts +++ b/src/adapter/zboss/adapter/zbossAdapter.ts @@ -270,8 +270,8 @@ export class ZBOSSAdapter extends Adapter { switch (clusterId) { case Zdo.ClusterId.NETWORK_ADDRESS_REQUEST: case Zdo.ClusterId.IEEE_ADDRESS_REQUEST: - case Zdo.ClusterId.BIND_REQUEST: // XXX: according to `FRAMES`, might not support group bind? - case Zdo.ClusterId.UNBIND_REQUEST: // XXX: according to `FRAMES`, might not support group unbind? + case Zdo.ClusterId.BIND_REQUEST: + case Zdo.ClusterId.UNBIND_REQUEST: case Zdo.ClusterId.LQI_TABLE_REQUEST: case Zdo.ClusterId.ROUTING_TABLE_REQUEST: case Zdo.ClusterId.BINDING_TABLE_REQUEST: @@ -285,6 +285,17 @@ export class ZBOSSAdapter extends Adapter { break; } } + switch (clusterId) { + case Zdo.ClusterId.BIND_REQUEST: + case Zdo.ClusterId.UNBIND_REQUEST: { + // use fixed size address + const addrType = payload.readUInt8(13); // address type + if (addrType == Zdo.MULTICAST_BINDING) { + payload = Buffer.concat([payload, Buffer.alloc(7)]); + } + break; + } + } const zdoResponseClusterId = Zdo.Utils.getResponseClusterId(clusterId); const frame = await this.driver.requestZdo(clusterId, payload, disableResponse || zdoResponseClusterId === undefined);