Skip to content

Commit

Permalink
Only remove update listener when unload was succesfull (#276)
Browse files Browse the repository at this point in the history
Signed-off-by: Mick Vleeshouwer <[email protected]>
  • Loading branch information
iMicknl authored Oct 5, 2020
1 parent 4ba6694 commit 17d8a9b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions custom_components/tahoma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ async def handle_execute_command(call):

async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""

hass.data[DOMAIN][entry.entry_id]["update_listener"]()
entities_per_platform = hass.data[DOMAIN][entry.entry_id]["entities"]

unload_ok = all(
Expand All @@ -185,6 +183,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
)

if unload_ok:
hass.data[DOMAIN][entry.entry_id]["update_listener"]()
hass.data[DOMAIN].pop(entry.entry_id)

return unload_ok
Expand Down

0 comments on commit 17d8a9b

Please sign in to comment.