Fix recorder/import_statistics metadata deprecation (HA Core 2026.11) - #191
Open
antoinevalentinHA wants to merge 1 commit into
Open
Conversation
Home Assistant deprecated calling recorder/import_statistics without mean_type and unit_class in metadata since HA Core 2025.11; these fields become mandatory in HA Core 2026.11. Add both fields to the imported statistics metadata: - mean_type: 0 (StatisticMeanType.NONE) since Linky statistics are cumulative sums (energy / costs) with no averaging. Complements the now-deprecated has_mean: false, which is kept for backward compatibility. - unit_class: 'energy' for Wh consumption/production stats; null for monetary cost stats (€), which have no HA unit conversion class. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
antoinevalentinHA
added a commit
to antoinevalentinHA/ha-linky
that referenced
this pull request
Jul 2, 2026
Document fork-specific changes in CHANGELOG.md under a dedicated "Fork changes — Antoine Valentin" section, clearly separated from upstream releases: the upstream-candidate Recorder metadata fix (PR bokub#191), the fork-only add-on identification and local-build adaptations, runtime validation, and rollback notes. Documentation only; no functional files changed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
I am running this and it works - stats are still present and the Merci! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Home Assistant now warns when
recorder/import_statisticsis called withoutmean_typeandunit_classin metadata.Fixes #161.
Fixes #182.
The imported Linky statistics are cumulative sums, not averages, so this PR adds:
mean_type: 0unit_class: 'energy'for Wh-based energy statisticsunit_class: nullfor cost statistics in €The existing
has_mean: falsefield is kept for backward compatibility with older Home Assistant versions.This does not change:
Validation:
recorder/import_statisticsmean_typeandunit_classare now included in the metadataContext:
Home Assistant deprecated metadata without
mean_typeandunit_class; the current behavior triggers daily Recorder warnings and is expected to stop working in HA Core 2026.11.