Skip to content

Commit

Permalink
Add support of the device model zhimi.fan.sa1 (Closes: #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Aug 11, 2018
1 parent 3b41622 commit c2ecd51
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions custom_components/fan/xiaomi_miio_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@

MODEL_FAN_V2 = 'zhimi.fan.v2'
MODEL_FAN_V3 = 'zhimi.fan.v3'
MODEL_FAN_SA1 = 'zhimi.fan.sa1'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_TOKEN): vol.All(cv.string, vol.Length(min=32, max=32)),
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_MODEL): vol.In([MODEL_FAN_V2, MODEL_FAN_V3]),
vol.Optional(CONF_MODEL): vol.In([MODEL_FAN_V2, MODEL_FAN_V3, MODEL_FAN_SA1]),
})

REQUIREMENTS = ['python-miio>=0.4.0']
REQUIREMENTS = ['python-miio>=0.4.1']

ATTR_MODEL = 'model'
ATTR_BRIGHTNESS = 'brightness'
Expand Down Expand Up @@ -194,7 +195,7 @@ async def async_setup_platform(hass, config, async_add_devices,
except DeviceException:
raise PlatformNotReady

if model in [MODEL_FAN_V2, MODEL_FAN_V3]:
if model in [MODEL_FAN_V2, MODEL_FAN_V3, MODEL_FAN_SA1]:
from miio import Fan
fan = Fan(host, token, model=model)
device = XiaomiFan(name, fan, model, unique_id)
Expand Down

0 comments on commit c2ecd51

Please sign in to comment.