diff --git a/README.md b/README.md index 632f183..1478efe 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ This custom component is more or less the beta version of the [official componen | Smartmi Evaporative Humidifier (Korea Version) | zhimi.humidifier.cb2 | CJXJSQ02ZM | 8W, 240x240x363mm | | Mijia Smart Sterilization Humidifier S | deerma.humidifier.mjjsq | MJJSQ03DY | 4.5L, <=39dB, 450mL/h, 40W | | Mijia Intelligent Sterilization Humidifier (EU version?) | deerma.humidifier.jsq | ZNJSQ01DEM | 4.5L, <=38dB, 300mL/h, 24W | +| Mijia Smart Humidifier 2 (EU version) | deerma.humidifier.jsq2w | MJJSQ05DY | 4.5L, <=32dB, 300mL/h, 28 W | | Mijia Humidifier 4L | deerma.humidifier.jsq3 | MJJSQ04DY | 4L, <=38dB, 300mL/h, 25W | | Mijia Intelligent Sterilization Humidifier (EU version?) | deerma.humidifier.jsq5 | ZNJSQ01DEM | 4.5L, <=38dB, 300mL/h, 24W | | Mijia Smart Sterilization Humidifier S (EU version?) | deerma.humidifier.jsqs | MJJSQ03DY | 4.5L, <=39dB, 450mL/h, 40W | diff --git a/custom_components/xiaomi_miio_airpurifier/fan.py b/custom_components/xiaomi_miio_airpurifier/fan.py index 1f1a53e..de83c89 100644 --- a/custom_components/xiaomi_miio_airpurifier/fan.py +++ b/custom_components/xiaomi_miio_airpurifier/fan.py @@ -76,11 +76,8 @@ from homeassistant.components.fan import ( PLATFORM_SCHEMA, - SUPPORT_DIRECTION, - SUPPORT_OSCILLATE, - SUPPORT_PRESET_MODE, - SUPPORT_SET_SPEED, FanEntity, + FanEntityFeature ) from homeassistant.const import ( ATTR_ENTITY_ID, @@ -135,6 +132,7 @@ MODEL_AIRHUMIDIFIER_MJJSQ = "deerma.humidifier.mjjsq" MODEL_AIRHUMIDIFIER_JSQ = "deerma.humidifier.jsq" MODEL_AIRHUMIDIFIER_JSQ1 = "deerma.humidifier.jsq1" +MODEL_AIRHUMIDIFIER_JSQ2W = "deerma.humidifier.jsq2w" MODEL_AIRHUMIDIFIER_JSQ3 = "deerma.humidifier.jsq3" MODEL_AIRHUMIDIFIER_JSQ5 = "deerma.humidifier.jsq5" MODEL_AIRHUMIDIFIER_JSQS = "deerma.humidifier.jsqs" @@ -195,6 +193,7 @@ MODEL_AIRHUMIDIFIER_MJJSQ, MODEL_AIRHUMIDIFIER_JSQ, MODEL_AIRHUMIDIFIER_JSQ1, + MODEL_AIRHUMIDIFIER_JSQ2W, MODEL_AIRHUMIDIFIER_JSQ3, MODEL_AIRHUMIDIFIER_JSQ5, MODEL_AIRHUMIDIFIER_JSQS, @@ -1148,6 +1147,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= air_humidifier = AirHumidifierMjjsq(host, token, model=model) device = XiaomiAirHumidifierMjjsq(name, air_humidifier, model, unique_id) elif model in [ + MODEL_AIRHUMIDIFIER_JSQ2W, MODEL_AIRHUMIDIFIER_JSQ3, MODEL_AIRHUMIDIFIER_JSQ5, MODEL_AIRHUMIDIFIER_JSQS, @@ -1266,7 +1266,7 @@ def __init__(self, name, device, model, unique_id, retries=0): @property def supported_features(self): """Flag supported features.""" - return SUPPORT_PRESET_MODE + return FanEntityFeature.PRESET_MODE @property def should_poll(self): @@ -2396,10 +2396,10 @@ def __init__(self, name, device, model, unique_id, retries): def supported_features(self) -> int: """Supported features.""" return ( - SUPPORT_SET_SPEED - | SUPPORT_PRESET_MODE - | SUPPORT_OSCILLATE - | SUPPORT_DIRECTION + FanEntityFeature.SET_SPEED + | FanEntityFeature.PRESET_MODE + | FanEntityFeature.OSCILLATE + | FanEntityFeature.DIRECTION ) async def async_update(self): @@ -2749,7 +2749,7 @@ def __init__(self, name, device, model, unique_id, retries): @property def supported_features(self) -> int: """Supported features.""" - return SUPPORT_SET_SPEED | SUPPORT_PRESET_MODE | SUPPORT_OSCILLATE + return FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE | FanEntityFeature.OSCILLATE async def async_update(self): """Fetch state from the device.""" @@ -2882,7 +2882,7 @@ def __init__(self, name, device, model, unique_id, retries): @property def supported_features(self) -> int: """Supported features.""" - return SUPPORT_SET_SPEED | SUPPORT_PRESET_MODE | SUPPORT_OSCILLATE + return FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE | FanEntityFeature.OSCILLATE async def async_update(self): """Fetch state from the device.""" diff --git a/custom_components/xiaomi_miio_airpurifier/manifest.json b/custom_components/xiaomi_miio_airpurifier/manifest.json index b2a03af..55a8a14 100644 --- a/custom_components/xiaomi_miio_airpurifier/manifest.json +++ b/custom_components/xiaomi_miio_airpurifier/manifest.json @@ -13,5 +13,5 @@ "construct==2.10.68", "python-miio>=0.5.12" ], - "version": "2023.12.0.0" + "version": "2024.7.0.0" }