Skip to content

Commit

Permalink
fix: Fix unable to join some devices with Conbee III (#1207)
Browse files Browse the repository at this point in the history
* Remove errornous assert on srcAddr16 lookup

* lint

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
schrluka and Koenkk authored Sep 30, 2024
1 parent 9f56f8f commit 3e7bfaa
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/adapter/deconz/adapter/deconzAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* istanbul ignore file */

import assert from 'assert';

import Device from '../../../controller/model/device';
import * as Models from '../../../models';
import {Wait, Waitress} from '../../../utils';
Expand Down Expand Up @@ -660,12 +658,13 @@ class DeconzAdapter extends Adapter {
logger.debug(`Try to find network address of ${resp.srcAddr64}`, NS);
// Note: Device expects addresses with a 0x prefix...
srcAddr = Device.byIeeeAddr('0x' + resp.srcAddr64, false)?.networkAddress;
// apperantly some functions furhter up in the protocol stack expect this to be set.
// so let's make sure they get the network address
// Note: srcAddr16 can be undefined after this and this is intended behavior
// there are zigbee frames which do not contain a 16 bit address, e.g. during joining.
// So any code that relies on srcAddr16 must handle this in some way.
resp.srcAddr16 = srcAddr;
}

assert(srcAddr, 'Failed to find srcAddr of message');
// apperantly some functions furhter up in the protocol stack expect this to be set.
// so let's make sure they get the network address
resp.srcAddr16 = srcAddr; // TODO: can't be undefined
}

if (resp.profileId === Zdo.ZDO_PROFILE_ID) {
Expand Down Expand Up @@ -724,7 +723,7 @@ class DeconzAdapter extends Adapter {
clusterID: resp.clusterId,
header,
data: resp.asduPayload,
address: resp.destAddrMode === 0x03 ? `0x${resp.srcAddr64!}` : resp.srcAddr16!,
address: resp.srcAddrMode === 0x03 ? `0x${resp.srcAddr64!}` : resp.srcAddr16!,
endpoint: resp.srcEndpoint,
linkquality: resp.lqi,
groupID: resp.destAddrMode === 0x01 ? resp.destAddr16! : 0,
Expand Down

0 comments on commit 3e7bfaa

Please sign in to comment.