mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
cover
This commit is contained in:
parent
052dfaac5b
commit
e32f76da26
@ -472,6 +472,9 @@ class EsphomeFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
"host": self._host,
|
"host": self._host,
|
||||||
"expected_mac": format_mac(self._reconfig_entry.unique_id),
|
"expected_mac": format_mac(self._reconfig_entry.unique_id),
|
||||||
}
|
}
|
||||||
|
await self._async_validate_mac_abort_configured(
|
||||||
|
format_mac(self.unique_id), self._host, self._port
|
||||||
|
)
|
||||||
for entry in self._async_current_entries(include_ignore=False):
|
for entry in self._async_current_entries(include_ignore=False):
|
||||||
if (
|
if (
|
||||||
entry.entry_id != self._reconfig_entry.entry_id
|
entry.entry_id != self._reconfig_entry.entry_id
|
||||||
@ -485,12 +488,7 @@ class EsphomeFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
if self._reconfig_entry.unique_id != format_mac(self.unique_id):
|
if self._reconfig_entry.unique_id != format_mac(self.unique_id):
|
||||||
if (
|
if self._reconfig_entry.data[CONF_DEVICE_NAME] == self._device_name:
|
||||||
self._reconfig_entry.data[CONF_DEVICE_NAME] == self._device_name
|
|
||||||
and not self.hass.config_entries.async_entry_for_domain_unique_id(
|
|
||||||
self.handler, format_mac(self.unique_id)
|
|
||||||
)
|
|
||||||
):
|
|
||||||
self._entry_with_name_conflict = self._reconfig_entry
|
self._entry_with_name_conflict = self._reconfig_entry
|
||||||
return await self.async_step_name_conflict()
|
return await self.async_step_name_conflict()
|
||||||
return self.async_abort(
|
return self.async_abort(
|
||||||
|
@ -1939,7 +1939,7 @@ async def test_reconfig_name_conflict_other_entry_for_mac(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.ABORT
|
assert result["type"] is FlowResultType.ABORT
|
||||||
assert result["reason"] == "reconfigure_unique_id_changed"
|
assert result["reason"] == "already_configured"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_zeroconf", "mock_setup_entry")
|
@pytest.mark.usefixtures("mock_zeroconf", "mock_setup_entry")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user