Catch exception before retrying in AirGradient (#146460)

This commit is contained in:
Joost Lekkerkerker
2025-06-10 17:31:30 +02:00
committed by GitHub
parent 014010acbd
commit db8a6f8583
2 changed files with 25 additions and 3 deletions

View File

@@ -51,9 +51,16 @@ class AirGradientCoordinator(DataUpdateCoordinator[AirGradientData]):
async def _async_setup(self) -> None:
"""Set up the coordinator."""
self._current_version = (
await self.client.get_current_measures()
).firmware_version
try:
self._current_version = (
await self.client.get_current_measures()
).firmware_version
except AirGradientError as error:
raise UpdateFailed(
translation_domain=DOMAIN,
translation_key="update_error",
translation_placeholders={"error": str(error)},
) from error
async def _async_update_data(self) -> AirGradientData:
try: