From 9f3b1a8d44cd3ea2a5f928e199ae842e6b25b4fd Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Wed, 13 Sep 2023 13:32:00 +0200 Subject: [PATCH] Use hass.loop.create_future() in zha (#100056) * Use hass.loop.create_future() in zha * Remove not needed method --- homeassistant/components/zha/entity.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/zha/entity.py b/homeassistant/components/zha/entity.py index 5722d91116a..da34b829907 100644 --- a/homeassistant/components/zha/entity.py +++ b/homeassistant/components/zha/entity.py @@ -59,7 +59,6 @@ class BaseZhaEntity(LogMixin, entity.Entity): self._extra_state_attributes: dict[str, Any] = {} self._zha_device = zha_device self._unsubs: list[Callable[[], None]] = [] - self.remove_future: asyncio.Future[Any] = asyncio.Future() @property def unique_id(self) -> str: @@ -143,6 +142,8 @@ class BaseZhaEntity(LogMixin, entity.Entity): class ZhaEntity(BaseZhaEntity, RestoreEntity): """A base class for non group ZHA entities.""" + remove_future: asyncio.Future[Any] + def __init_subclass__(cls, id_suffix: str | None = None, **kwargs: Any) -> None: """Initialize subclass. @@ -188,7 +189,7 @@ class ZhaEntity(BaseZhaEntity, RestoreEntity): async def async_added_to_hass(self) -> None: """Run when about to be added to hass.""" - self.remove_future = asyncio.Future() + self.remove_future = self.hass.loop.create_future() self.async_accept_signal( None, f"{SIGNAL_REMOVE}_{self.zha_device.ieee}",