Skip to content

Commit 6ba091f

Browse files
authored
Merge pull request #110 from reidab/zdo-converter-Mgmt_Bind_req
Add ZDO converter for Mgmt_Bind_req
2 parents d779a3d + 9024b56 commit 6ba091f

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

zigpy_znp/commands/zdo.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,7 @@ class GroupIdList(t.LVList, item_type=t.GroupId, length_type=t.uint8_t):
100100
pass
101101

102102

103-
class BindEntry(t.Struct):
104-
"""Bind table entry."""
105-
106-
Src: t.EUI64
107-
SrcEp: t.uint8_t
108-
ClusterId: t.ClusterId
109-
DstAddr: zigpy.zdo.types.MultiAddress
110-
111-
112-
class BindEntryList(t.LVList, item_type=BindEntry, length_type=t.uint8_t):
103+
class BindEntryList(t.LVList, item_type=zigpy.zdo.types.Binding, length_type=t.uint8_t):
113104
pass
114105

115106

@@ -1209,8 +1200,8 @@ class ZDO(t.CommandsBase, subsystem=t.Subsystem.ZDO):
12091200
t.uint8_t,
12101201
"Total number of entries available on the device",
12111202
),
1212-
t.Param("Index", t.uint8_t, "Index where the response starts"),
1213-
t.Param("BindTable", BindEntryList, "list of BindEntries"),
1203+
t.Param("StartIndex", t.uint8_t, "Index where the response starts"),
1204+
t.Param("BindTableList", BindEntryList, "list of BindEntries"),
12141205
),
12151206
)
12161207

zigpy_znp/zigbee/zdo_converters.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,26 @@
191191
(lambda addr: c.ZDO.MgmtRtgRsp.Callback(partial=True, Src=addr.address)),
192192
(lambda rsp: (ZDOCmd.Mgmt_Rtg_rsp, {"Status": rsp.Status})),
193193
),
194+
ZDOCmd.Mgmt_Bind_req: (
195+
(
196+
lambda addr, StartIndex: (
197+
c.ZDO.MgmtBindReq.Req(
198+
Dst=addr.address,
199+
StartIndex=StartIndex,
200+
)
201+
)
202+
),
203+
(lambda addr: c.ZDO.MgmtBindRsp.Callback(partial=True, Src=addr.address)),
204+
(
205+
lambda rsp: (
206+
ZDOCmd.Mgmt_Bind_rsp,
207+
{
208+
"Status": rsp.Status,
209+
"BindingTableEntries": rsp.BindTableEntries,
210+
"StartIndex": rsp.StartIndex,
211+
"BindingTableList": rsp.BindTableList,
212+
},
213+
)
214+
),
215+
),
194216
}

0 commit comments

Comments
 (0)