Check child state before updating

This commit is contained in:
Steven B 2024-12-20 09:29:34 +00:00
parent 3992a39264
commit a99af97b65
No known key found for this signature in database
GPG Key ID: 6D5B46B3679F2A43

View File

@ -162,12 +162,14 @@ class IotStrip(IotDevice):
async def turn_on(self, **kwargs) -> dict:
"""Turn the strip on."""
for plug in self.children:
if plug.is_off:
await plug.turn_on()
return {}
async def turn_off(self, **kwargs) -> dict:
"""Turn the strip off."""
for plug in self.children:
if plug.is_on:
await plug.turn_off()
return {}