Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear stage on unload #2489

Merged
merged 2 commits into from
Feb 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion custom_components/hacs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool:

async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Set up this integration using UI."""
config_entry.add_update_listener(async_reload_entry)
config_entry.async_on_unload(config_entry.add_update_listener(async_reload_entry))
return await async_initialize_integration(hass=hass, config_entry=config_entry)


Expand All @@ -191,7 +191,9 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->

unload_ok = await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)

await hacs.async_set_stage(None)
hacs.disable_hacs(HacsDisabledReason.REMOVED)

hass.data.pop(DOMAIN, None)

return unload_ok
Expand Down