Add mode.
[python_utils.git] / smart_home / outlets.py
index a7f6f47e4225610c21b09ce7e36f547ba7f39157..60b98a63534e6897f6b448edaedebe9bb9c638b1 100644 (file)
@@ -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