Skip to content

Commit 206fa80

Browse files
authored
fix: Fix Conbee adapter having no endpoints (#1376)
1 parent c000e1e commit 206fa80

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/adapter/deconz/adapter/deconzAdapter.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,24 @@ export class DeconzAdapter extends Adapter {
380380
const responseClusterId = Zdo.Utils.getResponseClusterId(clusterId);
381381

382382
if (responseClusterId) {
383-
const response = await this.waitForData(isNwkAddrRequest ? ieeeAddress : networkAddress, Zdo.ZDO_PROFILE_ID, responseClusterId);
384-
385-
return response.zdo! as ZdoTypes.RequestToResponseMap[K];
383+
try {
384+
const response = await this.waitForData(isNwkAddrRequest ? ieeeAddress : networkAddress, Zdo.ZDO_PROFILE_ID, responseClusterId);
385+
return response.zdo! as ZdoTypes.RequestToResponseMap[K];
386+
} catch (error) {
387+
if (responseClusterId == Zdo.ClusterId.ACTIVE_ENDPOINTS_RESPONSE && networkAddress === 0) {
388+
logger.warning('Failed to determine active endpoints of coordinator, falling back to [1]', NS);
389+
// Some Conbee adapaters don't provide a response to an active endpoint request of the coordinator, always return
390+
// an endpoint here. Before an active endpoint request was done to determine the endpoints, they were hardcoded:
391+
// https://github.com/Koenkk/zigbee-herdsman/blob/d855b3bf85a066cb7c325fe3ef0006873c735add/src/adapter/deconz/adapter/deconzAdapter.ts#L105
392+
const response: ZdoTypes.ResponseMap[Zdo.ClusterId.ACTIVE_ENDPOINTS_RESPONSE] = [
393+
Zdo.Status.SUCCESS,
394+
{endpointList: [1], nwkAddress: 0},
395+
];
396+
return response as ZdoTypes.RequestToResponseMap[K];
397+
} else {
398+
throw error;
399+
}
400+
}
386401
}
387402
}
388403
}

0 commit comments

Comments
 (0)