Skip to content

Commit f108663

Browse files
jbouwhmishmannersCopilot
authored
Move out URL of Xiaomy_aquara from strings.json (home-assistant#157937)
Co-authored-by: Michelle "MishManners®™" Duke <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent df68448 commit f108663

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

homeassistant/components/xiaomi_aqara/config_flow.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
}
4545
)
4646

47+
ERROR_STEP_PLACEHOLDERS = {
48+
"tutorial_url": "https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)#Adding_the_Xiaomi_Gateway_to_Domoticz",
49+
"invalid_host_url": "https://www.home-assistant.io/integrations/xiaomi_aqara/#connection-problem",
50+
}
51+
4752

4853
class XiaomiAqaraFlowHandler(ConfigFlow, domain=DOMAIN):
4954
"""Handle a Xiaomi Aqara config flow."""
@@ -66,7 +71,12 @@ def async_show_form_step_user(self, errors):
6671
if (self.host is None and self.sid is None) or errors:
6772
schema = GATEWAY_CONFIG_HOST
6873

69-
return self.async_show_form(step_id="user", data_schema=schema, errors=errors)
74+
return self.async_show_form(
75+
step_id="user",
76+
data_schema=schema,
77+
errors=errors,
78+
description_placeholders=ERROR_STEP_PLACEHOLDERS,
79+
)
7080

7181
async def async_step_user(
7282
self, user_input: dict[str, Any] | None = None
@@ -149,7 +159,10 @@ async def async_step_select(
149159
)
150160

151161
return self.async_show_form(
152-
step_id="select", data_schema=select_schema, errors=errors
162+
step_id="select",
163+
data_schema=select_schema,
164+
errors=errors,
165+
description_placeholders=ERROR_STEP_PLACEHOLDERS,
153166
)
154167

155168
async def async_step_zeroconf(
@@ -236,5 +249,8 @@ async def async_step_settings(
236249
errors[CONF_KEY] = "invalid_key"
237250

238251
return self.async_show_form(
239-
step_id="settings", data_schema=GATEWAY_SETTINGS, errors=errors
252+
step_id="settings",
253+
data_schema=GATEWAY_SETTINGS,
254+
errors=errors,
255+
description_placeholders=ERROR_STEP_PLACEHOLDERS,
240256
)

homeassistant/components/xiaomi_aqara/strings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"error": {
99
"discovery_error": "Failed to discover a Xiaomi Aqara Gateway, try using the IP of the device running Home Assistant as interface",
10-
"invalid_host": "Invalid hostname or IP address, see https://www.home-assistant.io/integrations/xiaomi_aqara/#connection-problem",
10+
"invalid_host": "Invalid hostname or IP address, see {invalid_host_url}",
1111
"invalid_interface": "Invalid network interface",
1212
"invalid_key": "Invalid Gateway key",
1313
"invalid_mac": "Invalid MAC address"
@@ -25,7 +25,7 @@
2525
"key": "The key of your Gateway",
2626
"name": "Name of the Gateway"
2727
},
28-
"description": "The key (password) can be retrieved using this tutorial: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)#Adding_the_Xiaomi_Gateway_to_Domoticz. If the key is not provided only sensors will be accessible",
28+
"description": "The key (password) can be retrieved using this tutorial: {tutorial_url}. If the key is not provided only sensors will be accessible",
2929
"title": "Optional settings"
3030
},
3131
"user": {

0 commit comments

Comments
 (0)