Add note to unifiprotect flow that a local user is required (#64651)
parent
8fb4e0934e
commit
01241483cc
|
@ -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,
|
||||
|
|
|
@ -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%]"
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue