mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Check child state before updating
This commit is contained in:
parent
3992a39264
commit
a99af97b65
@ -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 {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user