diff --git a/homeassistant/components/elgato/config_flow.py b/homeassistant/components/elgato/config_flow.py index 687310c2c3e..624774b9bf4 100644 --- a/homeassistant/components/elgato/config_flow.py +++ b/homeassistant/components/elgato/config_flow.py @@ -33,7 +33,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN): user_input[CONF_HOST], user_input[CONF_PORT] ) except ElgatoError: - return self._show_setup_form({"base": "connection_error"}) + return self._show_setup_form({"base": "cannot_connect"}) # Check if already configured await self.async_set_unique_id(info.serial_number) @@ -53,14 +53,14 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN): ) -> Dict[str, Any]: """Handle zeroconf discovery.""" if user_input is None: - return self.async_abort(reason="connection_error") + return self.async_abort(reason="cannot_connect") try: info = await self._get_elgato_info( user_input[CONF_HOST], user_input[CONF_PORT] ) except ElgatoError: - return self.async_abort(reason="connection_error") + return self.async_abort(reason="cannot_connect") # Check if already configured await self.async_set_unique_id(info.serial_number) @@ -92,7 +92,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN): self.context.get(CONF_HOST), self.context.get(CONF_PORT) ) except ElgatoError: - return self.async_abort(reason="connection_error") + return self.async_abort(reason="cannot_connect") # Check if already configured await self.async_set_unique_id(info.serial_number) diff --git a/homeassistant/components/elgato/strings.json b/homeassistant/components/elgato/strings.json index a00bf027451..54c5f43a5da 100644 --- a/homeassistant/components/elgato/strings.json +++ b/homeassistant/components/elgato/strings.json @@ -15,11 +15,11 @@ } }, "error": { - "connection_error": "Failed to connect to Elgato Key Light device." + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]" }, "abort": { - "already_configured": "This Elgato Key Light device is already configured.", - "connection_error": "Failed to connect to Elgato Key Light device." + "already_configured": "[%key:common::config_flow::abort::already_configured_device%]", + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]" } } -} \ No newline at end of file +} diff --git a/tests/components/elgato/test_config_flow.py b/tests/components/elgato/test_config_flow.py index e0d34aecad2..c1dfa697041 100644 --- a/tests/components/elgato/test_config_flow.py +++ b/tests/components/elgato/test_config_flow.py @@ -72,7 +72,7 @@ async def test_connection_error( data={CONF_HOST: "1.2.3.4", CONF_PORT: 9123}, ) - assert result["errors"] == {"base": "connection_error"} + assert result["errors"] == {"base": "cannot_connect"} assert result["step_id"] == "user" assert result["type"] == data_entry_flow.RESULT_TYPE_FORM @@ -89,7 +89,7 @@ async def test_zeroconf_connection_error( data={"host": "1.2.3.4", "port": 9123}, ) - assert result["reason"] == "connection_error" + assert result["reason"] == "cannot_connect" assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT @@ -110,7 +110,7 @@ async def test_zeroconf_confirm_connection_error( user_input={CONF_HOST: "1.2.3.4", CONF_PORT: 9123} ) - assert result["reason"] == "connection_error" + assert result["reason"] == "cannot_connect" assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT @@ -122,7 +122,7 @@ async def test_zeroconf_no_data( flow.hass = hass result = await flow.async_step_zeroconf() - assert result["reason"] == "connection_error" + assert result["reason"] == "cannot_connect" assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT