Hello! I’m trying to implement some integration for my covers. I’m using DataUpdateCoordinator
, because with one call to API, I can obtain states for all my covers. But in some cases, I need to call another API method (sometimes my covers can ignore the first request and forget to close, for example, so I have to send close request again). Unfortunately I cannot call async method (fetch
) which is provided by API from sync method (_handle_coordinator_update
) which is called by CoordinatorEntity
after fetching current state for cover.
BTW, is it fine to call time-consuming request to external and probably slow server in _handle_coordinator_update
? I know that for example, calling time-consuming method from current_cover_position
is not good idea. I’m wondering _handle_coordinator_update
is also not good place for that methods.
class HelloBlind(CoordinatorEntity, CoverEntity):
# Some code...
@callback
def _handle_coordinator_update(self) -> None:
# Trying to call: self._do_something_specific()
return super()._handle_coordinator_update()
async def _do_something_specific(self) -> None:
await self._api.fetch('XXX')