mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Streamline Notion CoordinatorEntity (#43027)
This commit is contained in:
parent
244bfb2096
commit
49b4f9d2c6
@ -246,15 +246,13 @@ class NotionEntity(CoordinatorEntity):
|
|||||||
"""Update the entity from the latest data."""
|
"""Update the entity from the latest data."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
|
||||||
"""Register callbacks."""
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def update():
|
def _handle_coordinator_update(self):
|
||||||
"""Update the state."""
|
"""Respond to a DataUpdateCoordinator update."""
|
||||||
self._async_update_from_latest_data()
|
self._async_update_from_latest_data()
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
self.async_on_remove(self.coordinator.async_add_listener(update))
|
async def async_added_to_hass(self):
|
||||||
|
"""Handle entity which will be added."""
|
||||||
|
await super().async_added_to_hass()
|
||||||
self._async_update_from_latest_data()
|
self._async_update_from_latest_data()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user