@@ -304,21 +304,25 @@ def iter_channels():
304
304
305
305
await asyncio .sleep (1 )
306
306
for channel in channels :
307
- print (f"Scanning for networks on channel { channel } " )
308
307
networks = set ()
309
308
310
309
for attempt in range (num_network_scans ):
310
+ print (
311
+ "Scanning for networks on channel"
312
+ f" { channel } ({ attempt + 1 } / { num_network_scans } )"
313
+ )
311
314
networks_scan = await app ._ezsp .startScan (
312
315
scanType = bellows .types .EzspNetworkScanType .ACTIVE_SCAN ,
313
316
channelMask = zigpy .types .Channels .from_channel_list ([channel ]),
314
317
duration = 6 ,
315
318
)
316
- networks_scan = tuple (
317
- [(network .freeze (), lqi , rssi ) for network , lqi , rssi in networks_scan ]
318
- )
319
- new_networks = set (networks_scan ) - networks
320
319
321
- for network , lqi , rssi in new_networks :
320
+ for network , lqi , rssi in networks_scan :
321
+ if network .replace (allowingJoin = None ).freeze () in networks :
322
+ continue
323
+
324
+ networks .add (network .replace (allowingJoin = None ).freeze ())
325
+
322
326
print (f"Found network { network } : LQI={ lqi } , RSSI={ rssi } " )
323
327
scan_data ["network_scan" ].append (
324
328
{
@@ -332,8 +336,6 @@ def iter_channels():
332
336
}
333
337
)
334
338
335
- networks .update (new_networks )
336
-
337
339
json .dump (scan_data , output , separators = ("," , ":" ))
338
340
339
341
0 commit comments