@@ -706,21 +706,24 @@ async def permit(self, time_s=60, node=None):
706
706
Permit joining the network via a specific node or via all router nodes.
707
707
"""
708
708
709
- # Always permit joins on the coordinator first.
710
- # This unfortunately makes it impossible to permit joins via just one router
711
- # alone but firmware changes can make this possible on newer hardware.
712
709
LOGGER .info ("Permitting joins for %d seconds" , time_s )
713
710
714
- response = await self ._znp .request_callback_rsp (
715
- request = c .ZDO .MgmtPermitJoinReq .Req (
716
- AddrMode = t .AddrMode .NWK ,
717
- Dst = 0x0000 ,
718
- Duration = time_s ,
719
- TCSignificance = 1 ,
720
- ),
721
- RspStatus = t .Status .SUCCESS ,
722
- callback = c .ZDO .MgmtPermitJoinRsp .Callback (Src = 0x0000 , partial = True ),
723
- )
711
+ if self ._version_rsp .CodeRevision < 20210708 :
712
+ # If joins were permitted through a specific router, older Z-Stack builds
713
+ # did not allow the key to be distributed unless the coordinator itself was
714
+ # also permitting joins.
715
+ #
716
+ # Fixed in https://github.com/Koenkk/Z-Stack-firmware/commit/efac5ee46b9b437
717
+ response = await self ._znp .request_callback_rsp (
718
+ request = c .ZDO .MgmtPermitJoinReq .Req (
719
+ AddrMode = t .AddrMode .NWK ,
720
+ Dst = 0x0000 ,
721
+ Duration = time_s ,
722
+ TCSignificance = 1 ,
723
+ ),
724
+ RspStatus = t .Status .SUCCESS ,
725
+ callback = c .ZDO .MgmtPermitJoinRsp .Callback (Src = 0x0000 , partial = True ),
726
+ )
724
727
725
728
if response .Status != t .Status .SUCCESS :
726
729
raise RuntimeError (f"Failed to permit joins on the coordinator: { response } " )
0 commit comments