Skip to content

Commit

Permalink
Add support for next generation of the Xiaomi Mi Smart Plug (chuangmi…
Browse files Browse the repository at this point in the history
….plug.hmi205) (Closes: #427) (#428)
  • Loading branch information
syssi authored Dec 8, 2018
1 parent 54befef commit 17d2420
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion miio/chuangmi_plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
MODEL_CHUANGMI_PLUG_V1 = 'chuangmi.plug.v1'
MODEL_CHUANGMI_PLUG_M1 = 'chuangmi.plug.m1'
MODEL_CHUANGMI_PLUG_V2 = 'chuangmi.plug.v2'
MODEL_CHUANGMI_PLUG_HMI205 = 'chuangmi.plug.hmi205'

AVAILABLE_PROPERTIES = {
MODEL_CHUANGMI_PLUG_V1: ['on', 'usb_on', 'temperature'],
MODEL_CHUANGMI_PLUG_V3: ['on', 'usb_on', 'temperature', 'wifi_led'],
MODEL_CHUANGMI_PLUG_M1: ['power', 'temperature'],
MODEL_CHUANGMI_PLUG_V2: ['power', 'temperature'],
MODEL_CHUANGMI_PLUG_HMI205: ['power', 'temperature'],
}


Expand Down Expand Up @@ -93,7 +95,7 @@ def __json__(self):


class ChuangmiPlug(Device):
"""Main class representing the Chuangmi Plug V1 and V3."""
"""Main class representing the Chuangmi Plug."""

def __init__(self, ip: str = None, token: str = None, start_id: int = 0,
debug: int = 0, lazy_discover: bool = True,
Expand Down
3 changes: 2 additions & 1 deletion miio/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .airconditioningcompanion import (MODEL_ACPARTNER_V1, MODEL_ACPARTNER_V2, MODEL_ACPARTNER_V3, )
from .airhumidifier import (MODEL_HUMIDIFIER_CA1, MODEL_HUMIDIFIER_V1, )
from .chuangmi_plug import (MODEL_CHUANGMI_PLUG_V1, MODEL_CHUANGMI_PLUG_V3,
MODEL_CHUANGMI_PLUG_M1, )
MODEL_CHUANGMI_PLUG_M1, MODEL_CHUANGMI_PLUG_HMI205, )
from .fan import (MODEL_FAN_V2, MODEL_FAN_V3, MODEL_FAN_SA1, MODEL_FAN_ZA1, )
from .powerstrip import (MODEL_POWER_STRIP_V1, MODEL_POWER_STRIP_V2, )

Expand All @@ -30,6 +30,7 @@
"chuangmi-plug-v1": partial(ChuangmiPlug, model=MODEL_CHUANGMI_PLUG_V1),
"chuangmi-plug_": partial(ChuangmiPlug, model=MODEL_CHUANGMI_PLUG_V1),
"chuangmi-plug-v3": partial(ChuangmiPlug, model=MODEL_CHUANGMI_PLUG_V3),
"chuangmi-plug-hmi205": partial(ChuangmiPlug, model=MODEL_CHUANGMI_PLUG_HMI205),
"qmi-powerstrip-v1": partial(PowerStrip, model=MODEL_POWER_STRIP_V1),
"zimi-powerstrip-v2": partial(PowerStrip, model=MODEL_POWER_STRIP_V2),
"zhimi-airpurifier-m1": AirPurifier, # mini model
Expand Down

0 comments on commit 17d2420

Please sign in to comment.