summaryrefslogtreecommitdiff
path: root/smart_home
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-06-07 09:04:44 -0700
committerScott Gasch <[email protected]>2022-06-07 09:04:44 -0700
commit5979fc153c921d4b4074024f9021f894342739c1 (patch)
tree9d18783eed3d250b45f6506b95c2de1fb0fa20d9 /smart_home
parent3794ba43f9661e9093af70728ae8614caea65f1f (diff)
Fix tplink outlets with children is_on to check the children.
Diffstat (limited to 'smart_home')
-rw-r--r--smart_home/outlets.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/smart_home/outlets.py b/smart_home/outlets.py
index fcc3c4e..0b4538c 100644
--- a/smart_home/outlets.py
+++ b/smart_home/outlets.py
@@ -185,6 +185,15 @@ class TPLinkOutletWithChildren(TPLinkOutlet):
return int(chi.get("on_time", "0"))
return 0
+ @overrides
+ def get_on_duration_seconds(self) -> int:
+ self.info = self.get_info()
+ if self.info is not None:
+ for child in self.info["children"]:
+ if int(child["on_time"]) > 0:
+ return True
+ return False
+
class GoogleOutlet(BaseOutlet):
"""A smart outlet controlled via Google Assistant."""