Skip to content

Commit

Permalink
fix(ignore): zigate: Fix ZDO BIND/UNBIND payload mismatch. (#1198)
Browse files Browse the repository at this point in the history
* zigate: Fix ZDO BIND/UNBIND payload mismatch.

* Fix

* Fix comment.
  • Loading branch information
Nerivec authored Sep 23, 2024
1 parent 3f0b2c4 commit b007282
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/adapter/zigate/adapter/zigateAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,14 @@ class ZiGateAdapter extends Adapter {

case Zdo.ClusterId.BIND_REQUEST:
case Zdo.ClusterId.UNBIND_REQUEST: {
// extra zeroes for endpoint XXX: not needed?
const zeroes = 15 - payload.length;
const prefixedPayload = Buffer.alloc(payload.length + zeroes);
prefixedPayload.set(payload, 0);

payload = prefixedPayload;
// only need adjusting when Zdo.MULTICAST_BINDING
if (payload.length === 14) {
// extra zero for endpoint
const prefixedPayload = Buffer.alloc(payload.length + 1);
prefixedPayload.set(payload, 0);

payload = prefixedPayload;
}

break;
}
Expand Down

0 comments on commit b007282

Please sign in to comment.