From 07a9659282a6b7c7776eec85f0708de9f8815374 Mon Sep 17 00:00:00 2001 From: Scott Date: Tue, 18 Jan 2022 13:41:12 -0800 Subject: [PATCH] Fix state determination in tplink kasa lights. --- smart_home/lights.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smart_home/lights.py b/smart_home/lights.py index 237d4e0..64f2105 100644 --- a/smart_home/lights.py +++ b/smart_home/lights.py @@ -323,7 +323,7 @@ class TPLinkLight(BaseLight): self.info = self.get_info() if self.info is None: raise Exception('Unable to get info?') - return self.info.get("relay_state", "0") == "1" + return self.info.get("relay_state", 0) == 1 @overrides def is_off(self) -> bool: @@ -344,6 +344,7 @@ class TPLinkLight(BaseLight): out = re.sub("Received: *", "", out) try: self.info = json.loads(out)["system"]["get_sysinfo"] + logger.debug(json.dumps(self.info, indent=4, sort_keys=True)) self.info_ts = datetime.datetime.now() return self.info except Exception as e: -- 2.45.2