Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
8dfb8ebe
Unverified
Commit
8dfb8ebe
authored
7 months ago
by
epenet
Committed by
GitHub
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Use reauth/reconfigure helpers in reolink config flow (#128018)
parent
7b6cac55
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/components/reolink/config_flow.py
+14
-18
14 additions, 18 deletions
homeassistant/components/reolink/config_flow.py
with
14 additions
and
18 deletions
homeassistant/components/reolink/config_flow.py
+
14
−
18
View file @
8dfb8ebe
...
@@ -139,13 +139,10 @@ class ReolinkFlowHandler(ConfigFlow, domain=DOMAIN):
...
@@ -139,13 +139,10 @@ class ReolinkFlowHandler(ConfigFlow, domain=DOMAIN):
self
,
user_input
:
dict
[
str
,
Any
]
|
None
=
None
self
,
user_input
:
dict
[
str
,
Any
]
|
None
=
None
)
->
ConfigFlowResult
:
)
->
ConfigFlowResult
:
"""
Perform a reconfiguration.
"""
"""
Perform a reconfiguration.
"""
config_entry
=
self
.
hass
.
config_entries
.
async_get_entry
(
entry_data
=
self
.
_get_reconfigure_entry
().
data
self
.
context
[
"
entry_id
"
]
self
.
_host
=
entry_data
[
CONF_HOST
]
)
self
.
_username
=
entry_data
[
CONF_USERNAME
]
assert
config_entry
is
not
None
self
.
_password
=
entry_data
[
CONF_PASSWORD
]
self
.
_host
=
config_entry
.
data
[
CONF_HOST
]
self
.
_username
=
config_entry
.
data
[
CONF_USERNAME
]
self
.
_password
=
config_entry
.
data
[
CONF_PASSWORD
]
return
await
self
.
async_step_user
()
return
await
self
.
async_step_user
()
async
def
async_step_dhcp
(
async
def
async_step_dhcp
(
...
@@ -260,17 +257,16 @@ class ReolinkFlowHandler(ConfigFlow, domain=DOMAIN):
...
@@ -260,17 +257,16 @@ class ReolinkFlowHandler(ConfigFlow, domain=DOMAIN):
user_input
[
CONF_USE_HTTPS
]
=
host
.
api
.
use_https
user_input
[
CONF_USE_HTTPS
]
=
host
.
api
.
use_https
mac_address
=
format_mac
(
host
.
api
.
mac_address
)
mac_address
=
format_mac
(
host
.
api
.
mac_address
)
existing_entry
=
await
self
.
async_set_unique_id
(
await
self
.
async_set_unique_id
(
mac_address
,
raise_on_progress
=
False
)
mac_address
,
raise_on_progress
=
False
if
self
.
source
==
SOURCE_REAUTH
:
)
self
.
_abort_if_unique_id_mismatch
()
if
existing_entry
and
self
.
init_step
in
(
return
self
.
async_update_reload_and_abort
(
SOURCE_REAUTH
,
entry
=
self
.
_get_reauth_entry
(),
data
=
user_input
SOURCE_RECONFIGURE
,
)
):
if
self
.
source
==
SOURCE_RECONFIGURE
:
self
.
_abort_if_unique_id_mismatch
()
return
self
.
async_update_reload_and_abort
(
return
self
.
async_update_reload_and_abort
(
entry
=
existing_entry
,
entry
=
self
.
_get_reconfigure_entry
(),
data
=
user_input
data
=
user_input
,
reason
=
f
"
{
self
.
init_step
}
_successful
"
,
)
)
self
.
_abort_if_unique_id_configured
(
updates
=
user_input
)
self
.
_abort_if_unique_id_configured
(
updates
=
user_input
)
...
@@ -286,7 +282,7 @@ class ReolinkFlowHandler(ConfigFlow, domain=DOMAIN):
...
@@ -286,7 +282,7 @@ class ReolinkFlowHandler(ConfigFlow, domain=DOMAIN):
vol
.
Required
(
CONF_PASSWORD
,
default
=
self
.
_password
):
str
,
vol
.
Required
(
CONF_PASSWORD
,
default
=
self
.
_password
):
str
,
}
}
)
)
if
self
.
_host
is
None
or
self
.
init_step
==
SOURCE_RECONFIGURE
or
errors
:
if
self
.
_host
is
None
or
self
.
source
==
SOURCE_RECONFIGURE
or
errors
:
data_schema
=
data_schema
.
extend
(
data_schema
=
data_schema
.
extend
(
{
{
vol
.
Required
(
CONF_HOST
,
default
=
self
.
_host
):
str
,
vol
.
Required
(
CONF_HOST
,
default
=
self
.
_host
):
str
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment