From 5846bbdbbbf0d1666e2337cfce92c2d231b4bba2 Mon Sep 17 00:00:00 2001 From: Steven B <51370195+sdb9696@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:24:05 +0100 Subject: [PATCH] Fix iot strip so the children do not have led and cloud modules (#1010) Also adds led and cloud connection on the strip parent --- kasa/iot/iotstrip.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kasa/iot/iotstrip.py b/kasa/iot/iotstrip.py index eea9f32c..9c67002c 100755 --- a/kasa/iot/iotstrip.py +++ b/kasa/iot/iotstrip.py @@ -21,7 +21,7 @@ from .iotdevice import ( ) from .iotmodule import IotModule from .iotplug import IotPlug -from .modules import Antitheft, Countdown, Schedule, Time, Usage +from .modules import Antitheft, Cloud, Countdown, Emeter, Led, Schedule, Time, Usage _LOGGER = logging.getLogger(__name__) @@ -107,6 +107,8 @@ class IotStrip(IotDevice): self.add_module(Module.IotUsage, Usage(self, "schedule")) self.add_module(Module.IotTime, Time(self, "time")) self.add_module(Module.IotCountdown, Countdown(self, "countdown")) + self.add_module(Module.Led, Led(self, "system")) + self.add_module(Module.IotCloud, Cloud(self, "cnCloud")) if self.has_emeter: _LOGGER.debug( "The device has emeter, querying its information along sysinfo" @@ -317,8 +319,12 @@ class IotStripPlug(IotPlug): async def _initialize_modules(self): """Initialize modules not added in init.""" - await super()._initialize_modules() - self.add_module("time", Time(self, "time")) + if self.has_emeter: + self.add_module(Module.Energy, Emeter(self, self.emeter_type)) + self.add_module(Module.IotUsage, Usage(self, "schedule")) + self.add_module(Module.IotAntitheft, Antitheft(self, "anti_theft")) + self.add_module(Module.IotSchedule, Schedule(self, "schedule")) + self.add_module(Module.IotCountdown, Countdown(self, "countdown")) async def _initialize_features(self): """Initialize common features."""