Skip to content

Commit

Permalink
Handle cleanup of config entry
Browse files Browse the repository at this point in the history
  • Loading branch information
natekspencer committed Jun 22, 2024
1 parent 88949f3 commit 88995b5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions custom_components/tapo_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
LOGGER.debug("Deleting hot storage files for entity " + entry_id + "...")
deleteDir(hotDirPath)

# Remove the entry data
hass.data[DOMAIN].pop(entry_id, None)

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
if PYTAPO_REQUIRED_VERSION != PYTAPO_VERSION:
Expand Down Expand Up @@ -513,10 +515,12 @@ async def async_update_data():
and hass.data[DOMAIN][entry.entry_id]["mediaSyncScheduled"] is False
):
hass.data[DOMAIN][entry.entry_id]["mediaSyncScheduled"] = True
async_track_time_interval(
hass,
mediaSync,
timedelta(seconds=60),
entry.async_on_unload(
async_track_time_interval(
hass,
mediaSync,
timedelta(seconds=60),
)
)
elif (
hass.data[DOMAIN][entry.entry_id]["initialMediaScanRunning"]
Expand Down

0 comments on commit 88995b5

Please sign in to comment.