diff --git a/homeassistant/components/ambiclimate/config_flow.py b/homeassistant/components/ambiclimate/config_flow.py index 2b88e7ab91e..3d111113652 100644 --- a/homeassistant/components/ambiclimate/config_flow.py +++ b/homeassistant/components/ambiclimate/config_flow.py @@ -53,20 +53,20 @@ class AmbiclimateFlowHandler(config_entries.ConfigFlow): async def async_step_user(self, user_input=None): """Handle external yaml configuration.""" if self.hass.config_entries.async_entries(DOMAIN): - return self.async_abort(reason="already_setup") + return self.async_abort(reason="already_configured_account") config = self.hass.data.get(DATA_AMBICLIMATE_IMPL, {}) if not config: _LOGGER.debug("No config") - return self.async_abort(reason="no_config") + return self.async_abort(reason="oauth2_missing_configuration") return await self.async_step_auth() async def async_step_auth(self, user_input=None): """Handle a flow start.""" if self.hass.config_entries.async_entries(DOMAIN): - return self.async_abort(reason="already_setup") + return self.async_abort(reason="already_configured_account") errors = {} @@ -88,7 +88,7 @@ class AmbiclimateFlowHandler(config_entries.ConfigFlow): async def async_step_code(self, code=None): """Received code for authentication.""" if self.hass.config_entries.async_entries(DOMAIN): - return self.async_abort(reason="already_setup") + return self.async_abort(reason="already_configured_account") token_info = await self._get_token_info(code) diff --git a/homeassistant/components/ambiclimate/strings.json b/homeassistant/components/ambiclimate/strings.json index 26af78f8915..9e01281ad30 100644 --- a/homeassistant/components/ambiclimate/strings.json +++ b/homeassistant/components/ambiclimate/strings.json @@ -14,8 +14,8 @@ "follow_link": "Please follow the link and authenticate before pressing Submit" }, "abort": { - "already_setup": "The Ambiclimate account is configured.", - "no_config": "You need to configure Ambiclimate before being able to authenticate with it. [Please read the instructions](https://www.home-assistant.io/components/ambiclimate/).", + "already_configured_account": "[%key:common::config_flow::abort::already_configured_account%]", + "oauth2_missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]", "access_token": "Unknown error generating an access token." } } diff --git a/tests/components/ambiclimate/test_config_flow.py b/tests/components/ambiclimate/test_config_flow.py index 35c2ef69bb3..f7723c73d53 100644 --- a/tests/components/ambiclimate/test_config_flow.py +++ b/tests/components/ambiclimate/test_config_flow.py @@ -30,7 +30,7 @@ async def test_abort_if_no_implementation_registered(hass): result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "no_config" + assert result["reason"] == "oauth2_missing_configuration" async def test_abort_if_already_setup(hass): @@ -40,12 +40,12 @@ async def test_abort_if_already_setup(hass): with patch.object(hass.config_entries, "async_entries", return_value=[{}]): result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "already_setup" + assert result["reason"] == "already_configured_account" with patch.object(hass.config_entries, "async_entries", return_value=[{}]): result = await flow.async_step_code() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "already_setup" + assert result["reason"] == "already_configured_account" async def test_full_flow_implementation(hass): @@ -107,7 +107,7 @@ async def test_already_setup(hass): result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "already_setup" + assert result["reason"] == "already_configured_account" async def test_view(hass):