Skip to content

Commit fbaa528

Browse files
committed
Do not always permit joins on the coordinator for builds > 20210708
Koenkk/Z-Stack-firmware@efac5ee
1 parent 709c23f commit fbaa528

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

zigpy_znp/zigbee/application.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -706,21 +706,24 @@ async def permit(self, time_s=60, node=None):
706706
Permit joining the network via a specific node or via all router nodes.
707707
"""
708708

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.
712709
LOGGER.info("Permitting joins for %d seconds", time_s)
713710

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+
)
724727

725728
if response.Status != t.Status.SUCCESS:
726729
raise RuntimeError(f"Failed to permit joins on the coordinator: {response}")

0 commit comments

Comments
 (0)