Skip to content

Commit 99658f5

Browse files
committed
Update schema to zigpy==0.20.1a1
1 parent abfc99e commit 99658f5

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
install_requires=[
2222
"attrs",
2323
"pyserial-asyncio",
24-
"zigpy >= 0.20.0",
24+
"zigpy>=0.20.1a1",
2525
"async_timeout",
2626
"voluptuous",
2727
],

zigpy_znp/config.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@
33

44
import voluptuous as vol
55
from zigpy.config import ( # noqa: F401
6-
CONF_DEVICE,
7-
CONF_DEVICE_PATH,
86
CONFIG_SCHEMA,
97
SCHEMA_DEVICE,
8+
CONF_DEVICE,
9+
CONF_DEVICE_PATH,
10+
CONF_NWK,
11+
CONF_NWK_CHANNEL,
12+
CONF_NWK_CHANNELS,
13+
CONF_NWK_EXTENDED_PAN_ID,
14+
CONF_NWK_PAN_ID,
15+
CONF_NWK_KEY,
16+
CONF_NWK_TC_ADDRESS,
17+
CONF_NWK_TC_LINK_KEY,
18+
CONF_NWK_UPDATE_ID,
1019
cv_boolean,
1120
)
1221

zigpy_znp/zigbee/application.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,19 @@ async def update_network(
315315
*,
316316
channel: typing.Optional[t.uint8_t] = None,
317317
channels: typing.Optional[t.Channels] = None,
318-
pan_id: typing.Optional[t.PanId] = None,
319318
extended_pan_id: typing.Optional[t.ExtendedPanId] = None,
320319
network_key: typing.Optional[t.KeyData] = None,
320+
pan_id: typing.Optional[t.PanId] = None,
321+
tc_address: typing.Optional[t.KeyData] = None,
322+
tc_link_key: typing.Optional[t.KeyData] = None,
323+
update_id: int = 0,
321324
reset: bool = True,
322325
):
323326
if channel is not None:
324-
raise NotImplementedError("Cannot set a specific channel")
327+
LOGGER.warning("Cannot set a specific channel in config: %d", channel)
328+
329+
if tc_link_key is not None:
330+
LOGGER.warning("Trust center link key in config is not yet supported")
325331

326332
if channels is not None:
327333
await self._znp.request(
@@ -375,7 +381,7 @@ async def _reset(self):
375381
callback=c.SysCommands.ResetInd.Callback(partial=True),
376382
)
377383

378-
async def form_network(self, channels=[15], pan_id=None, extended_pan_id=None):
384+
async def form_network(self):
379385
# These options are read only on startup so we perform a soft reset right after
380386
await self._znp.nvram_write(
381387
NwkNvIds.STARTUP_OPTION, t.StartupOptions.ClearState
@@ -394,19 +400,22 @@ async def form_network(self, channels=[15], pan_id=None, extended_pan_id=None):
394400
# the device will retrieve the pre-configured key from NV memory if the NV_INIT
395401
# compile option is defined (the NV item is called ZCD_NV_PRECFGKEY).
396402

403+
pan_id = self.config[conf.SCHEMA_NETWORK][conf.CONF_NWK_PAN_ID]
404+
extended_pan_id = self.config[conf.SCHEMA_NETWORK][
405+
conf.CONF_NWK_EXTENDED_PAN_ID
406+
]
407+
397408
await self.update_network(
398-
channel=None,
399-
channels=t.Channels.from_channel_list(channels),
409+
channels=self.config[conf.SCHEMA_NETWORK][conf.CONF_NWK_CHANNELS],
400410
pan_id=0xFFFF if pan_id is None else pan_id,
401-
extended_pan_id=ExtendedPanId(
402-
os.urandom(8) if extended_pan_id is None else extended_pan_id
403-
),
404-
network_key=t.KeyData(os.urandom(16)),
411+
extended_pan_id=ExtendedPanId(os.urandom(8))
412+
if extended_pan_id is None
413+
else extended_pan_id,
414+
network_key=t.KeyData([os.urandom(16)]),
405415
reset=False,
406416
)
407417

408-
# We do not want to receive verbose ZDO callbacks
409-
# Just pass ZDO callbacks back to Zigpy
418+
# We want to receive all ZDO callbacks to proxy them back go zipgy
410419
await self._znp.nvram_write(NwkNvIds.ZDO_DIRECT_CB, t.Bool(True))
411420

412421
await self._znp.request(

0 commit comments

Comments
 (0)