mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add translations for devolo Home Control exceptions (#147099)
* Add translations for devolo Home Control exceptions * Adapt invalid_auth message * Adapt connection_failed message
This commit is contained in:
parent
f9d4bde0f6
commit
e28965770e
@ -18,7 +18,7 @@ from homeassistant.core import Event, HomeAssistant
|
|||||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||||
from homeassistant.helpers.device_registry import DeviceEntry
|
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]]
|
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)
|
credentials_valid = await hass.async_add_executor_job(mydevolo.credentials_valid)
|
||||||
|
|
||||||
if not 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):
|
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)
|
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:
|
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)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
|
@ -45,5 +45,16 @@
|
|||||||
"name": "Brightness"
|
"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."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user