Skip to content

Commit aa17d01

Browse files
committed
Permit joins only to the coordinator when permit_ncp is called
1 parent b06e638 commit aa17d01

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/test_application.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def application(znp_server):
181181
],
182182
)
183183

184-
active_eps = [100, 2, 1]
184+
active_eps = [1]
185185

186186
znp_server.reply_to(
187187
request=c.ZDO.ActiveEpReq.Req(DstAddr=0x0000, NWKAddrOfInterest=0x0000),
@@ -346,7 +346,7 @@ async def test_application_startup_endpoints(application):
346346

347347
await app.startup(auto_form=False)
348348

349-
assert len(endpoints) == 3
349+
assert len(endpoints) == 1
350350

351351

352352
@pytest_mark_asyncio_timeout(seconds=5)
@@ -425,7 +425,7 @@ async def test_permit_join(application):
425425
request=c.ZDO.MgmtPermitJoinReq.Req(partial=True),
426426
responses=[
427427
c.ZDO.MgmtPermitJoinReq.Rsp(Status=t.Status.SUCCESS),
428-
c.ZDO.MgmtPermitJoinRsp.Callback(Src=0x0000, Status=t.ZDOStatus.SUCCESS),
428+
c.ZDO.MgmtPermitJoinRsp.Callback(Src=0xFFFC, Status=t.ZDOStatus.SUCCESS),
429429
],
430430
)
431431

@@ -454,7 +454,7 @@ async def test_permit_join_failure(application):
454454
request=c.ZDO.MgmtPermitJoinReq.Req(partial=True),
455455
responses=[
456456
c.ZDO.MgmtPermitJoinReq.Rsp(Status=t.Status.SUCCESS),
457-
c.ZDO.MgmtPermitJoinRsp.Callback(Src=0xFFFF, Status=t.ZDOStatus.TIMEOUT),
457+
c.ZDO.MgmtPermitJoinRsp.Callback(Src=0xFFFC, Status=t.ZDOStatus.TIMEOUT),
458458
],
459459
)
460460

zigpy_znp/zigbee/application.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ async def force_remove(self, device) -> None:
818818
async def permit_ncp(self, time_s: int) -> None:
819819
response = await self._znp.request_callback_rsp(
820820
request=c.ZDO.MgmtPermitJoinReq.Req(
821-
AddrMode=t.AddrMode.Broadcast,
822-
Dst=zigpy.types.BroadcastAddress.ALL_DEVICES,
821+
AddrMode=t.AddrMode.NWK,
822+
Dst=0x0000,
823823
Duration=time_s,
824824
# "This field shall always have a value of 1,
825825
# indicating a request to change the

0 commit comments

Comments
 (0)