projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add an option to exit immediately upon setting zookeeper. Change the
[python_utils.git]
/
smart_home
/
outlets.py
diff --git
a/smart_home/outlets.py
b/smart_home/outlets.py
index 37655673550364f77c0e97c693058575bb4a9821..0b4538c13b4c45acf6e4acf199549b896e3a8afb 100644
(file)
--- a/
smart_home/outlets.py
+++ b/
smart_home/outlets.py
@@
-1,5
+1,7
@@
#!/usr/bin/env python3
#!/usr/bin/env python3
+# © Copyright 2021-2022, Scott Gasch
+
"""Utilities for dealing with the smart outlets."""
import asyncio
"""Utilities for dealing with the smart outlets."""
import asyncio
@@
-183,6
+185,15
@@
class TPLinkOutletWithChildren(TPLinkOutlet):
return int(chi.get("on_time", "0"))
return 0
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."""
class GoogleOutlet(BaseOutlet):
"""A smart outlet controlled via Google Assistant."""