Skip to content

Commit

Permalink
List nearby networks as well
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Jul 29, 2024
1 parent 1de3134 commit d8bc230
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions zigpy_cli/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,25 @@ def iter_channels():
timestamp = time.time()
output.write(f"{timestamp:0.4f},{channel},{energy:0.4f}\n")

import bellows.types
from bellows.zigbee.application import (
ControllerApplication as EzspControllerApplication,
)

if not isinstance(app, EzspControllerApplication):
return

await asyncio.sleep(1)
for channel in channels:
networks = await app._ezsp.startScan(
scanType=bellows.types.EzspNetworkScanType.ACTIVE_SCAN,
channelMask=zigpy.types.Channels.from_channel_list([channel]),
duration=6,
)

for network, lqi, rssi in networks:
print(f"Found network {network}: LQI={lqi}, RSSI={rssi}")


@radio.command()
@click.pass_obj
Expand Down

0 comments on commit d8bc230

Please sign in to comment.