From 40752dcfb61863cc0a912d60a25e92f41ae96d62 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Sat, 26 Apr 2025 22:43:07 +0200 Subject: [PATCH] Translate missing exceptions in SamsungTV (#143628) * Translate missing exceptions in SamsungTV * apply review comment --- homeassistant/components/samsungtv/__init__.py | 6 ++++-- homeassistant/components/samsungtv/strings.json | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/samsungtv/__init__.py b/homeassistant/components/samsungtv/__init__.py index 22d231ae1fe..e306e00691f 100644 --- a/homeassistant/components/samsungtv/__init__.py +++ b/homeassistant/components/samsungtv/__init__.py @@ -35,6 +35,7 @@ from .const import ( CONF_SESSION_ID, CONF_SSDP_MAIN_TV_AGENT_LOCATION, CONF_SSDP_RENDERING_CONTROL_LOCATION, + DOMAIN, ENTRY_RELOAD_COOLDOWN, LEGACY_PORT, LOGGER, @@ -126,7 +127,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: SamsungTVConfigEntry) -> if entry.data.get(CONF_METHOD) == METHOD_ENCRYPTED_WEBSOCKET: if not entry.data.get(CONF_TOKEN) or not entry.data.get(CONF_SESSION_ID): raise ConfigEntryAuthFailed( - "Token and session id are required in encrypted mode" + translation_domain=DOMAIN, translation_key="encrypted_mode_auth_failed" ) bridge = await _async_create_bridge_with_updated_data(hass, entry) @@ -195,7 +196,8 @@ async def _async_create_bridge_with_updated_data( load_info_attempted = True if not port or not method: raise ConfigEntryNotReady( - "Failed to determine connection method, make sure the device is on." + translation_domain=DOMAIN, + translation_key="failed_to_determine_connection_method", ) LOGGER.debug("Updated port to %s and method to %s for %s", port, method, host) diff --git a/homeassistant/components/samsungtv/strings.json b/homeassistant/components/samsungtv/strings.json index 6e72c2b8d13..84e5fded03f 100644 --- a/homeassistant/components/samsungtv/strings.json +++ b/homeassistant/components/samsungtv/strings.json @@ -67,6 +67,12 @@ }, "service_unsupported": { "message": "Entity {entity} does not support this action." + }, + "encrypted_mode_auth_failed": { + "message": "Token and session ID are required in encrypted mode." + }, + "failed_to_determine_connection_method": { + "message": "Failed to determine connection method, make sure the device is on." } } }