@@ -343,22 +343,20 @@ async def force_remove(self, dev: zigpy.device.Device) -> None:
343
343
344
344
# Z-Stack does not have any way to do this
345
345
346
- async def permit_with_key (self , node : t .EUI64 , code : bytes , time_s = 60 ):
346
+ async def permit_with_link_key (
347
+ self , node : t .EUI64 , link_key : t .KeyData , time_s : int = 60
348
+ ) -> None :
347
349
"""
348
- Permits a new device to join with the given IEEE and Install Code .
350
+ Permits a new device to join with the given IEEE and link key .
349
351
"""
350
352
351
- key = zigpy .util .convert_install_code (code )
352
- install_code_format = c .app_config .InstallCodeFormat .KeyDerivedFromInstallCode
353
-
354
- if key is None :
355
- raise ValueError (f"Invalid install code: { code !r} " )
356
-
357
353
await self ._znp .request (
358
354
c .AppConfig .BDBAddInstallCode .Req (
359
- InstallCodeFormat = install_code_format ,
355
+ InstallCodeFormat = (
356
+ c .app_config .InstallCodeFormat .KeyDerivedFromInstallCode
357
+ ),
360
358
IEEE = node ,
361
- InstallCode = t . Bytes ( key ),
359
+ InstallCode = link_key . serialize ( ),
362
360
),
363
361
RspStatus = t .Status .SUCCESS ,
364
362
)
@@ -384,6 +382,18 @@ async def permit_with_key(self, node: t.EUI64, code: bytes, time_s=60):
384
382
RspStatus = t .Status .SUCCESS ,
385
383
)
386
384
385
+ async def permit_with_key (self , node : t .EUI64 , code : bytes , time_s = 60 ):
386
+ """
387
+ Permits a new device to join with the given IEEE and Install Code.
388
+ """
389
+
390
+ key = zigpy .util .convert_install_code (code )
391
+
392
+ if key is None :
393
+ raise ValueError (f"Invalid install code: { code !r} " )
394
+
395
+ await self .permit_with_link_key (node = node , link_key = key , time_s = time_s )
396
+
387
397
async def _move_network_to_channel (
388
398
self , new_channel : int , new_nwk_update_id : int
389
399
) -> None :
0 commit comments