From e28965770eb69bc35519a27bb7632ecddb826484 Mon Sep 17 00:00:00 2001 From: Guido Schmitz Date: Fri, 20 Jun 2025 14:31:16 +0200 Subject: [PATCH] Add translations for devolo Home Control exceptions (#147099) * Add translations for devolo Home Control exceptions * Adapt invalid_auth message * Adapt connection_failed message --- .../components/devolo_home_control/__init__.py | 18 ++++++++++++++---- .../devolo_home_control/strings.json | 11 +++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/devolo_home_control/__init__.py b/homeassistant/components/devolo_home_control/__init__.py index 331bb5df94a..20a1edf734d 100644 --- a/homeassistant/components/devolo_home_control/__init__.py +++ b/homeassistant/components/devolo_home_control/__init__.py @@ -18,7 +18,7 @@ from homeassistant.core import Event, HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from homeassistant.helpers.device_registry import DeviceEntry -from .const import GATEWAY_SERIAL_PATTERN, PLATFORMS +from .const import DOMAIN, GATEWAY_SERIAL_PATTERN, PLATFORMS type DevoloHomeControlConfigEntry = ConfigEntry[list[HomeControl]] @@ -32,10 +32,16 @@ async def async_setup_entry( credentials_valid = await hass.async_add_executor_job(mydevolo.credentials_valid) if not credentials_valid: - raise ConfigEntryAuthFailed + raise ConfigEntryAuthFailed( + translation_domain=DOMAIN, + translation_key="invalid_auth", + ) if await hass.async_add_executor_job(mydevolo.maintenance): - raise ConfigEntryNotReady + raise ConfigEntryNotReady( + translation_domain=DOMAIN, + translation_key="maintenance", + ) gateway_ids = await hass.async_add_executor_job(mydevolo.get_gateway_ids) @@ -69,7 +75,11 @@ async def async_setup_entry( ) ) except GatewayOfflineError as err: - raise ConfigEntryNotReady from err + raise ConfigEntryNotReady( + translation_domain=DOMAIN, + translation_key="connection_failed", + translation_placeholders={"gateway_id": gateway_id}, + ) from err await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) diff --git a/homeassistant/components/devolo_home_control/strings.json b/homeassistant/components/devolo_home_control/strings.json index be853e2d89d..a5a8086ba47 100644 --- a/homeassistant/components/devolo_home_control/strings.json +++ b/homeassistant/components/devolo_home_control/strings.json @@ -45,5 +45,16 @@ "name": "Brightness" } } + }, + "exceptions": { + "connection_failed": { + "message": "Failed to connect to devolo Home Control central unit {gateway_id}." + }, + "invalid_auth": { + "message": "Authentication failed. Please re-authenticaticate with your mydevolo account." + }, + "maintenance": { + "message": "devolo Home Control is currently in maintenance mode." + } } }