From 8d5d5c815aea43a7b8f46086ccc67ff4faf671aa Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 14 Feb 2023 08:32:24 -0600 Subject: [PATCH] Fix group integration with py3.11 In py3.11 `Passing coroutines is forbidden, use tasks explicitly` --- homeassistant/components/group/notify.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/group/notify.py b/homeassistant/components/group/notify.py index 7c4bc0c65c47fa..7e8ce9236493a7 100644 --- a/homeassistant/components/group/notify.py +++ b/homeassistant/components/group/notify.py @@ -2,7 +2,7 @@ from __future__ import annotations import asyncio -from collections.abc import Coroutine, Mapping +from collections.abc import Mapping from copy import deepcopy from typing import Any @@ -68,14 +68,16 @@ async def async_send_message(self, message: str = "", **kwargs: Any) -> None: payload: dict[str, Any] = {ATTR_MESSAGE: message} payload.update({key: val for key, val in kwargs.items() if val}) - tasks: list[Coroutine[Any, Any, bool | None]] = [] + tasks: list[asyncio.Task[bool | None]] = [] for entity in self.entities: sending_payload = deepcopy(payload.copy()) if (data := entity.get(ATTR_DATA)) is not None: update(sending_payload, data) tasks.append( - self.hass.services.async_call( - DOMAIN, entity[ATTR_SERVICE], sending_payload + asyncio.create_task( + self.hass.services.async_call( + DOMAIN, entity[ATTR_SERVICE], sending_payload + ) ) )