From 4b225a87c5ceff175356249c36261cbfe0628a23 Mon Sep 17 00:00:00 2001
From: Davey Chu <davey.chu@gmail.com>
Date: Thu, 1 Oct 2020 21:49:16 +0200
Subject: [PATCH] Use references in airvisual strings.json (#41005)

---
 homeassistant/components/airvisual/config_flow.py | 2 +-
 homeassistant/components/airvisual/strings.json   | 6 +++---
 tests/components/airvisual/test_config_flow.py    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/homeassistant/components/airvisual/config_flow.py b/homeassistant/components/airvisual/config_flow.py
index d8ab508b8bc..7f8022d31f6 100644
--- a/homeassistant/components/airvisual/config_flow.py
+++ b/homeassistant/components/airvisual/config_flow.py
@@ -166,7 +166,7 @@ class AirVisualFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
             return self.async_show_form(
                 step_id="node_pro",
                 data_schema=self.node_pro_schema,
-                errors={CONF_IP_ADDRESS: "unable_to_connect"},
+                errors={CONF_IP_ADDRESS: "cannot_connect"},
             )
 
         await node.async_disconnect()
diff --git a/homeassistant/components/airvisual/strings.json b/homeassistant/components/airvisual/strings.json
index cb0e01a92e5..fd8e10f105e 100644
--- a/homeassistant/components/airvisual/strings.json
+++ b/homeassistant/components/airvisual/strings.json
@@ -29,9 +29,9 @@
       }
     },
     "error": {
-      "general_error": "There was an unknown error.",
-      "invalid_api_key": "Invalid API key provided.",
-      "unable_to_connect": "Unable to connect to Node/Pro unit."
+      "general_error": "[%key:common::config_flow::error::unknown%]",
+      "invalid_api_key": "[%key:common::config_flow::error::invalid_api_key%]",
+      "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
     },
     "abort": {
       "already_configured": "These coordinates or Node/Pro ID are already registered."
diff --git a/tests/components/airvisual/test_config_flow.py b/tests/components/airvisual/test_config_flow.py
index 2d0acf8fe7b..bcfd34cd589 100644
--- a/tests/components/airvisual/test_config_flow.py
+++ b/tests/components/airvisual/test_config_flow.py
@@ -140,7 +140,7 @@ async def test_node_pro_error(hass):
             result["flow_id"], user_input=node_pro_conf
         )
         assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
-        assert result["errors"] == {CONF_IP_ADDRESS: "unable_to_connect"}
+        assert result["errors"] == {CONF_IP_ADDRESS: "cannot_connect"}
 
 
 async def test_options_flow(hass):
-- 
GitLab