summaryrefslogtreecommitdiff
path: root/smart_home/lights.py
diff options
context:
space:
mode:
authorScott <[email protected]>2022-01-18 13:41:12 -0800
committerScott <[email protected]>2022-01-18 13:41:12 -0800
commit07a9659282a6b7c7776eec85f0708de9f8815374 (patch)
tree40a23069fa1a42efda30362a1254808872f83ff5 /smart_home/lights.py
parent87f478b20c8b24eed6c1e87de47ba01e3d9746ab (diff)
Fix state determination in tplink kasa lights.
Diffstat (limited to 'smart_home/lights.py')
-rw-r--r--smart_home/lights.py3
1 files changed, 2 insertions, 1 deletions
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: