Skip to content

Commit a0de91e

Browse files
authored
Always set the ZDO logical type for intermediate stored devices (#157)
1 parent ecfc6ec commit a0de91e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

zigpy_znp/znp/security.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import dataclasses
66

77
import zigpy.state
8+
import zigpy.zdo.types as zdo_t
89

910
import zigpy_znp.const as const
1011
import zigpy_znp.types as t
@@ -272,14 +273,20 @@ async def read_devices(
272273
t.AddrMgrUserType.Assoc | t.AddrMgrUserType.Security,
273274
t.AddrMgrUserType.Security,
274275
):
276+
is_child = bool(entry.type & t.AddrMgrUserType.Assoc)
277+
275278
devices[entry.extAddr] = StoredDevice(
276279
node_info=zigpy.state.NodeInfo(
277280
nwk=entry.nwkAddr,
278281
ieee=entry.extAddr,
279-
logical_type=None,
282+
logical_type=(
283+
zdo_t.LogicalType.EndDevice
284+
if is_child
285+
else zdo_t.LogicalType.Router
286+
),
280287
),
281288
key=None,
282-
is_child=bool(entry.type & t.AddrMgrUserType.Assoc),
289+
is_child=is_child,
283290
)
284291
else:
285292
raise ValueError(f"Unexpected entry type: {entry.type}")

0 commit comments

Comments
 (0)