Ensure flux_led does not try to reload while setup is in progress (#86122)

There was a discovery race in flux_led that could trigger
it to try to reload while in progress if the device data
changed
This commit is contained in:
J. Nick Koston 2023-01-17 11:51:04 -10:00 committed by GitHub
parent cc74fcbda7
commit b722a7e05b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,8 +121,12 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async_update_entry_from_discovery( async_update_entry_from_discovery(
self.hass, entry, device, None, allow_update_mac self.hass, entry, device, None, allow_update_mac
) )
or entry.state == config_entries.ConfigEntryState.SETUP_RETRY and entry.state
): not in (
config_entries.ConfigEntryState.SETUP_IN_PROGRESS,
config_entries.ConfigEntryState.NOT_LOADED,
)
) or entry.state == config_entries.ConfigEntryState.SETUP_RETRY:
self.hass.async_create_task( self.hass.async_create_task(
self.hass.config_entries.async_reload(entry.entry_id) self.hass.config_entries.async_reload(entry.entry_id)
) )