mirror of
https://github.com/home-assistant/core.git
synced 2026-12-03 12:21:04 -04:00
Add exception translations to SwitchBot Cloud (#189023)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
97c4916bc9
commit
4fc35f9eda
@@ -86,4 +86,7 @@ class SwitchBotCoordinator(DataUpdateCoordinator[Status]):
|
||||
translation_key="invalid_auth",
|
||||
) from err
|
||||
except SwitchBotConnectionError as err:
|
||||
raise UpdateFailed(f"Error communicating with API: {err}") from err
|
||||
raise UpdateFailed(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="update_connection_error",
|
||||
) from err
|
||||
|
||||
@@ -39,7 +39,10 @@ async def handle_upload_image(call: ServiceCall) -> None:
|
||||
(iid[1] for iid in device.identifiers if iid[0] == DOMAIN), None
|
||||
)
|
||||
if device_mac is None:
|
||||
raise ServiceValidationError("No valid MAC address obtained.")
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="no_valid_mac_address",
|
||||
)
|
||||
|
||||
await config_entry.runtime_data.api.send_command(
|
||||
device_id=device_mac,
|
||||
|
||||
@@ -121,6 +121,12 @@
|
||||
},
|
||||
"invalid_auth": {
|
||||
"message": "Invalid authentication while connecting to the SwitchBot API"
|
||||
},
|
||||
"no_valid_mac_address": {
|
||||
"message": "No valid MAC address obtained."
|
||||
},
|
||||
"update_connection_error": {
|
||||
"message": "An error occurred while retrieving data from SwitchBot Cloud"
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
|
||||
Reference in New Issue
Block a user