mirror of
https://github.com/home-assistant/core
synced 2024-09-06 10:29:55 +02:00
Move scene and button restore to internal hook (#65696)
This commit is contained in:
parent
8021b05448
commit
2a8797ae3f
@ -113,8 +113,9 @@ class ButtonEntity(RestoreEntity):
|
||||
self.async_write_ha_state()
|
||||
await self.async_press()
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
async def async_internal_added_to_hass(self) -> None:
|
||||
"""Call when the button is added to hass."""
|
||||
await super().async_internal_added_to_hass()
|
||||
state = await self.async_get_last_state()
|
||||
if state is not None and state.state is not None:
|
||||
self.__last_pressed = dt_util.parse_datetime(state.state)
|
||||
|
@ -113,8 +113,9 @@ class Scene(RestoreEntity):
|
||||
self.async_write_ha_state()
|
||||
await self.async_activate(**kwargs)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Call when the button is added to hass."""
|
||||
async def async_internal_added_to_hass(self) -> None:
|
||||
"""Call when the scene is added to hass."""
|
||||
await super().async_internal_added_to_hass()
|
||||
state = await self.async_get_last_state()
|
||||
if state is not None and state.state is not None:
|
||||
self.__last_activated = state.state
|
||||
|
Loading…
Reference in New Issue
Block a user