From 2fb4d8b185a154ba96a5553b98dde10c30163ebe Mon Sep 17 00:00:00 2001 From: Daniel Apatin Date: Sat, 11 Apr 2020 19:34:49 +0300 Subject: [PATCH 1/4] fixed power state status for updated firmware --- miio/chuangmi_plug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miio/chuangmi_plug.py b/miio/chuangmi_plug.py index 008e80ba1..f19b44385 100644 --- a/miio/chuangmi_plug.py +++ b/miio/chuangmi_plug.py @@ -46,7 +46,7 @@ def __init__(self, data: Dict[str, Any]) -> None: def power(self) -> bool: """Current power state.""" if "on" in self.data: - return self.data["on"] + return self.data["on"]==True or self.data["on"]=="on" if "power" in self.data: return self.data["power"] == "on" From 4cfe15928b5746656a57d972d45059ef8cc4a604 Mon Sep 17 00:00:00 2001 From: Daniel Apatin Date: Sun, 12 Apr 2020 10:42:06 +0300 Subject: [PATCH 2/4] add spaces for linter --- miio/chuangmi_plug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miio/chuangmi_plug.py b/miio/chuangmi_plug.py index f19b44385..434f4b37e 100644 --- a/miio/chuangmi_plug.py +++ b/miio/chuangmi_plug.py @@ -46,7 +46,7 @@ def __init__(self, data: Dict[str, Any]) -> None: def power(self) -> bool: """Current power state.""" if "on" in self.data: - return self.data["on"]==True or self.data["on"]=="on" + return self.data["on"] == True or self.data["on"] == "on" if "power" in self.data: return self.data["power"] == "on" From 4a10564550e2e8baa143c931f765ba9b62ec4a15 Mon Sep 17 00:00:00 2001 From: Daniel Apatin Date: Sun, 12 Apr 2020 10:46:28 +0300 Subject: [PATCH 3/4] comparison to True --- miio/chuangmi_plug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miio/chuangmi_plug.py b/miio/chuangmi_plug.py index 434f4b37e..451445888 100644 --- a/miio/chuangmi_plug.py +++ b/miio/chuangmi_plug.py @@ -46,7 +46,7 @@ def __init__(self, data: Dict[str, Any]) -> None: def power(self) -> bool: """Current power state.""" if "on" in self.data: - return self.data["on"] == True or self.data["on"] == "on" + return self.data["on"] or self.data["on"] == "on" if "power" in self.data: return self.data["power"] == "on" From 05a18f42ddb9a1fe6d3937f2281a9901ba6e3ee9 Mon Sep 17 00:00:00 2001 From: Daniel Apatin Date: Mon, 13 Apr 2020 16:13:54 +0300 Subject: [PATCH 4/4] Update miio/chuangmi_plug.py Co-Authored-By: Teemu R. --- miio/chuangmi_plug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miio/chuangmi_plug.py b/miio/chuangmi_plug.py index 451445888..ddb0ae717 100644 --- a/miio/chuangmi_plug.py +++ b/miio/chuangmi_plug.py @@ -46,7 +46,7 @@ def __init__(self, data: Dict[str, Any]) -> None: def power(self) -> bool: """Current power state.""" if "on" in self.data: - return self.data["on"] or self.data["on"] == "on" + return self.data["on"] is True or self.data["on"] == "on" if "power" in self.data: return self.data["power"] == "on"