Skip to content

Commit 1243cf9

Browse files
authored
Use the zigpy channel migration API (#36)
* Use the zigpy network channel migration API * Bump minimum dependencies
1 parent 54ec10f commit 1243cf9

File tree

2 files changed

+7
-39
lines changed

2 files changed

+7
-39
lines changed

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ dependencies = [
1717
"click",
1818
"coloredlogs",
1919
"scapy",
20-
"zigpy>=0.54.0",
21-
"bellows>=0.35.0",
22-
"zigpy-deconz>=0.12.0",
23-
"zigpy-znp>=0.10.0",
24-
"zigpy-xbee>=0.17.0",
20+
"zigpy>=0.55.0",
21+
"bellows>=0.35.1",
22+
"zigpy-deconz>=0.21.0",
23+
"zigpy-xbee>=0.18.0",
24+
"zigpy-zigate>=0.11.0",
25+
"zigpy-znp>=0.11.1"
2526
]
2627

2728
[tool.setuptools.packages.find]

zigpy_cli/radio.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -236,37 +236,4 @@ async def change_channel(app, channel):
236236

237237
LOGGER.info("Current channel is %s", app.state.network_info.channel)
238238

239-
await zigpy.zdo.broadcast(
240-
app=app,
241-
command=zigpy.zdo.types.ZDOCmd.Mgmt_NWK_Update_req,
242-
grpid=None,
243-
radius=0,
244-
broadcast_address=zigpy.types.BroadcastAddress.ALL_DEVICES,
245-
NwkUpdate=zigpy.zdo.types.NwkUpdate(
246-
ScanChannels=zigpy.types.Channels.from_channel_list([channel]),
247-
ScanDuration=zigpy.zdo.types.NwkUpdate.CHANNEL_CHANGE_REQ,
248-
nwkUpdateId=app.state.network_info.nwk_update_id + 1,
249-
),
250-
)
251-
252-
try:
253-
await app.get_device(nwk=0x0000).zdo.Mgmt_NWK_Update_req(
254-
zigpy.zdo.types.NwkUpdate(
255-
ScanChannels=zigpy.types.Channels.from_channel_list([channel]),
256-
ScanDuration=zigpy.zdo.types.NwkUpdate.CHANNEL_CHANGE_REQ,
257-
nwkUpdateId=app.state.network_info.nwk_update_id + 1,
258-
),
259-
)
260-
except asyncio.TimeoutError:
261-
pass
262-
263-
while True:
264-
await app.load_network_info()
265-
266-
LOGGER.info("Channel is currently %s", app.state.network_info.channel)
267-
268-
if app.state.network_info.channel == channel:
269-
break
270-
271-
LOGGER.info("Waiting...")
272-
await asyncio.sleep(3)
239+
await app.move_network_to_channel(channel)

0 commit comments

Comments
 (0)