mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Address late review of AsusWRT unique id PR (#71281)
This commit is contained in:
parent
9e2f0b3af1
commit
ee8eac10c9
@ -149,10 +149,10 @@ class AsusWrtFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle a flow initiated by the user."""
|
"""Handle a flow initiated by the user."""
|
||||||
|
|
||||||
# if exist one entry without unique ID, we abort config flow
|
# if there's one entry without unique ID, we abort config flow
|
||||||
for unique_id in self._async_current_ids():
|
for unique_id in self._async_current_ids():
|
||||||
if unique_id is None:
|
if unique_id is None:
|
||||||
return self.async_abort(reason="not_unique_id_exist")
|
return self.async_abort(reason="no_unique_id")
|
||||||
|
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self._show_setup_form(user_input)
|
return self._show_setup_form(user_input)
|
||||||
@ -188,7 +188,7 @@ class AsusWrtFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_abort(reason="invalid_unique_id")
|
return self.async_abort(reason="invalid_unique_id")
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"This device do not provide a valid Unique ID."
|
"This device does not provide a valid Unique ID."
|
||||||
" Configuration of multiple instance will not be possible"
|
" Configuration of multiple instance will not be possible"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"invalid_unique_id": "Impossible to determine a valid unique id for the device",
|
"invalid_unique_id": "Impossible to determine a valid unique id for the device",
|
||||||
"not_unique_id_exist": "A device without a valid unique id is already configured. Configuration of multiple instance is not possible"
|
"no_unique_id": "A device without a valid unique id is already configured. Configuration of multiple instance is not possible"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"abort": {
|
"abort": {
|
||||||
"invalid_unique_id": "Impossible to determine a valid unique id for the device",
|
"invalid_unique_id": "Impossible to determine a valid unique id for the device",
|
||||||
"not_unique_id_exist": "A device without a valid unique id is already configured. Configuration of multiple instance is not possible",
|
"no_unique_id": "A device without a valid unique id is already configured. Configuration of multiple instance is not possible"
|
||||||
"single_instance_allowed": "Already configured. Only a single configuration possible."
|
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"cannot_connect": "Failed to connect",
|
"cannot_connect": "Failed to connect",
|
||||||
@ -44,4 +43,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -169,7 +169,7 @@ async def test_abort_if_not_unique_id_setup(hass):
|
|||||||
data=CONFIG_DATA,
|
data=CONFIG_DATA,
|
||||||
)
|
)
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||||
assert result["reason"] == "not_unique_id_exist"
|
assert result["reason"] == "no_unique_id"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("connect")
|
@pytest.mark.usefixtures("connect")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user