Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions custom_components/panasonic_cc/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ def is_persistent(self) -> bool:
message="The Panasonic server timed out waiting for a response from an upstream service.",
suggestion="This is a temporary issue. It should resolve automatically.",
),
5300: FriendlyError(
category=ErrorCategory.SERVER_ERROR,
title="Service Under Maintenance",
message="The Panasonic service is temporarily unavailable due to scheduled maintenance.",
suggestion="This should resolve automatically once maintenance is complete.",
),
}

# Regex patterns for error message matching (fallback when no code is found)
Expand Down
30 changes: 28 additions & 2 deletions custom_components/panasonic_cc/panasonic/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,21 @@ async def _async_update_data(self) -> int:
)
_create_auth_expired_notification(self.hass)
raise UpdateFailed("Authentication failed — coordinator disabled") from err
self._handle_failure(err)
friendly = classify_error(err)
if (
friendly.category in (ErrorCategory.RATE_LIMIT, ErrorCategory.SERVER_ERROR)
and self._device is not None
):
self._handle_failure(err)
_LOGGER.warning(
"%s Transient error %s: %s — keeping last device data and retrying after backoff.",
self._device_info.name,
friendly.title,
friendly.message,
)
self.async_update_listeners()
return self._update_id
self._handle_failure(err)
raise UpdateFailed(f"{friendly.title}: {friendly.message}") from err
return self._update_id

Expand Down Expand Up @@ -359,8 +372,21 @@ async def _async_update_data(self) -> int:
)
_create_auth_expired_notification(self.hass)
raise UpdateFailed("Authentication failed — coordinator disabled") from err
self._handle_failure(err)
friendly = classify_error(err)
if (
friendly.category in (ErrorCategory.RATE_LIMIT, ErrorCategory.SERVER_ERROR)
and self._energy is not None
):
self._handle_failure(err)
_LOGGER.warning(
"%s Transient error %s: %s — keeping last energy data and retrying after backoff.",
self._device_info.name,
friendly.title,
friendly.message,
)
self.async_update_listeners()
return self._update_id
self._handle_failure(err)
raise UpdateFailed(f"{friendly.title}: {friendly.message}") from err
return self._update_id

Expand Down