Skip to content

Commit

Permalink
Handle ZDO neighbors command returning unsupported status (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly authored Oct 9, 2023
1 parent fc4a131 commit 406b21f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,3 +543,19 @@ class TestSubsystem(t.CommandsBase, subsystem=t.Subsystem.SYS):
assert Test.from_frame(frames.GeneralFrame(header=Test.header, data=b"")) == Test(
Data=t.Bytes(b"")
)


def test_neighbors_missing_payload():
frame = frames.GeneralFrame(
header=t.CommandHeader(
id=0xB1,
subsystem=t.Subsystem.ZDO,
type=t.CommandType.AREQ,
),
data=b"\x1F\x82\x84",
)

assert c.ZDO.MgmtLqiRsp.Callback.from_frame(frame) == c.ZDO.MgmtLqiRsp.Callback(
Src=0x821F,
Status=t.ZDOStatus.NOT_SUPPORTED,
)
2 changes: 1 addition & 1 deletion zigpy_znp/commands/zdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ class ZDO(t.CommandsBase, subsystem=t.Subsystem.ZDO):
t.Param(
"Status", t.ZDOStatus, "Status is either Success (0) or Failure (1)"
),
t.Param("Neighbors", zigpy.zdo.types.Neighbors, "Neighbors"),
t.Param("Neighbors", zigpy.zdo.types.Neighbors, "Neighbors", optional=True),
),
)

Expand Down

0 comments on commit 406b21f

Please sign in to comment.