Reolink improve config flow login (#90036)
This commit is contained in:
parent
8dbcbd156a
commit
d427c35c87
3 changed files with 16 additions and 11 deletions
|
@ -108,7 +108,10 @@ class ReolinkFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
) -> FlowResult:
|
||||
"""Handle the initial step."""
|
||||
errors = {}
|
||||
placeholders = {"error": ""}
|
||||
placeholders = {
|
||||
"error": "",
|
||||
"troubleshooting_link": "https://www.home-assistant.io/integrations/reolink/#troubleshooting",
|
||||
}
|
||||
|
||||
if user_input is not None:
|
||||
if CONF_HOST not in user_input:
|
||||
|
|
|
@ -82,9 +82,15 @@ class ReolinkHost:
|
|||
f"'{self._api.user_level}', only admin users can change camera settings"
|
||||
)
|
||||
|
||||
enable_rtsp = None
|
||||
enable_onvif = None
|
||||
enable_rtmp = None
|
||||
enable_rtsp = None
|
||||
|
||||
if not self._api.rtsp_enabled:
|
||||
_LOGGER.debug(
|
||||
"RTSP is disabled on %s, trying to enable it", self._api.nvr_name
|
||||
)
|
||||
enable_rtsp = True
|
||||
|
||||
if not self._api.onvif_enabled:
|
||||
_LOGGER.debug(
|
||||
|
@ -97,11 +103,6 @@ class ReolinkHost:
|
|||
"RTMP is disabled on %s, trying to enable it", self._api.nvr_name
|
||||
)
|
||||
enable_rtmp = True
|
||||
elif not self._api.rtsp_enabled and self._api.protocol == "rtsp":
|
||||
_LOGGER.debug(
|
||||
"RTSP is disabled on %s, trying to enable it", self._api.nvr_name
|
||||
)
|
||||
enable_rtsp = True
|
||||
|
||||
if enable_onvif or enable_rtmp or enable_rtsp:
|
||||
try:
|
||||
|
@ -112,13 +113,14 @@ class ReolinkHost:
|
|||
)
|
||||
except ReolinkError:
|
||||
ports = ""
|
||||
if enable_rtsp:
|
||||
ports += "RTSP "
|
||||
|
||||
if enable_onvif:
|
||||
ports += "ONVIF "
|
||||
|
||||
if enable_rtmp:
|
||||
ports += "RTMP "
|
||||
elif enable_rtsp:
|
||||
ports += "RTSP "
|
||||
|
||||
ir.async_create_issue(
|
||||
self._hass,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"flow_title": "{hostname} ({ip_address})",
|
||||
"step": {
|
||||
"user": {
|
||||
"description": "{error}",
|
||||
"description": "See the [troubleshooting steps]({troubleshooting_link}) if you encounter problems. {error}",
|
||||
"data": {
|
||||
"host": "[%key:common::config_flow::data::host%]",
|
||||
"port": "[%key:common::config_flow::data::port%]",
|
||||
|
@ -19,7 +19,7 @@
|
|||
},
|
||||
"error": {
|
||||
"api_error": "API error occurred",
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%], check the IP address of the camera and see the troubleshooting steps in the documentation",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"not_admin": "User needs to be admin, user ''{username}'' has authorisation level ''{userlevel}''",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
|
|
Loading…
Add table
Reference in a new issue