From b86bb75e5ec605f07b474506ce86769979ac85ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Diego=20Rodr=C3=ADguez=20Royo?= Date: Mon, 24 Feb 2025 23:25:24 +0100 Subject: [PATCH] Add missing exception translation to Home Connect (#139218) Add missing exception translation --- homeassistant/components/home_connect/__init__.py | 6 +++++- homeassistant/components/home_connect/strings.json | 3 +++ tests/components/home_connect/test_init.py | 4 +--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/home_connect/__init__.py b/homeassistant/components/home_connect/__init__.py index 51b38bf7cd3..405606c6159 100644 --- a/homeassistant/components/home_connect/__init__.py +++ b/homeassistant/components/home_connect/__init__.py @@ -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( diff --git a/homeassistant/components/home_connect/strings.json b/homeassistant/components/home_connect/strings.json index 977ad1f36f0..5072bb616dd 100644 --- a/homeassistant/components/home_connect/strings.json +++ b/homeassistant/components/home_connect/strings.json @@ -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}" }, diff --git a/tests/components/home_connect/test_init.py b/tests/components/home_connect/test_init.py index 06498f891db..6e4e428bf6a 100644 --- a/tests/components/home_connect/test_init.py +++ b/tests/components/home_connect/test_init.py @@ -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(