Fix iot strip so the children do not have led and cloud modules (#1010)

Also adds led and cloud connection on the strip parent
This commit is contained in:
Steven B 2024-06-25 17:24:05 +01:00 committed by GitHub
parent 4df5fbc0dd
commit 5846bbdbbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,7 +21,7 @@ from .iotdevice import (
) )
from .iotmodule import IotModule from .iotmodule import IotModule
from .iotplug import IotPlug 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__) _LOGGER = logging.getLogger(__name__)
@ -107,6 +107,8 @@ class IotStrip(IotDevice):
self.add_module(Module.IotUsage, Usage(self, "schedule")) self.add_module(Module.IotUsage, Usage(self, "schedule"))
self.add_module(Module.IotTime, Time(self, "time")) self.add_module(Module.IotTime, Time(self, "time"))
self.add_module(Module.IotCountdown, Countdown(self, "countdown")) 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: if self.has_emeter:
_LOGGER.debug( _LOGGER.debug(
"The device has emeter, querying its information along sysinfo" "The device has emeter, querying its information along sysinfo"
@ -317,8 +319,12 @@ class IotStripPlug(IotPlug):
async def _initialize_modules(self): async def _initialize_modules(self):
"""Initialize modules not added in init.""" """Initialize modules not added in init."""
await super()._initialize_modules() if self.has_emeter:
self.add_module("time", Time(self, "time")) 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): async def _initialize_features(self):
"""Initialize common features.""" """Initialize common features."""