Skip to content

Add mean_type and unit_class to StatisticMetaData to avoid deprecation warnings#1614

Merged
BottlecapDave merged 2 commits into
BottlecapDave:developfrom
ProximusAl:octopus-statistics-fix
Feb 9, 2026
Merged

Add mean_type and unit_class to StatisticMetaData to avoid deprecation warnings#1614
BottlecapDave merged 2 commits into
BottlecapDave:developfrom
ProximusAl:octopus-statistics-fix

Conversation

@ProximusAl
Copy link
Copy Markdown
Contributor

Home Assistant 2025.11+ requires both mean_type and unit_class to be specified when using async_add_external_statistics.

The current implementation in the Octopus Energy integration creates StatisticMetaData without these fields, which results in deprecation warnings and will become a breaking error in HA 2026.11.

This PR updates:

  • custom_components/octopus_energy/statistics/consumption.py
  • custom_components/octopus_energy/statistics/costs.py

to include:

  • mean_type=StatisticMeanType.NONE
  • unit_class=None

in all StatisticMetaData instances.

Behaviour is unchanged: statistics remain sum-only and continue to be imported correctly.

Fixes #1606

@lukewest
Copy link
Copy Markdown

Adding a comment here as I want to know when this is live

@andypiper
Copy link
Copy Markdown

bump
Merging this will close several open (duplicated) issues.

@BottlecapDave BottlecapDave merged commit cc53944 into BottlecapDave:develop Feb 9, 2026
@BottlecapDave
Copy link
Copy Markdown
Owner

Thanks for the update

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: custom integration 'octopus_energy' doesn't specify mean_type when calling async_import_statistics

4 participants