diff --git a/src/adapter/ezsp/adapter/ezspAdapter.ts b/src/adapter/ezsp/adapter/ezspAdapter.ts index 271c310072..f04dde9efe 100644 --- a/src/adapter/ezsp/adapter/ezspAdapter.ts +++ b/src/adapter/ezsp/adapter/ezspAdapter.ts @@ -529,10 +529,15 @@ class EZSPAdapter extends Adapter { return this.driver.queue.execute(async () => { this.checkInterpanLock(); const ieee = new EmberEUI64(sourceIeeeAddress); - const addrmode = (type === 'group') ? 1 : 3; - const ieeeDst = (type === 'group') ? destinationAddressOrGroup : - new EmberEUI64(destinationAddressOrGroup as string); - if (type !== 'group') { + let addrmode, ieeeDst; + if (type === 'group') { + // 0x01 = 16-bit group address for DstAddr and DstEndpoint not present + addrmode = 0x01; + ieeeDst = uint16_t.serialize(uint16_t, destinationAddressOrGroup as number); + } else { + // 0x03 = 64-bit extended address for DstAddr and DstEndpoint present + addrmode = 0x03; + ieeeDst = new EmberEUI64(destinationAddressOrGroup as string); this.driver.setNode(destinationNetworkAddress, ieeeDst as EmberEUI64); } await this.driver.zdoRequest( @@ -551,10 +556,15 @@ class EZSPAdapter extends Adapter { return this.driver.queue.execute(async () => { this.checkInterpanLock(); const ieee = new EmberEUI64(sourceIeeeAddress); - const addrmode = (type === 'group') ? 1 : 3; - const ieeeDst = (type === 'group') ? destinationAddressOrGroup : - new EmberEUI64(destinationAddressOrGroup as string); - if (type !== 'group') { + let addrmode, ieeeDst; + if (type === 'group') { + // 0x01 = 16-bit group address for DstAddr and DstEndpoint not present + addrmode = 0x01; + ieeeDst = uint16_t.serialize(uint16_t, destinationAddressOrGroup as number); + } else { + // 0x03 = 64-bit extended address for DstAddr and DstEndpoint present + addrmode = 0x03; + ieeeDst = new EmberEUI64(destinationAddressOrGroup as string); this.driver.setNode(destinationNetworkAddress, ieeeDst as EmberEUI64); } await this.driver.zdoRequest(