diff --git a/lib/zigbee.ts b/lib/zigbee.ts index 043889d4b..728b3f733 100644 --- a/lib/zigbee.ts +++ b/lib/zigbee.ts @@ -330,10 +330,15 @@ export default class Zigbee { } devices(includeCoordinator = true): Device[] { - return this.herdsman - .getDevices() - .map((d) => this.resolveDevice(d.ieeeAddr)) - .filter((d) => includeCoordinator || d.zh.type !== 'Coordinator'); + const devices: Device[] = []; + + for (const device of this.herdsman.getDevices()) { + if (includeCoordinator || device.type !== 'Coordinator') { + devices.push(this.resolveDevice(device.ieeeAddr)); + } + } + + return devices; } @bind private async acceptJoiningDeviceHandler(ieeeAddr: string): Promise {