From 0a1d9abe796cd7a8939db7028bb34939111b1ecf Mon Sep 17 00:00:00 2001 From: definitio <37266727+definitio@users.noreply.github.com> Date: Fri, 9 Oct 2020 16:28:54 +0400 Subject: [PATCH] Use common strings in esphome config flow (#41547) --- homeassistant/components/esphome/config_flow.py | 2 +- homeassistant/components/esphome/strings.json | 4 ++-- tests/components/esphome/test_config_flow.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/esphome/config_flow.py b/homeassistant/components/esphome/config_flow.py index a22256bc69d..1d1fc421bb8 100644 --- a/homeassistant/components/esphome/config_flow.py +++ b/homeassistant/components/esphome/config_flow.py @@ -202,6 +202,6 @@ class EsphomeFlowHandler(ConfigFlow, domain=DOMAIN): await cli.connect(login=True) except APIConnectionError: await cli.disconnect(force=True) - return "invalid_password" + return "invalid_auth" return None diff --git a/homeassistant/components/esphome/strings.json b/homeassistant/components/esphome/strings.json index c0f6aafa1b2..88072a4d241 100644 --- a/homeassistant/components/esphome/strings.json +++ b/homeassistant/components/esphome/strings.json @@ -1,13 +1,13 @@ { "config": { "abort": { - "already_configured": "ESP is already configured", + "already_configured": "[%key:common::config_flow::abort::already_configured_device%]", "already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]" }, "error": { "resolve_error": "Can't resolve address of the ESP. If this error persists, please set a static IP address: https://esphomelib.com/esphomeyaml/components/wifi.html#manual-ips", "connection_error": "Can't connect to ESP. Please make sure your YAML file contains an 'api:' line.", - "invalid_password": "Invalid password!" + "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]" }, "step": { "user": { diff --git a/tests/components/esphome/test_config_flow.py b/tests/components/esphome/test_config_flow.py index 164709e86a8..41c3d6cf528 100644 --- a/tests/components/esphome/test_config_flow.py +++ b/tests/components/esphome/test_config_flow.py @@ -174,7 +174,7 @@ async def test_user_invalid_password(hass, mock_api_connection_error, mock_clien assert result["type"] == RESULT_TYPE_FORM assert result["step_id"] == "authenticate" - assert result["errors"] == {"base": "invalid_password"} + assert result["errors"] == {"base": "invalid_auth"} async def test_discovery_initiation(hass, mock_client):