Skip to content

Commit c86852e

Browse files
eliasubzNoRi2909joostlek
authored
Move URL out of xiaomi_miio strings.json (#155357)
Co-authored-by: Norbert Rittel <[email protected]> Co-authored-by: Joostlek <[email protected]>
1 parent ad635d2 commit c86852e

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

homeassistant/components/xiaomi_miio/config_flow.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
}
6060
)
6161

62+
CLOUD_STEP_PLACEHOLDERS = {
63+
"country_servers_url": "https://www.openhab.org/addons/bindings/miio/#country-servers",
64+
}
65+
6266

6367
class OptionsFlowHandler(OptionsFlowWithReload):
6468
"""Options for the component."""
@@ -224,7 +228,10 @@ async def async_step_cloud(
224228
if not cloud_username or not cloud_password or not cloud_country:
225229
errors["base"] = "cloud_credentials_incomplete"
226230
return self.async_show_form(
227-
step_id="cloud", data_schema=DEVICE_CLOUD_CONFIG, errors=errors
231+
step_id="cloud",
232+
data_schema=DEVICE_CLOUD_CONFIG,
233+
errors=errors,
234+
description_placeholders=CLOUD_STEP_PLACEHOLDERS,
228235
)
229236

230237
miio_cloud = await self.hass.async_add_executor_job(
@@ -241,7 +248,10 @@ async def async_step_cloud(
241248

242249
if errors:
243250
return self.async_show_form(
244-
step_id="cloud", data_schema=DEVICE_CLOUD_CONFIG, errors=errors
251+
step_id="cloud",
252+
data_schema=DEVICE_CLOUD_CONFIG,
253+
errors=errors,
254+
description_placeholders=CLOUD_STEP_PLACEHOLDERS,
245255
)
246256

247257
try:
@@ -255,7 +265,10 @@ async def async_step_cloud(
255265
if not devices_raw:
256266
errors["base"] = "cloud_no_devices"
257267
return self.async_show_form(
258-
step_id="cloud", data_schema=DEVICE_CLOUD_CONFIG, errors=errors
268+
step_id="cloud",
269+
data_schema=DEVICE_CLOUD_CONFIG,
270+
errors=errors,
271+
description_placeholders=CLOUD_STEP_PLACEHOLDERS,
259272
)
260273

261274
self.cloud_devices = {}
@@ -284,7 +297,10 @@ async def async_step_cloud(
284297
return await self.async_step_select()
285298

286299
return self.async_show_form(
287-
step_id="cloud", data_schema=DEVICE_CLOUD_CONFIG, errors=errors
300+
step_id="cloud",
301+
data_schema=DEVICE_CLOUD_CONFIG,
302+
errors=errors,
303+
description_placeholders=CLOUD_STEP_PLACEHOLDERS,
288304
)
289305

290306
async def async_step_select(
@@ -322,7 +338,14 @@ async def async_step_manual(
322338
else:
323339
schema = DEVICE_CONFIG
324340

325-
return self.async_show_form(step_id="manual", data_schema=schema, errors=errors)
341+
return self.async_show_form(
342+
step_id="manual",
343+
data_schema=schema,
344+
errors=errors,
345+
description_placeholders={
346+
"retrieving_token_url": "https://www.home-assistant.io/integrations/xiaomi_miio#retrieving-the-access-token",
347+
},
348+
)
326349

327350
async def async_step_connect(
328351
self, user_input: dict[str, Any] | None = None

homeassistant/components/xiaomi_miio/strings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"cloud_username": "[%key:common::config_flow::data::username%]",
2626
"manual": "Configure manually (not recommended)"
2727
},
28-
"description": "Log in to Xiaomi Home, see https://www.openhab.org/addons/bindings/miio/#country-servers for the server region to use."
28+
"description": "Log in to Xiaomi Home, see {country_servers_url} for the server region to use."
2929
},
3030
"connect": {
3131
"data": {
@@ -37,7 +37,7 @@
3737
"host": "[%key:common::config_flow::data::ip%]",
3838
"token": "[%key:common::config_flow::data::api_token%]"
3939
},
40-
"description": "You will need the 32 character API token, see https://www.home-assistant.io/integrations/xiaomi_miio#retrieving-the-access-token for instructions. Please note, that this API token is different from the key used by the Xiaomi Aqara integration."
40+
"description": "You will need the 32 character API token, see {retrieving_token_url} for instructions. Please note that this API token is different from the key used by the Xiaomi Aqara integration."
4141
},
4242
"reauth_confirm": {
4343
"description": "The Xiaomi Home integration needs to re-authenticate your account in order to update the tokens or add missing credentials.",

0 commit comments

Comments
 (0)