mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-29 07:08:56 +00:00
fix: Improve looping when retrieving all devices from herdsman (#23405)
This commit is contained in:
+9
-4
@@ -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<boolean> {
|
||||
|
||||
Reference in New Issue
Block a user