Skip to content

Commit d8bc230

Browse files
committed
List nearby networks as well
1 parent 1de3134 commit d8bc230

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

zigpy_cli/radio.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,25 @@ def iter_channels():
279279
timestamp = time.time()
280280
output.write(f"{timestamp:0.4f},{channel},{energy:0.4f}\n")
281281

282+
import bellows.types
283+
from bellows.zigbee.application import (
284+
ControllerApplication as EzspControllerApplication,
285+
)
286+
287+
if not isinstance(app, EzspControllerApplication):
288+
return
289+
290+
await asyncio.sleep(1)
291+
for channel in channels:
292+
networks = await app._ezsp.startScan(
293+
scanType=bellows.types.EzspNetworkScanType.ACTIVE_SCAN,
294+
channelMask=zigpy.types.Channels.from_channel_list([channel]),
295+
duration=6,
296+
)
297+
298+
for network, lqi, rssi in networks:
299+
print(f"Found network {network}: LQI={lqi}, RSSI={rssi}")
300+
282301

283302
@radio.command()
284303
@click.pass_obj

0 commit comments

Comments
 (0)