Skip to content

Load Forecast (24×7 Profile)

Choose a tag to compare

@hoizi89 hoizi89 released this 22 Apr 09:44

🔮 New: Load Forecast (24×7 Profile)

The missing piece for truly smart charging. Until now the Auto-Charge logic used a fixed PV threshold — helpful, but blind to how much electricity you'll actually need tomorrow. With v4.0 the integration learns your consumption pattern and exposes 5 new sensors so you (or the logic) can decide "charge from the grid tonight, or will PV tomorrow be enough?".

✨ 5 new sensors

Sensor Returns
sensor.*_verbrauch_prognose_1h next hour (kWh)
sensor.*_verbrauch_prognose_6h next 6 h
sensor.*_verbrauch_prognose_heute_rest rest of today
sensor.*_verbrauch_prognose_morgen tomorrow full day — with forecast_hourly array
sensor.*_verbrauch_prognose_24h rolling 24 h — with confidence_low/high

All under a new sub-device "[Name] Load Forecast".

🧮 How it works

  • Data source: your existing consumption_entity, pulled hourly from HA's built-in recorder.statistics_during_period API — no external service, no ML, no containers.
  • 24×7 matrix: per (hour-of-day, weekday) cell, rolling mean over 2/4/6 weeks. Monday 07:00 ≠ Saturday 07:00.
  • Modal-drop (on by default): drops the highest + lowest value per cell — cleans out holidays, outages, one-off EV sessions.
  • Optional HP/EV subtraction: configure heat-pump / wallbox total-energy sensors → clean base-load forecast.
  • Graceful fallbacks: <14 days → 7-day mean. <3 days → persistence. No data → unavailable.

Typical accuracy (MAPE) at 24 h horizon: 18–30 % — same class as Predbat / EMHASS internals, zero setup.

🔗 Pairing with Auto-Charge (template example)

Until a first-class "dynamic threshold" option lands, shape the existing Auto-Charge via a template. Example — charge only if tomorrow's expected load exceeds expected solar by > 5 kWh:

template:
  - binary_sensor:
      - name: "Battery should grid-charge tonight"
        state: >
          {% set load = states('sensor.pv_management_verbrauch_prognose_morgen') | float(0) %}
          {% set solar = state_attr('sensor.solcast_pv_forecast_forecast_tomorrow','total_kwh') | float(0) %}
          {{ (load - solar) > 5 }}

Plug that into your Auto-Charge automation in place of the static PV-threshold check.

🎛️ How to enable

Settings → Devices & Services → PV Management Spot → Configure → Lastvorhersage

  1. Toggle Enable load forecast on
  2. Pick History window (4 weeks = sweet spot)
  3. Optionally point to Heat pump / EV charger total-energy sensors

Rebuild runs once per hour in the background. Never blocks the event loop.

🛡️ Safety

  • Fully opt-in — default off. Existing Auto-Charge + Discharge logic untouched.
  • No breaking changes to existing sensors, config, or entity IDs.
  • No new dependencies (requirements stays empty).
  • All errors logged as warnings, never crash the integration.

🎯 What's next

Planned for a future release: a built-in binary-sensor that combines this forecast with Solcast + EPEX for an explicit charge/discharge recommendation — replacing the manual template above. v4.0 ships the building blocks.


Full Changelog: v3.31.0...v4.0.0