mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-08 09:56:30 +00:00
Add async_setup
to DataUpdateCoordinator documentation (#2254)
This commit is contained in:
parent
6a1dc11bc6
commit
dc7ce94efe
@ -90,6 +90,18 @@ class MyCoordinator(DataUpdateCoordinator):
|
|||||||
always_update=True
|
always_update=True
|
||||||
)
|
)
|
||||||
self.my_api = my_api
|
self.my_api = my_api
|
||||||
|
self._device: MyDevice | None = None
|
||||||
|
|
||||||
|
async def _async_setup(self):
|
||||||
|
"""Set up the coordinator
|
||||||
|
|
||||||
|
This is the place to set up your coordinator,
|
||||||
|
or to load data, that only needs to be loaded once.
|
||||||
|
|
||||||
|
This method will be called automatically during
|
||||||
|
coordinator.async_config_entry_first_refresh.
|
||||||
|
"""
|
||||||
|
self._device = await self.my_api.get_device()
|
||||||
|
|
||||||
async def _async_update_data(self):
|
async def _async_update_data(self):
|
||||||
"""Fetch data from API endpoint.
|
"""Fetch data from API endpoint.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user