Add missing exception translation to Home Connect (#139218)

Add missing exception translation
This commit is contained in:
J. Diego Rodríguez Royo 2025-02-24 23:25:24 +01:00 committed by GitHub
parent b662d32e44
commit b86bb75e5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -213,7 +213,11 @@ async def _get_client_and_ha_id(
break
if entry is None:
raise ServiceValidationError(
"Home Connect config entry not found for that device id"
translation_domain=DOMAIN,
translation_key="config_entry_not_found",
translation_placeholders={
"device_id": device_id,
},
)
ha_id = next(

View File

@ -33,6 +33,9 @@
"appliance_not_found": {
"message": "Appliance for device ID {device_id} not found"
},
"config_entry_not_found": {
"message": "Config entry for device ID {device_id} not found"
},
"turn_on_light": {
"message": "Error turning on {entity_id}: {error}"
},

View File

@ -589,9 +589,7 @@ async def test_services_appliance_not_found(
)
service_call["service_data"]["device_id"] = device_entry.id
with pytest.raises(
ServiceValidationError, match=r"Home Connect config entry.*not found"
):
with pytest.raises(ServiceValidationError, match=r"Config entry.*not found"):
await hass.services.async_call(**service_call)
device_entry = device_registry.async_get_or_create(