From daf290d6e18b5589f93037da9e23edde348d6f2f Mon Sep 17 00:00:00 2001 From: Samuel Tandonnet <99485814+Tandonnet@users.noreply.github.com> Date: Sun, 11 Jun 2023 14:59:44 +0200 Subject: [PATCH] Fix coroutines error in Python 3.11 Since Home Assistant 2023.6 moved to Python 3.11, using coroutines is forbidden. This commit uses an explicit task to get rid of errors when using different services. This has been tested locally in Home Assistant 2023.6.1 and works flawlessly --- custom_components/miio_yeelink/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/miio_yeelink/__init__.py b/custom_components/miio_yeelink/__init__.py index 06b2050..0f56295 100644 --- a/custom_components/miio_yeelink/__init__.py +++ b/custom_components/miio_yeelink/__init__.py @@ -207,7 +207,7 @@ async def async_service_handler(service): _LOGGER.info('%s have no method: %s', dvc.entity_id, fun) continue await getattr(dvc, fun)(**params) - update_tasks.append(dvc.async_update_ha_state(True)) + update_tasks.append(asyncio.create_task(dvc.async_update_ha_state(True))) if update_tasks: await asyncio.wait(update_tasks)