diff --git a/homeassistant/components/brother/config_flow.py b/homeassistant/components/brother/config_flow.py index 8b3a9539cc3..306945b0424 100644 --- a/homeassistant/components/brother/config_flow.py +++ b/homeassistant/components/brother/config_flow.py @@ -59,7 +59,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): except InvalidHost: errors[CONF_HOST] = "wrong_host" except ConnectionError: - errors["base"] = "connection_error" + errors["base"] = "cannot_connect" except SnmpError: errors["base"] = "snmp_error" except UnsupportedModel: @@ -72,7 +72,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): async def async_step_zeroconf(self, discovery_info): """Handle zeroconf discovery.""" if discovery_info is None: - return self.async_abort(reason="connection_error") + return self.async_abort(reason="cannot_connect") if not discovery_info.get("name") or not discovery_info["name"].startswith( "Brother" @@ -86,7 +86,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): try: await self.brother.async_update() except (ConnectionError, SnmpError, UnsupportedModel): - return self.async_abort(reason="connection_error") + return self.async_abort(reason="cannot_connect") # Check if already configured await self.async_set_unique_id(self.brother.serial.lower()) diff --git a/homeassistant/components/brother/strings.json b/homeassistant/components/brother/strings.json index 4faa177a379..358f76e77b8 100644 --- a/homeassistant/components/brother/strings.json +++ b/homeassistant/components/brother/strings.json @@ -19,7 +19,7 @@ }, "error": { "wrong_host": "Invalid hostname or IP address.", - "connection_error": "[%key:common::config_flow::error::cannot_connect%]", + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "snmp_error": "SNMP server turned off or printer not supported." }, "abort": { diff --git a/tests/components/brother/test_config_flow.py b/tests/components/brother/test_config_flow.py index 06e58b83522..153c07deeac 100644 --- a/tests/components/brother/test_config_flow.py +++ b/tests/components/brother/test_config_flow.py @@ -76,7 +76,7 @@ async def test_connection_error(hass): DOMAIN, context={"source": SOURCE_USER}, data=CONFIG ) - assert result["errors"] == {"base": "connection_error"} + assert result["errors"] == {"base": "cannot_connect"} async def test_snmp_error(hass): @@ -125,7 +125,7 @@ async def test_zeroconf_no_data(hass): ) assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "connection_error" + assert result["reason"] == "cannot_connect" async def test_zeroconf_not_brother_printer_error(hass): @@ -156,7 +156,7 @@ async def test_zeroconf_snmp_error(hass): ) assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "connection_error" + assert result["reason"] == "cannot_connect" async def test_zeroconf_device_exists_abort(hass):