From 6afd85c40de47a0383976a56ca634a1cfebdc199 Mon Sep 17 00:00:00 2001 From: sneakythrows Date: Mon, 12 Dec 2022 11:38:00 +0300 Subject: [PATCH 1/4] Add dmaker.fan.p18 support (#316) --- custom_components/xiaomi_miio_airpurifier/fan.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_miio_airpurifier/fan.py b/custom_components/xiaomi_miio_airpurifier/fan.py index 70d2861..b4052b0 100644 --- a/custom_components/xiaomi_miio_airpurifier/fan.py +++ b/custom_components/xiaomi_miio_airpurifier/fan.py @@ -156,6 +156,7 @@ MODEL_FAN_P9 = "dmaker.fan.p9" MODEL_FAN_P10 = "dmaker.fan.p10" MODEL_FAN_P11 = "dmaker.fan.p11" +MODEL_FAN_P18 = "dmaker.fan.p18" MODEL_FAN_LESHOW_SS4 = "leshow.fan.ss4" MODEL_FAN_1C = "dmaker.fan.1c" @@ -213,6 +214,7 @@ MODEL_FAN_P9, MODEL_FAN_P10, MODEL_FAN_P11, + MODEL_FAN_P18, MODEL_FAN_LESHOW_SS4, MODEL_FAN_1C, ] @@ -1177,7 +1179,10 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= elif model == MODEL_FAN_P5: fan = FanP5(host, token, model=model) device = XiaomiFanP5(name, fan, model, unique_id, retries) - elif model in [MODEL_FAN_P9, MODEL_FAN_P10, MODEL_FAN_P11]: + elif model in [MODEL_FAN_P10, MODEL_FAN_P18]: + fan = FanMiot(host, token, model=MODEL_FAN_P10) + device = XiaomiFanMiot(name, fan, model, unique_id, retries) + elif model in [MODEL_FAN_P9, MODEL_FAN_P11]: fan = FanMiot(host, token, model=model) device = XiaomiFanMiot(name, fan, model, unique_id, retries) elif model == MODEL_FAN_LESHOW_SS4: @@ -2721,7 +2726,7 @@ async def async_set_delay_off(self, delay_off_countdown: int) -> None: class XiaomiFanMiot(XiaomiFanP5): - """Representation of a Xiaomi Pedestal Fan P9, P10, P11.""" + """Representation of a Xiaomi Pedestal Fan P9, P10, P11, P18.""" class XiaomiFanLeshow(XiaomiGenericDevice): From aff15b811377cce89af059fb7d56f248cb0aad9a Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Sun, 26 Feb 2023 20:11:56 +0100 Subject: [PATCH 2/4] Sort manifest (#328) --- .../xiaomi_miio_airpurifier/manifest.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/xiaomi_miio_airpurifier/manifest.json b/custom_components/xiaomi_miio_airpurifier/manifest.json index 6f62b60..9de1408 100644 --- a/custom_components/xiaomi_miio_airpurifier/manifest.json +++ b/custom_components/xiaomi_miio_airpurifier/manifest.json @@ -1,17 +1,17 @@ { "domain": "xiaomi_miio_airpurifier", "name": "Xiaomi Mi Air Purifier, Air Humidifier, Air Fresh and Pedestal Fan Integration", - "version": "2022.12.0.0", - "iot_class": "local_polling", + "codeowners": [ + "@syssi" + ], "config_flow": false, + "dependencies": [], "documentation": "https://github.com/syssi/xiaomi_airpurifier", + "iot_class": "local_polling", "issue_tracker": "https://github.com/syssi/xiaomi_airpurifier/issues", "requirements": [ "construct==2.10.56", "python-miio>=0.5.12" ], - "dependencies": [], - "codeowners": [ - "@syssi" - ] + "version": "2022.12.0.0" } From 4d5e3ceb982aeb29862a042d88eb156a5b45c569 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Fri, 9 Jun 2023 18:45:24 +0200 Subject: [PATCH 3/4] Fix deprecated asyncio.wait use with coroutines --- custom_components/xiaomi_miio_airpurifier/climate.py | 2 +- custom_components/xiaomi_miio_airpurifier/fan.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_miio_airpurifier/climate.py b/custom_components/xiaomi_miio_airpurifier/climate.py index 7a5a45b..81742f1 100644 --- a/custom_components/xiaomi_miio_airpurifier/climate.py +++ b/custom_components/xiaomi_miio_airpurifier/climate.py @@ -195,7 +195,7 @@ async def async_service_handler(service): if not hasattr(device, method["method"]): continue await getattr(device, method["method"])(**params) - update_tasks.append(device.async_update_ha_state(True)) + update_tasks.append(asyncio.create_task(device.async_update_ha_state(True))) if update_tasks: await asyncio.wait(update_tasks) diff --git a/custom_components/xiaomi_miio_airpurifier/fan.py b/custom_components/xiaomi_miio_airpurifier/fan.py index b4052b0..1f1a53e 100644 --- a/custom_components/xiaomi_miio_airpurifier/fan.py +++ b/custom_components/xiaomi_miio_airpurifier/fan.py @@ -1231,7 +1231,7 @@ async def async_service_handler(service): if not hasattr(device, method["method"]): continue await getattr(device, method["method"])(**params) - update_tasks.append(device.async_update_ha_state(True)) + update_tasks.append(asyncio.create_task(device.async_update_ha_state(True))) if update_tasks: await asyncio.wait(update_tasks) From be14a8d36bc096c0fb8c50282e4a5ef0d47c9f05 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Fri, 9 Jun 2023 18:45:37 +0200 Subject: [PATCH 4/4] 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 9de1408..9e9ea8b 100644 --- a/custom_components/xiaomi_miio_airpurifier/manifest.json +++ b/custom_components/xiaomi_miio_airpurifier/manifest.json @@ -13,5 +13,5 @@ "construct==2.10.56", "python-miio>=0.5.12" ], - "version": "2022.12.0.0" + "version": "2023.6.0.0" }