English · Česky
A Home Assistant integration that finds and corrects meter glitches in the long-term energy statistics.
Status: first draft (v0.1.0), not yet run inside Home Assistant.
When an energy meter briefly reports zero, or goes unavailable and comes back, Home Assistant treats the return to the real reading as newly produced or consumed energy. One hour then holds the whole lifetime reading of the meter, and the Energy dashboard shows thousands of kWh for that day, month and year.
- Scans the hourly statistics of the sensors used by the Energy dashboard (or the sensors you choose).
- Flags every hour that holds more energy than your installation could physically deliver in the time it covers. The limit is a power in kW (set it to your main breaker, for example 25; the default is 100). After a sensor outage the first hour back holds everything measured meanwhile, so it is allowed the limit for every hour of the outage and is not treated as a glitch.
- Corrects a flagged hour to an estimate instead of zero: the median of the same hour of day on the three days before and after. A solar meter that glitched at night gets about zero, a house meter its usual load. The correction itself is the same operation as Developer tools → Statistics → Adjust sum.
- Keeps a history of its fixes, so each one can be undone.
| Mode | Behaviour |
|---|---|
| Manual (default) | Glitches are reported in a notification and wait until you press Fix found glitches. |
| Automatic | Glitches found by the regular scan of the last days are corrected right away. Findings from a whole-history scan still wait for the button. |
Glitches to fix: number waiting, with the list in its attributesFixes made: number of corrections, with the list in its attributesScan whole history,Show found glitches,Fix found glitches,Undo last fix: buttons
The Show found glitches button lists the waiting glitches in a notification: meter, hour, bogus energy and the estimate that replaces it.
For a permanent overview on a dashboard, add a Markdown card (find the entity ID on the integration page):
type: markdown
title: Statistics glitches
content: "{{ state_attr('sensor.statistics_guard_glitches_to_fix', 'report') }}"The Fixes made sensor has the same report attribute.
Services statistics_guard.scan, fix, undo and ignore do the same for automations; fix, undo and ignore accept one issue_id.
- HACS → ⋮ → Custom repositories → add this repository, type Integration.
- Download Statistics Guard and restart Home Assistant.
- Settings → Devices & services → Add integration → Statistics Guard.
- Only energy statistics (kWh, Wh, MWh …) are checked.
- The energy of a corrected hour is an estimate, not a measurement.
- A correction changes recorded history. Start in manual mode and review what is found.