Skip to content

Commit

Permalink
Try try again
Browse files Browse the repository at this point in the history
  • Loading branch information
Lash-L committed Nov 11, 2024
1 parent 46e5156 commit aa568bb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions custom_components/bermuda/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def __init__(

self.devices: dict[str, BermudaDevice] = {}
# self.updaters: dict[str, BermudaPBDUCoordinator] = {}

self._has_purged = False
self._purge_task = hass.loop.call_soon_threadsafe(hass.async_create_task, self.purge_redactions(hass))
self.area_reg = ar.async_get(hass)

Expand Down Expand Up @@ -1298,12 +1298,17 @@ async def purge_redactions(self, hass: HomeAssistant):
cancel_on_shutdown=True,
),
)
self._has_purged = True

async def stop_purging(self):
"""Stop purging. There might be a better way to do this?."""
if self._purge_task:
self._purge_task() # This cancels the async_call_later task
self._purge_task = None
if self._has_purged:
self._purge_task() # This cancels the async_call_later task
self._purge_task = None
else:
self._purge_task.cancel()
self._purge_task = None

def redact_data(self, data):
"""
Expand Down

0 comments on commit aa568bb

Please sign in to comment.