|
4 | 4 | import itertools
|
5 | 5 | from collections import deque, defaultdict
|
6 | 6 |
|
| 7 | +import zigpy.zdo.types as zdo_t |
| 8 | + |
7 | 9 | import zigpy_znp.types as t
|
8 |
| -import zigpy_znp.commands as c |
9 | 10 | from zigpy_znp.tools.common import setup_parser
|
10 | 11 | from zigpy_znp.zigbee.application import ControllerApplication
|
11 | 12 |
|
@@ -34,20 +35,17 @@ async def perform_energy_scan(radio_path, num_scans=None):
|
34 | 35 | if num_scans is not None and i > num_scans:
|
35 | 36 | break
|
36 | 37 |
|
37 |
| - rsp = await app._znp.request_callback_rsp( |
38 |
| - request=c.ZDO.MgmtNWKUpdateReq.Req( |
39 |
| - Dst=0x0000, |
40 |
| - DstAddrMode=t.AddrMode.NWK, |
41 |
| - Channels=t.Channels.ALL_CHANNELS, |
42 |
| - ScanDuration=0x02, # exponent |
| 38 | + rsp = await app.get_device(nwk=0x0000).zdo.Mgmt_NWK_Update_req( |
| 39 | + zdo_t.NwkUpdate( |
| 40 | + ScanChannels=t.Channels.ALL_CHANNELS, |
| 41 | + ScanDuration=0x02, |
43 | 42 | ScanCount=1,
|
44 |
| - NwkManagerAddr=0x0000, |
45 |
| - ), |
46 |
| - RspStatus=t.Status.SUCCESS, |
47 |
| - callback=c.ZDO.MgmtNWKUpdateNotify.Callback(partial=True, Src=0x0000), |
| 43 | + ) |
48 | 44 | )
|
49 | 45 |
|
50 |
| - for channel, energy in zip(rsp.ScannedChannels, rsp.EnergyValues): |
| 46 | + _, scanned_channels, _, _, energy_values = rsp |
| 47 | + |
| 48 | + for channel, energy in zip(scanned_channels, energy_values): |
51 | 49 | energies = channel_energies[channel]
|
52 | 50 | energies.append(energy)
|
53 | 51 |
|
|
0 commit comments