From 193e27f3882256cc35f5428470992a4acc743980 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Wed, 1 Nov 2017 18:24:10 +0100 Subject: [PATCH] Property "temperature" added. (#109) Discovery of the Chuang Mi Plug V1 fixed. Closes #108. --- miio/discovery.py | 1 + miio/plug_v1.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/miio/discovery.py b/miio/discovery.py index eb23cea50..3fd7ed43c 100644 --- a/miio/discovery.py +++ b/miio/discovery.py @@ -17,6 +17,7 @@ "chuangmi-plug-m1": Plug, "chuangmi-plug-v2": Plug, "chuangmi-plug-v1": PlugV1, + "chuangmi-plug_": PlugV1, "qmi-powerstrip-v1": PowerStrip, "zimi-powerstrip-v2": PowerStrip, "zhimi-airpurifier-m1": AirPurifier, diff --git a/miio/plug_v1.py b/miio/plug_v1.py index c3ead53ad..c81620a6c 100644 --- a/miio/plug_v1.py +++ b/miio/plug_v1.py @@ -24,10 +24,15 @@ def is_on(self) -> bool: def usb_power(self) -> bool: return self.data["usb_on"] + @property + def temperature(self) -> float: + return self.data["temperature"] + def __str__(self) -> str: - s = "" % \ + s = "" % \ (self.power, - self.usb_power) + self.usb_power, + self.temperature) return s @@ -36,7 +41,7 @@ class PlugV1(Device): def status(self) -> PlugV1Status: """Retrieve properties.""" - properties = ['on', 'usb_on'] + properties = ['on', 'usb_on', 'temperature'] values = self.send( "get_prop", properties