Skip to content

Commit 7099064

Browse files
authored
Mark config-flow as done in SFR Box IQS (home-assistant#157439)
1 parent 2f7d74f commit 7099064

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

homeassistant/components/sfr_box/config_flow.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ class SFRBoxFlowHandler(ConfigFlow, domain=DOMAIN):
3939

4040
VERSION = 1
4141
_box: SFRBox
42-
_config: dict[str, Any] = {}
42+
43+
def __init__(self) -> None:
44+
"""Initialize SFR Box flow."""
45+
self._config: dict[str, Any] = {}
4346

4447
async def async_step_user(
4548
self, user_input: dict[str, str] | None = None
4649
) -> ConfigFlowResult:
4750
"""Handle a flow initialized by the user."""
4851
errors = {}
4952
if user_input is not None:
53+
self._async_abort_entries_match({CONF_HOST: user_input[CONF_HOST]})
5054
box = SFRBox(
5155
ip=user_input[CONF_HOST], client=async_get_clientsession(self.hass)
5256
)
@@ -60,7 +64,6 @@ async def async_step_user(
6064
assert system_info is not None
6165
await self.async_set_unique_id(system_info.mac_addr)
6266
self._abort_if_unique_id_configured()
63-
self._async_abort_entries_match({CONF_HOST: user_input[CONF_HOST]})
6467
self._box = box
6568
self._config.update(user_input)
6669
return await self.async_step_choose_auth()

homeassistant/components/sfr_box/quality_scale.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
rules:
2-
# Special note, doesn't fall in any of the categories below
3-
# Why can the coordinator state be None? As in, I understand that it can be None if it doesn't support it, but wouldn't these coordinators not be created at all?
4-
52
## Bronze
6-
config-flow:
7-
status: todo
8-
comment: |
9-
SFRBoxFlowHandler has a classvar _config. This can be dangerous
10-
self._async_abort_entries_match({CONF_HOST: user_input[CONF_HOST]}) can be tested at the first if statement
3+
config-flow: done
114
test-before-configure: done
125
unique-config-entry: done
136
config-flow-test-coverage:

0 commit comments

Comments
 (0)