From c2ecd514c66a125e16326e127d3cf5d9e3e738ff Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Sat, 11 Aug 2018 20:34:27 +0200 Subject: [PATCH] Add support of the device model zhimi.fan.sa1 (Closes: #15) --- custom_components/fan/xiaomi_miio_fan.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/fan/xiaomi_miio_fan.py b/custom_components/fan/xiaomi_miio_fan.py index 3a5e3cd..c359de9 100644 --- a/custom_components/fan/xiaomi_miio_fan.py +++ b/custom_components/fan/xiaomi_miio_fan.py @@ -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' @@ -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)