1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Improve singleton helper typing (#75461)

* Improve singleton helper typing

* Fix type errors
This commit is contained in:
Marc Mueller
2022-07-21 00:19:02 +02:00
committed by GitHub
parent 6da25c733e
commit ac858cc2b5
4 changed files with 12 additions and 10 deletions

View File

@@ -305,9 +305,7 @@ class RestoreEntity(Entity):
# Return None if this entity isn't added to hass yet
_LOGGER.warning("Cannot get last state. Entity not added to hass") # type: ignore[unreachable]
return None
data = cast(
RestoreStateData, await RestoreStateData.async_get_instance(self.hass)
)
data = await RestoreStateData.async_get_instance(self.hass)
if self.entity_id not in data.last_states:
return None
return data.last_states[self.entity_id]