Skip to content

RuntimeError: Detected code that doesn't specify mean_type when calling async_import_statistics #86

@sergi039

Description

@sergi039

After upgrading to Home Assistant 2024.12+, the integration throws a RuntimeError when importing historical statistics. The error indicates that
mean_type parameter is not specified when calling async_import_statistics.

Additionally, warnings appear: found some weird values in historical statistics

To Reproduce

  1. Install ha-ideenergy via HACS
  2. Configure integration with valid i-DE credentials
  3. Wait for data refresh
  4. Check logs - see RuntimeError

Logs
2025-12-11 14:53:55.248 WARNING (MainThread) [custom_components.ideenergy.sensor] sensor.es0021000001395653px_historical_consumption: found some weird
values in historical statistics
2025-12-11 14:53:55.264 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 192, in report_usage
...
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 388, in _report_usage_no_integration
raise RuntimeError(msg) from err
RuntimeError: Detected code that doesn't specify mean_type when calling async_import_statistics. Please report this issue

2025-12-11 14:53:55.624 WARNING (MainThread) [custom_components.ideenergy.sensor] sensor.es0021000001395653px_historical_generation: found some weird
values in historical statistics

Environment

  • HomeAssistant version: 2024.12.x (check your version in Settings → About)
  • ideenergy integration version: 2025.2.0
  • Installation method: HACS
  • i-de.es advanced user: yes
  • Did I read the FAQ: yes
  • Did I enable debug before posting any log: yes

Expected behavior
Historical statistics should be imported without errors.

Additional context
This appears to be a breaking change in Home Assistant's statistics API. The async_import_statistics function now requires a mean_type parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions