From f22c2c035c416f33ca3de8eb765dd4b42977e8cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Gyur=C3=A1cz?= <4431202+kristofgyuracz@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:40:46 +0100 Subject: [PATCH 1/3] Add Smart Humidifier 2 EU (`deerma.humidifier.jsq2w`) support (#352) --- README.md | 1 + custom_components/xiaomi_miio_airpurifier/fan.py | 3 +++ 2 files changed, 4 insertions(+) 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..552e71f 100644 --- a/custom_components/xiaomi_miio_airpurifier/fan.py +++ b/custom_components/xiaomi_miio_airpurifier/fan.py @@ -135,6 +135,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 +196,7 @@ MODEL_AIRHUMIDIFIER_MJJSQ, MODEL_AIRHUMIDIFIER_JSQ, MODEL_AIRHUMIDIFIER_JSQ1, + MODEL_AIRHUMIDIFIER_JSQ2W, MODEL_AIRHUMIDIFIER_JSQ3, MODEL_AIRHUMIDIFIER_JSQ5, MODEL_AIRHUMIDIFIER_JSQS, @@ -1148,6 +1150,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, From f44857a0f5a916529e603d4210596fcfb6d371b1 Mon Sep 17 00:00:00 2001 From: EtiolEhomba Date: Thu, 8 Aug 2024 09:20:07 +0300 Subject: [PATCH 2/3] Fix deprecated constants which will be removed in HA Core 2025.1 (#368) --- .../xiaomi_miio_airpurifier/fan.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/custom_components/xiaomi_miio_airpurifier/fan.py b/custom_components/xiaomi_miio_airpurifier/fan.py index 552e71f..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, @@ -1269,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): @@ -2399,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): @@ -2752,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.""" @@ -2885,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.""" From f92ffc66ab622492e5d401a444c4f7db7bdcdcc0 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Thu, 8 Aug 2024 08:27:32 +0200 Subject: [PATCH 3/3] Bump component version --- custom_components/xiaomi_miio_airpurifier/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" }