Skip to content

Commit 406b21f

Browse files
authored
Handle ZDO neighbors command returning unsupported status (#228)
1 parent fc4a131 commit 406b21f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tests/test_commands.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,3 +543,19 @@ class TestSubsystem(t.CommandsBase, subsystem=t.Subsystem.SYS):
543543
assert Test.from_frame(frames.GeneralFrame(header=Test.header, data=b"")) == Test(
544544
Data=t.Bytes(b"")
545545
)
546+
547+
548+
def test_neighbors_missing_payload():
549+
frame = frames.GeneralFrame(
550+
header=t.CommandHeader(
551+
id=0xB1,
552+
subsystem=t.Subsystem.ZDO,
553+
type=t.CommandType.AREQ,
554+
),
555+
data=b"\x1F\x82\x84",
556+
)
557+
558+
assert c.ZDO.MgmtLqiRsp.Callback.from_frame(frame) == c.ZDO.MgmtLqiRsp.Callback(
559+
Src=0x821F,
560+
Status=t.ZDOStatus.NOT_SUPPORTED,
561+
)

zigpy_znp/commands/zdo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ class ZDO(t.CommandsBase, subsystem=t.Subsystem.ZDO):
11811181
t.Param(
11821182
"Status", t.ZDOStatus, "Status is either Success (0) or Failure (1)"
11831183
),
1184-
t.Param("Neighbors", zigpy.zdo.types.Neighbors, "Neighbors"),
1184+
t.Param("Neighbors", zigpy.zdo.types.Neighbors, "Neighbors", optional=True),
11851185
),
11861186
)
11871187

0 commit comments

Comments
 (0)