From dc7ce94efe984b62cd200bc94aaf2da9f9f026fb Mon Sep 17 00:00:00 2001 From: Josef Zweck <24647999+zweckj@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:36:41 +0200 Subject: [PATCH] Add `async_setup` to DataUpdateCoordinator documentation (#2254) --- docs/integration_fetching_data.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/integration_fetching_data.md b/docs/integration_fetching_data.md index fa7b205c..d47f0d81 100644 --- a/docs/integration_fetching_data.md +++ b/docs/integration_fetching_data.md @@ -90,6 +90,18 @@ class MyCoordinator(DataUpdateCoordinator): always_update=True ) 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): """Fetch data from API endpoint.