Skip to content

Commit

Permalink
Default model added
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Mar 24, 2018
1 parent 2731632 commit 702ef37
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions miio/chuangmi_plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
MODEL_CHUANGMI_PLUG_V3 = 'chuangmi.plug.v3'
MODEL_CHUANGMI_PLUG_V1 = 'chuangmi.plug.v1'
MODEL_CHUANGMI_PLUG_M1 = 'chuangmi.plug.m1'
MODEL_CHUANGMI_PLUG_V2 = 'chuangmi.plug.v2'

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_M1: ['power', 'temperature'],
MODEL_CHUANGMI_PLUG_V2: ['power', 'temperature'],
}


Expand Down Expand Up @@ -91,7 +93,10 @@ def __init__(self, ip: str = None, token: str = None, start_id: int = 0,
model: str = MODEL_CHUANGMI_PLUG_M1) -> None:
super().__init__(ip, token, start_id, debug, lazy_discover)

self.model = model
if model in AVAILABLE_PROPERTIES:
self.model = model
else:
self.model = MODEL_CHUANGMI_PLUG_M1

def status(self) -> ChuangmiPlugStatus:
"""Retrieve properties."""
Expand Down

0 comments on commit 702ef37

Please sign in to comment.