Fix flux_led ignored entries not being respected (#76173)
This commit is contained in:
parent
b2dc810ea4
commit
02ad4843b8
2 changed files with 52 additions and 19 deletions
|
@ -105,27 +105,33 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
assert mac_address is not None
|
||||
mac = dr.format_mac(mac_address)
|
||||
await self.async_set_unique_id(mac)
|
||||
for entry in self._async_current_entries(include_ignore=False):
|
||||
if entry.data[CONF_HOST] == device[ATTR_IPADDR] or (
|
||||
entry.unique_id
|
||||
and ":" in entry.unique_id
|
||||
and mac_matches_by_one(entry.unique_id, mac)
|
||||
for entry in self._async_current_entries(include_ignore=True):
|
||||
if not (
|
||||
entry.data.get(CONF_HOST) == device[ATTR_IPADDR]
|
||||
or (
|
||||
entry.unique_id
|
||||
and ":" in entry.unique_id
|
||||
and mac_matches_by_one(entry.unique_id, mac)
|
||||
)
|
||||
):
|
||||
if (
|
||||
async_update_entry_from_discovery(
|
||||
self.hass, entry, device, None, allow_update_mac
|
||||
)
|
||||
or entry.state == config_entries.ConfigEntryState.SETUP_RETRY
|
||||
):
|
||||
self.hass.async_create_task(
|
||||
self.hass.config_entries.async_reload(entry.entry_id)
|
||||
)
|
||||
else:
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
FLUX_LED_DISCOVERY_SIGNAL.format(entry_id=entry.entry_id),
|
||||
)
|
||||
continue
|
||||
if entry.source == config_entries.SOURCE_IGNORE:
|
||||
raise AbortFlow("already_configured")
|
||||
if (
|
||||
async_update_entry_from_discovery(
|
||||
self.hass, entry, device, None, allow_update_mac
|
||||
)
|
||||
or entry.state == config_entries.ConfigEntryState.SETUP_RETRY
|
||||
):
|
||||
self.hass.async_create_task(
|
||||
self.hass.config_entries.async_reload(entry.entry_id)
|
||||
)
|
||||
else:
|
||||
async_dispatcher_send(
|
||||
self.hass,
|
||||
FLUX_LED_DISCOVERY_SIGNAL.format(entry_id=entry.entry_id),
|
||||
)
|
||||
raise AbortFlow("already_configured")
|
||||
|
||||
async def _async_handle_discovery(self) -> FlowResult:
|
||||
"""Handle any discovery."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue