Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions homeassistant/components/xiaomi_aqara/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
}
)

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


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

return self.async_show_form(step_id="user", data_schema=schema, errors=errors)
return self.async_show_form(
step_id="user",
data_schema=schema,
errors=errors,
description_placeholders=ERROR_STEP_PLACEHOLDERS,
)

async def async_step_user(
self, user_input: dict[str, Any] | None = None
Expand Down Expand Up @@ -149,7 +159,10 @@ async def async_step_select(
)

return self.async_show_form(
step_id="select", data_schema=select_schema, errors=errors
step_id="select",
data_schema=select_schema,
errors=errors,
description_placeholders=ERROR_STEP_PLACEHOLDERS,
)

async def async_step_zeroconf(
Expand Down Expand Up @@ -236,5 +249,8 @@ async def async_step_settings(
errors[CONF_KEY] = "invalid_key"

return self.async_show_form(
step_id="settings", data_schema=GATEWAY_SETTINGS, errors=errors
step_id="settings",
data_schema=GATEWAY_SETTINGS,
errors=errors,
description_placeholders=ERROR_STEP_PLACEHOLDERS,
)
4 changes: 2 additions & 2 deletions homeassistant/components/xiaomi_aqara/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"error": {
"discovery_error": "Failed to discover a Xiaomi Aqara Gateway, try using the IP of the device running Home Assistant as interface",
"invalid_host": "Invalid hostname or IP address, see https://www.home-assistant.io/integrations/xiaomi_aqara/#connection-problem",
"invalid_host": "Invalid hostname or IP address, see {invalid_host_url}",
"invalid_interface": "Invalid network interface",
"invalid_key": "Invalid Gateway key",
"invalid_mac": "Invalid MAC address"
Expand All @@ -25,7 +25,7 @@
"key": "The key of your Gateway",
"name": "Name of the Gateway"
},
"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",
"description": "The key (password) can be retrieved using this tutorial: {tutorial_url}. If the key is not provided only sensors will be accessible",
"title": "Optional settings"
},
"user": {
Expand Down
Loading