From e73da5b677582e8c243f78b5344844f845821f14 Mon Sep 17 00:00:00 2001 From: "Steven B." <51370195+sdb9696@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:21:54 +0000 Subject: [PATCH] Fix AES child device creation error (#1220) Bug exposed when passing credentials_hash and creating child devices for klap devices as the default is to try to create an AES transport and the credentials hashes are incompatible. --- kasa/smart/smartchilddevice.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kasa/smart/smartchilddevice.py b/kasa/smart/smartchilddevice.py index f3e39ce9..a5b24fd5 100644 --- a/kasa/smart/smartchilddevice.py +++ b/kasa/smart/smartchilddevice.py @@ -42,13 +42,12 @@ class SmartChildDevice(SmartDevice): config: DeviceConfig | None = None, protocol: SmartProtocol | None = None, ) -> None: - super().__init__(parent.host, config=parent.config, protocol=protocol) + self._id = info["device_id"] + _protocol = protocol or _ChildProtocolWrapper(self._id, parent.protocol) + super().__init__(parent.host, config=parent.config, protocol=_protocol) self._parent = parent self._update_internal_state(info) self._components = component_info - self._id = info["device_id"] - # wrap device protocol if no protocol is given - self.protocol = protocol or _ChildProtocolWrapper(self._id, parent.protocol) async def update(self, update_children: bool = True): """Update child module info.