@@ -343,22 +343,20 @@ async def force_remove(self, dev: zigpy.device.Device) -> None:
343343
344344 # Z-Stack does not have any way to do this
345345
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 :
347349 """
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 .
349351 """
350352
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-
357353 await self ._znp .request (
358354 c .AppConfig .BDBAddInstallCode .Req (
359- InstallCodeFormat = install_code_format ,
355+ InstallCodeFormat = (
356+ c .app_config .InstallCodeFormat .KeyDerivedFromInstallCode
357+ ),
360358 IEEE = node ,
361- InstallCode = t . Bytes ( key ),
359+ InstallCode = link_key . serialize ( ),
362360 ),
363361 RspStatus = t .Status .SUCCESS ,
364362 )
@@ -384,6 +382,18 @@ async def permit_with_key(self, node: t.EUI64, code: bytes, time_s=60):
384382 RspStatus = t .Status .SUCCESS ,
385383 )
386384
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+
387397 async def _move_network_to_channel (
388398 self , new_channel : int , new_nwk_update_id : int
389399 ) -> None :
0 commit comments