diff --git a/homeassistant/components/starlink/coordinator.py b/homeassistant/components/starlink/coordinator.py index ff33b3ecc41..7a09b2f2dee 100644 --- a/homeassistant/components/starlink/coordinator.py +++ b/homeassistant/components/starlink/coordinator.py @@ -55,21 +55,21 @@ class StarlinkUpdateCoordinator(DataUpdateCoordinator[StarlinkData]): update_interval=timedelta(seconds=5), ) + def _get_starlink_data(self) -> StarlinkData: + """Retrieve Starlink data.""" + channel_context = self.channel_context + status = status_data(channel_context) + location = location_data(channel_context) + sleep = get_sleep_config(channel_context) + return StarlinkData(location, sleep, *status) + async def _async_update_data(self) -> StarlinkData: async with asyncio.timeout(4): try: - status = await self.hass.async_add_executor_job( - status_data, self.channel_context - ) - location = await self.hass.async_add_executor_job( - location_data, self.channel_context - ) - sleep = await self.hass.async_add_executor_job( - get_sleep_config, self.channel_context - ) - return StarlinkData(location, sleep, *status) + result = await self.hass.async_add_executor_job(self._get_starlink_data) except GrpcError as exc: raise UpdateFailed from exc + return result async def async_stow_starlink(self, stow: bool) -> None: """Set whether Starlink system tied to this coordinator should be stowed."""