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,13 +162,15 @@ 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:
|
||||||
await plug.turn_on()
|
if plug.is_off:
|
||||||
|
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:
|
||||||
await plug.turn_off()
|
if plug.is_on:
|
||||||
|
await plug.turn_off()
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
@property # type: ignore
|
@property # type: ignore
|
||||||
|
Loading…
Reference in New Issue
Block a user