Fix a bug in device.py around the type of keywords, add logging and
authorScott Gasch <[email protected]>
Fri, 4 Feb 2022 16:23:14 +0000 (08:23 -0800)
committerScott Gasch <[email protected]>
Fri, 4 Feb 2022 16:23:14 +0000 (08:23 -0800)
add manage_switch_off_timers to the deps run at each checkin.

smart_home/device.py
smart_home/lights.py
tests/run_some_dependencies_test.py

index 02717a343f433414398425c7d16e4939414ecf2a..06187d7a6578e2eaedb5d86e6173977d62b6288d 100644 (file)
@@ -11,14 +11,14 @@ class Device(object):
         self,
         name: str,
         mac: str,
-        keywords: Optional[List[str]],
+        keywords: Optional[str] = "",
     ):
         self.name = name
         self.mac = mac
         self.keywords = keywords
         self.arper = arper.Arper()
         if keywords is not None:
-            self.kws = keywords
+            self.kws: List[str] = keywords.split(' ')
         else:
             self.kws = []
 
index 80bfffa9db61b1639d5ff19aa9a12df387bdb90d..ac1cc885f94973a74f3b7dabcb41f45a9dbac957 100644 (file)
@@ -329,6 +329,7 @@ class TPLinkLight(BaseLight):
     @timeout(10.0, use_signals=False, error_message="Timed out waiting for tplink.py")
     def get_info(self) -> Optional[Dict]:
         cmd = self.get_cmdline() + "-c info"
+        logger.debug(f'Getting status of {self.mac} via "{cmd}"...')
         out = subprocess.getoutput(cmd)
         logger.debug(f'RAW OUT> {out}')
         out = re.sub("Sent:.*\n", "", out)
index 7e87d44561088b7d6bf9ca0ed4232ae9c3063fa7..20f44cbdac53c318d3918cd89210840822662790 100755 (executable)
@@ -26,6 +26,7 @@ class RunSomeDependenciesTest(unittest.TestCase):
             "/home/scott/bin/tplink.py -a office_lights -c info --audit_import_events >& /dev/null",
             "/home/scott/bin/unscramble.py ethyropadratoyzrhoiectmi --trace_memory >& /dev/null",
             "/home/scott/bin/cron.py --command='sleep 0' --lockfile=/tmp/deleteme_lock >& /dev/null",
+            "/home/scott/cron/manage_switch_off_timers.py >& /dev/null",
         ]
         for command in commands:
             try: