Skip to content

Commit

Permalink
Property "temperature" added. (#109)
Browse files Browse the repository at this point in the history
Discovery of the Chuang Mi Plug V1 fixed. Closes #108.
  • Loading branch information
syssi authored and rytilahti committed Nov 1, 2017
1 parent ab85f0c commit 193e27f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions miio/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 8 additions & 3 deletions miio/plug_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<PlugV1Status power=%s, usb_power=%s>" % \
s = "<PlugV1Status power=%s, usb_power=%s, temperature=%s>" % \
(self.power,
self.usb_power)
self.usb_power,
self.temperature)
return s


Expand All @@ -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
Expand Down

0 comments on commit 193e27f

Please sign in to comment.