diff --git a/homeassistant/components/samsungtv/bridge.py b/homeassistant/components/samsungtv/bridge.py index ee761696cc0..dc8eb862ff7 100644 --- a/homeassistant/components/samsungtv/bridge.py +++ b/homeassistant/components/samsungtv/bridge.py @@ -22,7 +22,7 @@ from .const import ( LOGGER, METHOD_LEGACY, RESULT_AUTH_MISSING, - RESULT_NOT_SUCCESSFUL, + RESULT_CANNOT_CONNECT, RESULT_NOT_SUPPORTED, RESULT_SUCCESS, VALUE_CONF_ID, @@ -164,7 +164,7 @@ class SamsungTVLegacyBridge(SamsungTVBridge): return RESULT_NOT_SUPPORTED except OSError as err: LOGGER.debug("Failing config: %s, error: %s", config, err) - return RESULT_NOT_SUCCESSFUL + return RESULT_CANNOT_CONNECT def _get_remote(self): """Create or return a remote control instance.""" @@ -232,7 +232,7 @@ class SamsungTVWSBridge(SamsungTVBridge): if result: return result - return RESULT_NOT_SUCCESSFUL + return RESULT_CANNOT_CONNECT def _send_key(self, key): """Send the key using websocket protocol.""" diff --git a/homeassistant/components/samsungtv/config_flow.py b/homeassistant/components/samsungtv/config_flow.py index 9c18600670c..7a7fa26f922 100644 --- a/homeassistant/components/samsungtv/config_flow.py +++ b/homeassistant/components/samsungtv/config_flow.py @@ -31,7 +31,7 @@ from .const import ( METHOD_LEGACY, METHOD_WEBSOCKET, RESULT_AUTH_MISSING, - RESULT_NOT_SUCCESSFUL, + RESULT_CANNOT_CONNECT, RESULT_SUCCESS, ) @@ -87,10 +87,10 @@ class SamsungTVConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): for method in SUPPORTED_METHODS: self._bridge = SamsungTVBridge.get_bridge(method, self._host) result = self._bridge.try_connect() - if result != RESULT_NOT_SUCCESSFUL: + if result != RESULT_CANNOT_CONNECT: return result LOGGER.debug("No working config found") - return RESULT_NOT_SUCCESSFUL + return RESULT_CANNOT_CONNECT async def async_step_import(self, user_input=None): """Handle configuration by yaml file.""" diff --git a/homeassistant/components/samsungtv/const.py b/homeassistant/components/samsungtv/const.py index c08f07e6379..e043c74b347 100644 --- a/homeassistant/components/samsungtv/const.py +++ b/homeassistant/components/samsungtv/const.py @@ -16,7 +16,7 @@ CONF_ON_ACTION = "turn_on_action" RESULT_AUTH_MISSING = "auth_missing" RESULT_SUCCESS = "success" -RESULT_NOT_SUCCESSFUL = "not_successful" +RESULT_CANNOT_CONNECT = "cannot_connect" RESULT_NOT_SUPPORTED = "not_supported" METHOD_LEGACY = "legacy" diff --git a/homeassistant/components/samsungtv/strings.json b/homeassistant/components/samsungtv/strings.json index 21b938821fb..b326f2ab548 100644 --- a/homeassistant/components/samsungtv/strings.json +++ b/homeassistant/components/samsungtv/strings.json @@ -16,9 +16,9 @@ }, "abort": { "already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]", - "already_configured": "This Samsung TV is already configured.", + "already_configured": "[%key:common::config_flow::abort::already_configured_device%]", "auth_missing": "Home Assistant is not authorized to connect to this Samsung TV. Please check your TV's settings to authorize Home Assistant.", - "not_successful": "Unable to connect to this Samsung TV device.", + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "not_supported": "This Samsung TV device is currently not supported." } } diff --git a/tests/components/samsungtv/test_config_flow.py b/tests/components/samsungtv/test_config_flow.py index 0e83255c6e3..f8a362e9842 100644 --- a/tests/components/samsungtv/test_config_flow.py +++ b/tests/components/samsungtv/test_config_flow.py @@ -211,7 +211,7 @@ async def test_user_not_successful(hass): DOMAIN, context={"source": "user"}, data=MOCK_USER_DATA ) assert result["type"] == "abort" - assert result["reason"] == "not_successful" + assert result["reason"] == "cannot_connect" async def test_user_not_successful_2(hass): @@ -229,7 +229,7 @@ async def test_user_not_successful_2(hass): DOMAIN, context={"source": "user"}, data=MOCK_USER_DATA ) assert result["type"] == "abort" - assert result["reason"] == "not_successful" + assert result["reason"] == "cannot_connect" async def test_user_already_configured(hass, remote): @@ -389,7 +389,7 @@ async def test_ssdp_not_successful(hass): result["flow_id"], user_input="whatever" ) assert result["type"] == "abort" - assert result["reason"] == "not_successful" + assert result["reason"] == "cannot_connect" async def test_ssdp_not_successful_2(hass): @@ -416,7 +416,7 @@ async def test_ssdp_not_successful_2(hass): result["flow_id"], user_input="whatever" ) assert result["type"] == "abort" - assert result["reason"] == "not_successful" + assert result["reason"] == "cannot_connect" async def test_ssdp_already_in_progress(hass, remote): @@ -570,7 +570,7 @@ async def test_autodetect_none(hass, remote, remotews): DOMAIN, context={"source": "user"}, data=MOCK_USER_DATA ) assert result["type"] == "abort" - assert result["reason"] == "not_successful" + assert result["reason"] == "cannot_connect" assert remote.call_count == 1 assert remote.call_args_list == [ call(AUTODETECT_LEGACY),