diff --git a/homeassistant/components/unifiprotect/config_flow.py b/homeassistant/components/unifiprotect/config_flow.py index 7398d755b90..5b5b20e7175 100644 --- a/homeassistant/components/unifiprotect/config_flow.py +++ b/homeassistant/components/unifiprotect/config_flow.py @@ -19,10 +19,11 @@ from homeassistant.const import ( CONF_USERNAME, CONF_VERIFY_SSL, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers.aiohttp_client import async_create_clientsession from homeassistant.helpers.typing import DiscoveryInfoType +from homeassistant.loader import async_get_integration from .const import ( CONF_ALL_UPDATES, @@ -40,6 +41,12 @@ from .utils import _async_short_mac, _async_unifi_mac_from_hass _LOGGER = logging.getLogger(__name__) +async def async_local_user_documentation_url(hass: HomeAssistant) -> str: + """Get the documentation url for creating a local user.""" + integration = await async_get_integration(hass, DOMAIN) + return f"{integration.documentation}#local-user" + + def _host_is_direct_connect(host: str) -> bool: """Check if a host is a unifi direct connect domain.""" return host.endswith(".ui.direct") @@ -139,7 +146,12 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): user_input = user_input or {} return self.async_show_form( step_id="discovery_confirm", - description_placeholders=placeholders, + description_placeholders={ + **placeholders, + "local_user_documentation_url": await async_local_user_documentation_url( + self.hass + ), + }, data_schema=vol.Schema( { vol.Required( @@ -269,6 +281,11 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): user_input = user_input or {} return self.async_show_form( step_id="user", + description_placeholders={ + "local_user_documentation_url": await async_local_user_documentation_url( + self.hass + ) + }, data_schema=vol.Schema( { vol.Required(CONF_HOST, default=user_input.get(CONF_HOST)): str, diff --git a/homeassistant/components/unifiprotect/strings.json b/homeassistant/components/unifiprotect/strings.json index 99bffefbd35..9ae85702769 100644 --- a/homeassistant/components/unifiprotect/strings.json +++ b/homeassistant/components/unifiprotect/strings.json @@ -4,6 +4,7 @@ "step": { "user": { "title": "UniFi Protect Setup", + "description": "You will need a local user created in your UniFi OS Console to log in with. Ubiquiti Cloud Users will not work. For more information: {local_user_documentation_url}", "data": { "host": "[%key:common::config_flow::data::host%]", "port": "[%key:common::config_flow::data::port%]", @@ -22,7 +23,8 @@ } }, "discovery_confirm": { - "description": "Do you want to setup {name} ({ip_address})?", + "title": "UniFi Protect Discovered", + "description": "Do you want to setup {name} ({ip_address})? [%key:component::unifiprotect::config::step::user::description%]", "data": { "username": "[%key:common::config_flow::data::username%]", "password": "[%key:common::config_flow::data::password%]" diff --git a/homeassistant/components/unifiprotect/translations/en.json b/homeassistant/components/unifiprotect/translations/en.json index effa7881480..b9d787b382e 100644 --- a/homeassistant/components/unifiprotect/translations/en.json +++ b/homeassistant/components/unifiprotect/translations/en.json @@ -7,18 +7,17 @@ "error": { "cannot_connect": "Failed to connect", "invalid_auth": "Invalid authentication", - "protect_version": "Minimum required version is v1.20.0. Please upgrade UniFi Protect and then retry.", - "unknown": "Unexpected error" + "protect_version": "Minimum required version is v1.20.0. Please upgrade UniFi Protect and then retry." }, "flow_title": "{name} ({ip_address})", "step": { "discovery_confirm": { "data": { "password": "Password", - "username": "Username", - "verify_ssl": "Verify SSL certificate" + "username": "Username" }, - "description": "Do you want to setup {name} ({ip_address})?" + "description": "Do you want to setup {name} ({ip_address})? You will need a local user created in your UniFi OS Console to log in with. Ubiquiti Cloud Users will not work. For more information: {local_user_documentation_url}", + "title": "UniFi Protect Discovered" }, "reauth_confirm": { "data": { @@ -37,6 +36,7 @@ "username": "Username", "verify_ssl": "Verify SSL certificate" }, + "description": "You will need a local user created in your UniFi OS Console to log in with. Ubiquiti Cloud Users will not work. For more information: {local_user_documentation_url}", "title": "UniFi Protect Setup" } }