From 390b62551d7749100b4f0f35dbe50c2ae412288c Mon Sep 17 00:00:00 2001 From: Klaas Schoute Date: Wed, 25 Feb 2026 20:28:56 +0100 Subject: [PATCH] Add PowerfoxPrivacyError handling for Powerfox integration (#164100) --- .../components/powerfox/coordinator.py | 19 ++++++++++++++++--- .../components/powerfox/strings.json | 8 ++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/powerfox/coordinator.py b/homeassistant/components/powerfox/coordinator.py index 0f00d94bdf03..318f643b73a6 100644 --- a/homeassistant/components/powerfox/coordinator.py +++ b/homeassistant/components/powerfox/coordinator.py @@ -11,6 +11,7 @@ from powerfox import ( PowerfoxAuthenticationError, PowerfoxConnectionError, PowerfoxNoDataError, + PowerfoxPrivacyError, Poweropti, ) @@ -56,9 +57,21 @@ class PowerfoxBaseCoordinator[T](DataUpdateCoordinator[T]): try: return await self._async_fetch_data() except PowerfoxAuthenticationError as err: - raise ConfigEntryAuthFailed(err) from err - except (PowerfoxConnectionError, PowerfoxNoDataError) as err: - raise UpdateFailed(err) from err + raise ConfigEntryAuthFailed( + translation_domain=DOMAIN, + translation_key="invalid_auth", + translation_placeholders={"error": str(err)}, + ) from err + except ( + PowerfoxConnectionError, + PowerfoxNoDataError, + PowerfoxPrivacyError, + ) as err: + raise UpdateFailed( + translation_domain=DOMAIN, + translation_key="update_failed", + translation_placeholders={"error": str(err)}, + ) from err async def _async_fetch_data(self) -> T: """Fetch data from the Powerfox API.""" diff --git a/homeassistant/components/powerfox/strings.json b/homeassistant/components/powerfox/strings.json index 4d98efa8d159..be8169def68c 100644 --- a/homeassistant/components/powerfox/strings.json +++ b/homeassistant/components/powerfox/strings.json @@ -114,5 +114,13 @@ "name": "Warm water" } } + }, + "exceptions": { + "invalid_auth": { + "message": "Error while authenticating with the Powerfox service: {error}" + }, + "update_failed": { + "message": "Error while updating the Powerfox service: {error}" + } } }