From ebc953d56f3ca576bfc47254356b0dcee2de4d2b Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:41:15 -0400 Subject: [PATCH] Add the current channel as well --- zigpy_cli/radio.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/zigpy_cli/radio.py b/zigpy_cli/radio.py index 85af5e8..81fce2a 100644 --- a/zigpy_cli/radio.py +++ b/zigpy_cli/radio.py @@ -253,6 +253,7 @@ async def advanced_energy_scan( scan_counts = {channel: num_energy_scans for channel in channels} scan_data = { + "current_channel": app.state.network_info.channel, "energy_scan": [], "network_scan": [], } @@ -302,7 +303,10 @@ def iter_channels(): } ) - await asyncio.sleep(1) + if not isinstance(app, EzspControllerApplication): + json.dump(scan_data, output, separators=(",", ":")) + return + for channel in channels: networks = set() @@ -329,10 +333,11 @@ def iter_channels(): "channel": channel, "lqi": lqi, "rssi": rssi, - "network": { - **network.as_dict(), - "extendedPanId": str(network.extendedPanId), - }, + "allowing_join": network.allowingJoin, + "extended_pan_id": str(network.extendedPanId), + "nwk_update_id": network.nwkUpdateId, + "pan_id": network.panId, + "stack_profile": network.stackProfile, } )