Use hass.loop.create_future() in zha (#100056)

* Use hass.loop.create_future() in zha

* Remove not needed method
pull/100283/head
Jan Bouwhuis 2023-09-13 13:32:00 +02:00 committed by GitHub
parent 958b923783
commit 9f3b1a8d44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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}",