Skip to content

0.1.2

Choose a tag to compare

@dmoo500 dmoo500 released this 17 Apr 04:58
b34e2fe

What's Changed

Bug Fixes

Bug #1last_import set to wrong date
last_import was set to the maximum of all timestamps, including partial data for today. This caused from_date to be set to tomorrow on the next cycle, permanently skipping days for which EKZ had not yet delivered complete data.
Fix: last_import is now set to max_date (the last fully imported day).

Bug #2 — Daily aggregation broken
The groupby key used str(timestamp)[0:10] on EKZ timestamps like 20260407173000, yielding 2026040717 (hourly prefix) instead of 2026-04-07 (date). This produced ~24× more entries than expected and last_import was never advanced.
Fix: Grouping now uses the date field from the API response.

Bug #3max_date detection broken after aggregation fix
After the aggregation fix, the completeness check counted aggregated entries (always 1/day) and expected 24 — max_date was never found.
Fix: Raw 15-min slots are now counted before aggregation. A complete day = 96 slots (92 for DST spring forward, 100 for DST fall back).

New Features

Pending day lookback
EKZ delivers data with a ~7–10 day delay and sometimes back-fills incomplete days. The integration now detects the first incomplete day and re-fetches that range on the next polling cycle — once EKZ delivers the missing slots, the cumulative statistics are corrected automatically.

Prediction sensor
A new sensor sensor.electricity_consumption_ekz_<id>_prediction fills the gap caused by the EKZ data delay:

  • Hourly consumption averages are computed from the raw 15-min slots imported during the historical catch-up phase (bucketed by UTC month + hour)
  • Once catch-up is complete, predicted hourly values are written from the last real data point up to the current time
  • Add the sensor to the HA Energy Dashboard alongside the real consumption sensor to get an up-to-date estimate

After upgrading

Important

Statistics must be reset after upgrading, otherwise cumulative sums will be wrong.

Use the built-in reset action to clear all EKZ statistics and trigger a fresh re-import:

  1. Go to Developer Tools → Actions
  2. Search for ekz_ha.reset_statistics
  3. Select your config entry and press Perform action

The re-import starts automatically and works through your full history in 30-day chunks over the next few polling cycles.

Closes #10