Skip to content

v4.3.3 - Fix Negative Statistics Spikes

Pre-release
Pre-release

Choose a tag to compare

@ergo5 ergo5 released this 25 Jan 21:17

Bug Fix

Fixes massive negative spikes (~-25,000 kWh) on Energy Dashboard

Root Cause

Blocking database call in sync callback context was failing silently in Python 3.13+ / HA 2024.x+, causing statistics to reset to sum=0.

Changes

  • Move get_last_statistics() from sync callback to async Coordinator
  • Use pre-fetched stats to avoid blocking calls
  • Implement backward calculation from anchor
  • Add data_updater.py with clean architecture

After Update

Clear statistics and re-import history:

  1. Integration Options → Clear Stats
  2. Integration Options → Fetch History (5+ days)