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

Fix async_unload_entry #51

Merged
merged 2 commits into from
Nov 2, 2023
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
5 changes: 3 additions & 2 deletions custom_components/midea_ac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,15 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
"""Unload a config entry."""
# Remove the coordinator from global data
try:
hass.data[DOMAIN].pop(config_entry.data[CONF_ID])
hass.data[DOMAIN].pop(config_entry.entry_id)
except KeyError:
_LOGGER.warning("Failed remove device from global data.")

await hass.config_entries.async_forward_entry_unload(config_entry, "climate")
await hass.config_entries.async_forward_entry_unload(config_entry, "sensor")
await hass.config_entries.async_forward_entry_unload(config_entry, "switch")
await hass.config_entries.async_forward_entry_unload(config_entry, "binary_sensor")
await hass.config_entries.async_forward_entry_unload(config_entry, "switch")
await hass.config_entries.async_forward_entry_unload(config_entry, "number")

return True

Expand Down