diff --git a/custom_components/auto_backup/__init__.py b/custom_components/auto_backup/__init__.py index edeaca7..ab7c95d 100644 --- a/custom_components/auto_backup/__init__.py +++ b/custom_components/auto_backup/__init__.py @@ -281,7 +281,7 @@ async def new_snapshot(self, data, full=False): # add to pending snapshots and update sensor. self._pending_snapshots = 1 - if (self.update_sensor_callback): + if self.update_sensor_callback: self.update_sensor_callback() # make request to create new snapshot. @@ -345,7 +345,7 @@ async def new_snapshot(self, data, full=False): # remove from pending snapshots and update sensor. self._pending_snapshots = 0 - if (self.update_sensor_callback): + if self.update_sensor_callback: self.update_sensor_callback() # purging old snapshots @@ -376,6 +376,12 @@ async def purge_snapshots(self): f"{DOMAIN}.purged_snapshots", {"snapshots": snapshots_purged} ) + # update sensor after purge. + if self.update_sensor_callback: + self.update_sensor_callback() + else: + _LOGGER.debug("No snapshots required purging.") + async def _purge_snapshot(self, slug): """Purge an individual snapshot from Hass.io.""" _LOGGER.debug("Attempting to remove snapshot: %s", slug)