X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=smart_home%2Foutlets.py;h=0b4538c13b4c45acf6e4acf199549b896e3a8afb;hb=91df4fa006f7f4fba8e38a97941c5a4ad9b83706;hp=fcc3c4eb8f7fa74d428d31c7ebe4814c5cb11cbd;hpb=532df2c5b57c7517dfb3dddd8c1358fbadf8baf3;p=python_utils.git 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."""