Skip to content

Commit

Permalink
use snapshots for statistics and add hard limit for historical stats
Browse files Browse the repository at this point in the history
  • Loading branch information
jb101010-2 committed Dec 4, 2024
1 parent b6e29e8 commit 5b9966b
Show file tree
Hide file tree
Showing 3 changed files with 6,794 additions and 37 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/suez_water/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ async def _update_statistics(self, current_price: float) -> None:
if cost_last_stat is not None:
if cost_last_stat["sum"] is not None and cost_last_stat["sum"] is not None:
cost_sum = cost_last_stat["sum"]
if last_stats is None:
last_stats = datetime.now().date()
last_stats = last_stats.replace(year=last_stats.year - 2)

_LOGGER.debug(
"Updating suez stat since %s for %s",
Expand Down
Loading

0 comments on commit 5b9966b

Please sign in to comment.