Move URL out of xiaomi_miio strings.json (#155357)

Co-authored-by: Norbert Rittel <norbert@rittel.de>
Co-authored-by: Joostlek <joostlek@outlook.com>
This commit is contained in:
eliasubz
2025-10-29 00:59:23 +01:00
committed by GitHub
parent ad635d2eff
commit c86852eb21
2 changed files with 30 additions and 7 deletions

View File

@@ -59,6 +59,10 @@ DEVICE_CLOUD_CONFIG = vol.Schema(
}
)
CLOUD_STEP_PLACEHOLDERS = {
"country_servers_url": "https://www.openhab.org/addons/bindings/miio/#country-servers",
}
class OptionsFlowHandler(OptionsFlowWithReload):
"""Options for the component."""
@@ -224,7 +228,10 @@ class XiaomiMiioFlowHandler(ConfigFlow, domain=DOMAIN):
if not cloud_username or not cloud_password or not cloud_country:
errors["base"] = "cloud_credentials_incomplete"
return self.async_show_form(
step_id="cloud", data_schema=DEVICE_CLOUD_CONFIG, errors=errors
step_id="cloud",
data_schema=DEVICE_CLOUD_CONFIG,
errors=errors,
description_placeholders=CLOUD_STEP_PLACEHOLDERS,
)
miio_cloud = await self.hass.async_add_executor_job(
@@ -241,7 +248,10 @@ class XiaomiMiioFlowHandler(ConfigFlow, domain=DOMAIN):
if errors:
return self.async_show_form(
step_id="cloud", data_schema=DEVICE_CLOUD_CONFIG, errors=errors
step_id="cloud",
data_schema=DEVICE_CLOUD_CONFIG,
errors=errors,
description_placeholders=CLOUD_STEP_PLACEHOLDERS,
)
try:
@@ -255,7 +265,10 @@ class XiaomiMiioFlowHandler(ConfigFlow, domain=DOMAIN):
if not devices_raw:
errors["base"] = "cloud_no_devices"
return self.async_show_form(
step_id="cloud", data_schema=DEVICE_CLOUD_CONFIG, errors=errors
step_id="cloud",
data_schema=DEVICE_CLOUD_CONFIG,
errors=errors,
description_placeholders=CLOUD_STEP_PLACEHOLDERS,
)
self.cloud_devices = {}
@@ -284,7 +297,10 @@ class XiaomiMiioFlowHandler(ConfigFlow, domain=DOMAIN):
return await self.async_step_select()
return self.async_show_form(
step_id="cloud", data_schema=DEVICE_CLOUD_CONFIG, errors=errors
step_id="cloud",
data_schema=DEVICE_CLOUD_CONFIG,
errors=errors,
description_placeholders=CLOUD_STEP_PLACEHOLDERS,
)
async def async_step_select(
@@ -322,7 +338,14 @@ class XiaomiMiioFlowHandler(ConfigFlow, domain=DOMAIN):
else:
schema = DEVICE_CONFIG
return self.async_show_form(step_id="manual", data_schema=schema, errors=errors)
return self.async_show_form(
step_id="manual",
data_schema=schema,
errors=errors,
description_placeholders={
"retrieving_token_url": "https://www.home-assistant.io/integrations/xiaomi_miio#retrieving-the-access-token",
},
)
async def async_step_connect(
self, user_input: dict[str, Any] | None = None

View File

@@ -25,7 +25,7 @@
"cloud_username": "[%key:common::config_flow::data::username%]",
"manual": "Configure manually (not recommended)"
},
"description": "Log in to Xiaomi Home, see https://www.openhab.org/addons/bindings/miio/#country-servers for the server region to use."
"description": "Log in to Xiaomi Home, see {country_servers_url} for the server region to use."
},
"connect": {
"data": {
@@ -37,7 +37,7 @@
"host": "[%key:common::config_flow::data::ip%]",
"token": "[%key:common::config_flow::data::api_token%]"
},
"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."
"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."
},
"reauth_confirm": {
"description": "The Xiaomi Home integration needs to re-authenticate your account in order to update the tokens or add missing credentials.",