10000 Fix update errors on hubs with unsupported children (#1344) · python-kasa/python-kasa@be8b713 · GitHub
[go: up one dir, main page]

Skip to content

Commit be8b713

Browse files
authored
Fix update errors on hubs with unsupported children (#1344)
1 parent 1c9ee4d commit be8b713

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

kasa/smart/smartdevice.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,14 @@ def _update_children_info(self) -> None:
167167
self._last_update, "get_child_device_list", {}
168168
):
169169
for info in child_info["child_device_list"]:
170-
self._children[info["device_id"]]._update_internal_state(info)
170+
child_id = info["device_id"]
171+
if child_id not in self._children:
172+
_LOGGER.debug(
173+
"Skipping child update for %s, probably unsupported device",
174+
child_id,
175+
)
176+
continue
177+
self._children[child_id]._update_internal_state(info)
171178

172179
def _update_internal_info(self, info_resp: dict) -> None:
173180
"""Update the internal device info."""

kasa/smartcam/smartcamdevice.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ def _update_children_info(self) -> None:
6868
self._last_update, "getChildDeviceList", {}
6969
):
7070
for info in child_info["child_device_list"]:
71-
self._children[info["device_id"]]._update_internal_state(info)
71+
child_id = info["device_id"]
72+
if child_id not in self._children:
73+
_LOGGER.debug(
74+
"Skipping child update for %s, probably unsupported device",
75+
child_id,
76+
)
77+
continue
78+
self._children[child_id]._update_internal_state(info)
7279

7380
async def _initialize_smart_child(
7481
self, info: dict, child_components: dict

0 commit comments

Comments
 (0)
0