summaryrefslogtreecommitdiff
path: root/smart_home/outlets.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-02-10 14:10:48 -0800
committerScott Gasch <[email protected]>2022-02-10 14:10:48 -0800
commitf2600f30801c849fc1d139386e3ddc3c9eb43e30 (patch)
tree74c5173bf47322bcfbbd2985adfb54741cf3c4cc /smart_home/outlets.py
parent415c2c91972ea5a574dce166ec609926dcf19d73 (diff)
More cleanup.
Diffstat (limited to 'smart_home/outlets.py')
-rw-r--r--smart_home/outlets.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/smart_home/outlets.py b/smart_home/outlets.py
index a7f6f47..60b98a6 100644
--- a/smart_home/outlets.py
+++ b/smart_home/outlets.py
@@ -58,11 +58,13 @@ def tplink_outlet_command(command: str) -> bool:
logger.warning(msg)
logging_utils.hlog(msg)
return False
- logger.debug(f'{command} succeeded.')
+ logger.debug('%s succeeded.', command)
return True
class BaseOutlet(dev.Device):
+ """An abstract base class for smart outlets."""
+
def __init__(self, name: str, mac: str, keywords: str = "") -> None:
super().__init__(name.strip(), mac.strip(), keywords)
@@ -84,6 +86,8 @@ class BaseOutlet(dev.Device):
class TPLinkOutlet(BaseOutlet):
+ """A TPLink smart outlet."""
+
def __init__(self, name: str, mac: str, keywords: str = '') -> None:
super().__init__(name, mac, keywords)
self.info: Optional[Dict] = None
@@ -150,6 +154,9 @@ class TPLinkOutlet(BaseOutlet):
class TPLinkOutletWithChildren(TPLinkOutlet):
+ """A TPLink outlet where the top and bottom plus are individually
+ controllable."""
+
def __init__(self, name: str, mac: str, keywords: str = "") -> None:
super().__init__(name, mac, keywords)
self.children: List[str] = []
@@ -178,7 +185,7 @@ class TPLinkOutletWithChildren(TPLinkOutlet):
cmd = self.get_cmdline(child) + f"-c {cmd}"
if extra_args is not None:
cmd += f" {extra_args}"
- logger.debug(f'About to execute {cmd}')
+ logger.debug('About to execute: %s', cmd)
return tplink_outlet_command(cmd)
def get_children(self) -> List[str]:
@@ -208,6 +215,8 @@ class TPLinkOutletWithChildren(TPLinkOutlet):
class GoogleOutlet(BaseOutlet):
+ """A smart outlet controlled via Google Assistant."""
+
def __init__(self, name: str, mac: str, keywords: str = "") -> None:
super().__init__(name.strip(), mac.strip(), keywords)
self.info = None
@@ -285,6 +294,8 @@ class MerossWrapper(object):
class MerossOutlet(BaseOutlet):
+ """A Meross smart outlet class."""
+
def __init__(self, name: str, mac: str, keywords: str = '') -> None:
super().__init__(name, mac, keywords)
self.meross_wrapper: Optional[MerossWrapper] = None