Repository navigation
v1.2.11 - Restore automatic energy realignment (verified restart-safe)
Restore
1.2.10 reverted the automatic energy realignment out of caution after a spike report. After a careful, adversarial reading of Home Assistant's statistics compilation source, the realignment is confirmed stable across restarts, so this restores it.
Why it is safe, from Home Assistant's source
- The realignment adds a constant to the
sumcolumn of both the short-term and long-term statistics tables. - On every compile, Home Assistant re-seeds the running total from the latest short-term row read back from the database, then only adds state deltas. So the constant offset is preserved across restarts and is never recomputed from the raw sensor reading.
- The adjustment and compilation run one at a time on the same recorder thread, so they cannot race.
What you get
Importing older energy history in front of a sensor that already has statistics produces one continuous, correct series: correct first hour, correct hourly, daily and lifetime totals, no spike, no manual correction. Safe to re-run.
Important: spikes after a restart are a separate issue
If you see spikes reappear after a Home Assistant restart or update, that is a well-known behavior where some sensors (solar inverters especially) briefly report 0 during the restart, and Home Assistant counts the jump back up as consumption. This happens with or without this integration, and no statistics fix can prevent it. The durable fix is to make the sensor report unavailable instead of 0 during restarts, then point the Energy dashboard at that clean sensor. Details are in the README and on issue #9.