diff --git a/homeassistant/components/devolo_home_network/__init__.py b/homeassistant/components/devolo_home_network/__init__.py index 137eee62b22..08d0e340b16 100644 --- a/homeassistant/components/devolo_home_network/__init__.py +++ b/homeassistant/components/devolo_home_network/__init__.py @@ -69,7 +69,10 @@ async def async_setup_entry( # noqa: C901 ) except DeviceNotFound as err: raise ConfigEntryNotReady( - f"Unable to connect to {entry.data[CONF_IP_ADDRESS]}" + f"Unable to connect to {entry.data[CONF_IP_ADDRESS]}", + translation_domain=DOMAIN, + translation_key="connection_failed", + translation_placeholders={"ip_address": entry.data[CONF_IP_ADDRESS]}, ) from err hass.data[DOMAIN][entry.entry_id] = {"device": device} @@ -101,7 +104,9 @@ async def async_setup_entry( # noqa: C901 except DeviceUnavailable as err: raise UpdateFailed(err) from err except DevicePasswordProtected as err: - raise ConfigEntryAuthFailed(err) from err + raise ConfigEntryAuthFailed( + err, translation_domain=DOMAIN, translation_key="password_wrong" + ) from err async def async_update_led_status() -> bool: """Fetch data from API endpoint.""" diff --git a/homeassistant/components/devolo_home_network/button.py b/homeassistant/components/devolo_home_network/button.py index e9210b7ccc1..13e688c6fc5 100644 --- a/homeassistant/components/devolo_home_network/button.py +++ b/homeassistant/components/devolo_home_network/button.py @@ -117,9 +117,15 @@ class DevoloButtonEntity(DevoloEntity, ButtonEntity): except DevicePasswordProtected as ex: self.entry.async_start_reauth(self.hass) raise HomeAssistantError( - f"Device {self.entry.title} require re-authenticatication to set or change the password" + f"Device {self.entry.title} require re-authenticatication to set or change the password", + translation_domain=DOMAIN, + translation_key="password_protected", + translation_placeholders={"title": self.entry.title}, ) from ex except DeviceUnavailable as ex: raise HomeAssistantError( - f"Device {self.entry.title} did not respond" + f"Device {self.entry.title} did not respond", + translation_domain=DOMAIN, + translation_key="no_response", + translation_placeholders={"title": self.entry.title}, ) from ex diff --git a/homeassistant/components/devolo_home_network/strings.json b/homeassistant/components/devolo_home_network/strings.json index 1362417c125..9d86b127d77 100644 --- a/homeassistant/components/devolo_home_network/strings.json +++ b/homeassistant/components/devolo_home_network/strings.json @@ -78,5 +78,19 @@ "name": "Enable LEDs" } } + }, + "exceptions": { + "connection_failed": { + "message": "Unable to connect to {ip_address}" + }, + "no_response": { + "message": "Device {title} did not respond" + }, + "password_protected": { + "message": "Device {title} requires re-authenticatication to set or change the password" + }, + "password_wrong": { + "message": "The used password is wrong" + } } } diff --git a/homeassistant/components/devolo_home_network/switch.py b/homeassistant/components/devolo_home_network/switch.py index ffb6ae8098a..950b362d7f5 100644 --- a/homeassistant/components/devolo_home_network/switch.py +++ b/homeassistant/components/devolo_home_network/switch.py @@ -109,7 +109,10 @@ class DevoloSwitchEntity(DevoloCoordinatorEntity[_DataT], SwitchEntity): except DevicePasswordProtected as ex: self.entry.async_start_reauth(self.hass) raise HomeAssistantError( - f"Device {self.entry.title} require re-authenticatication to set or change the password" + f"Device {self.entry.title} require re-authenticatication to set or change the password", + translation_domain=DOMAIN, + translation_key="password_protected", + translation_placeholders={"title": self.entry.title}, ) from ex except DeviceUnavailable: pass # The coordinator will handle this @@ -122,7 +125,10 @@ class DevoloSwitchEntity(DevoloCoordinatorEntity[_DataT], SwitchEntity): except DevicePasswordProtected as ex: self.entry.async_start_reauth(self.hass) raise HomeAssistantError( - f"Device {self.entry.title} require re-authenticatication to set or change the password" + f"Device {self.entry.title} require re-authenticatication to set or change the password", + translation_domain=DOMAIN, + translation_key="password_protected", + translation_placeholders={"title": self.entry.title}, ) from ex except DeviceUnavailable: pass # The coordinator will handle this diff --git a/homeassistant/components/devolo_home_network/update.py b/homeassistant/components/devolo_home_network/update.py index f94cf13ef5c..0793254c761 100644 --- a/homeassistant/components/devolo_home_network/update.py +++ b/homeassistant/components/devolo_home_network/update.py @@ -117,9 +117,15 @@ class DevoloUpdateEntity(DevoloCoordinatorEntity, UpdateEntity): except DevicePasswordProtected as ex: self.entry.async_start_reauth(self.hass) raise HomeAssistantError( - f"Device {self.entry.title} require re-authentication to set or change the password" + f"Device {self.entry.title} require re-authenticatication to set or change the password", + translation_domain=DOMAIN, + translation_key="password_protected", + translation_placeholders={"title": self.entry.title}, ) from ex except DeviceUnavailable as ex: raise HomeAssistantError( - f"Device {self.entry.title} did not respond" + f"Device {self.entry.title} did not respond", + translation_domain=DOMAIN, + translation_key="no_response", + translation_placeholders={"title": self.entry.title}, ) from ex