@@ -315,13 +315,19 @@ async def update_network(
315
315
* ,
316
316
channel : typing .Optional [t .uint8_t ] = None ,
317
317
channels : typing .Optional [t .Channels ] = None ,
318
- pan_id : typing .Optional [t .PanId ] = None ,
319
318
extended_pan_id : typing .Optional [t .ExtendedPanId ] = None ,
320
319
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 ,
321
324
reset : bool = True ,
322
325
):
323
326
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" )
325
331
326
332
if channels is not None :
327
333
await self ._znp .request (
@@ -375,7 +381,7 @@ async def _reset(self):
375
381
callback = c .SysCommands .ResetInd .Callback (partial = True ),
376
382
)
377
383
378
- async def form_network (self , channels = [ 15 ], pan_id = None , extended_pan_id = None ):
384
+ async def form_network (self ):
379
385
# These options are read only on startup so we perform a soft reset right after
380
386
await self ._znp .nvram_write (
381
387
NwkNvIds .STARTUP_OPTION , t .StartupOptions .ClearState
@@ -394,19 +400,22 @@ async def form_network(self, channels=[15], pan_id=None, extended_pan_id=None):
394
400
# the device will retrieve the pre-configured key from NV memory if the NV_INIT
395
401
# compile option is defined (the NV item is called ZCD_NV_PRECFGKEY).
396
402
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
+
397
408
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 ],
400
410
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 )] ),
405
415
reset = False ,
406
416
)
407
417
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
410
419
await self ._znp .nvram_write (NwkNvIds .ZDO_DIRECT_CB , t .Bool (True ))
411
420
412
421
await self ._znp .request (
0 commit comments