Skip to content

Commit

Permalink
Fix error when unloading config entry
Browse files Browse the repository at this point in the history
  • Loading branch information
amosyuen committed Mar 7, 2022
1 parent 1ed7c5e commit a14c935
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions custom_components/tplink_deco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):

async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Handle removal of an entry."""
coordinator = hass.data[DOMAIN][config_entry.entry_id]
if coordinator is not None:
await coordinator.async_close()
data = hass.data[DOMAIN][config_entry.entry_id]
deco_coordinator = data.get(COORDINATOR_DECOS_KEY)
clients_coordinator = data.get(COORDINATOR_CLIENTS_KEY)
if deco_coordinator is not None:
await deco_coordinator.async_close()
if clients_coordinator is not None:
await clients_coordinator.async_close()

unloaded = all(
await asyncio.gather(
Expand Down

0 comments on commit a14c935

Please sign in to comment.