mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-12-24 13:40:18 +00:00
Check child state before updating
This commit is contained in:
@@ -162,12 +162,14 @@ class IotStrip(IotDevice):
|
|||||||
async def turn_on(self, **kwargs) -> dict:
|
async def turn_on(self, **kwargs) -> dict:
|
||||||
"""Turn the strip on."""
|
"""Turn the strip on."""
|
||||||
for plug in self.children:
|
for plug in self.children:
|
||||||
|
if plug.is_off:
|
||||||
await plug.turn_on()
|
await plug.turn_on()
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
async def turn_off(self, **kwargs) -> dict:
|
async def turn_off(self, **kwargs) -> dict:
|
||||||
"""Turn the strip off."""
|
"""Turn the strip off."""
|
||||||
for plug in self.children:
|
for plug in self.children:
|
||||||
|
if plug.is_on:
|
||||||
await plug.turn_off()
|
await plug.turn_off()
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user