From: Scott Gasch Date: Fri, 4 Feb 2022 16:23:14 +0000 (-0800) Subject: Fix a bug in device.py around the type of keywords, add logging and X-Git-Url: https://wannabe.guru.org/gitweb/?a=commitdiff_plain;h=94c8a54eadbf8552fa4d33dc349616d125e1a638;p=python_utils.git Fix a bug in device.py around the type of keywords, add logging and add manage_switch_off_timers to the deps run at each checkin. --- diff --git a/smart_home/device.py b/smart_home/device.py index 02717a3..06187d7 100644 --- a/smart_home/device.py +++ b/smart_home/device.py @@ -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 = [] diff --git a/smart_home/lights.py b/smart_home/lights.py index 80bfffa..ac1cc88 100644 --- a/smart_home/lights.py +++ b/smart_home/lights.py @@ -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) diff --git a/tests/run_some_dependencies_test.py b/tests/run_some_dependencies_test.py index 7e87d44..20f44cb 100755 --- a/tests/run_some_dependencies_test.py +++ b/tests/run_some_dependencies_test.py @@ -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: