Skip to content

Commit

Permalink
Fix race when disabling config entries (#47210)
Browse files Browse the repository at this point in the history
* Fix race when disabling config entries

* Remove unused constant
  • Loading branch information
emontnemery authored and balloob committed Mar 2, 2021
1 parent ea65f61 commit b2a3c35
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions homeassistant/config_entries.py
Expand Up @@ -69,8 +69,6 @@
ENTRY_STATE_NOT_LOADED = "not_loaded"
# An error occurred when trying to unload the entry
ENTRY_STATE_FAILED_UNLOAD = "failed_unload"
# The config entry is disabled
ENTRY_STATE_DISABLED = "disabled"

UNRECOVERABLE_STATES = (ENTRY_STATE_MIGRATION_ERROR, ENTRY_STATE_FAILED_UNLOAD)

Expand Down Expand Up @@ -802,11 +800,14 @@ async def async_set_disabled_by(
entry.disabled_by = disabled_by
self._async_schedule_save()

# Unload the config entry, then fire an event
reload_result = await self.async_reload(entry_id)

self.hass.bus.async_fire(
EVENT_CONFIG_ENTRY_DISABLED_BY_UPDATED, {"config_entry_id": entry_id}
)

return await self.async_reload(entry_id)
return reload_result

@callback
def async_update_entry(
Expand Down

0 comments on commit b2a3c35

Please sign in to comment.