[Custom Integration] Energy Dispatcher — when should a load run, and on which energy source?

Hi all,

I’ve been working on a custom integration called Energy Dispatcher and wanted to share it here for feedback.

The idea

Many of us have controllable loads — dehumidifiers, pool pumps, EV chargers, water heaters — where when and how they run depends on energy conditions:

  • Is the house exporting surplus solar?
  • Is grid power cheap right now (or in the next hours)?
  • Should we avoid high import because of a power guard / hourly limit?

Usually this logic ends up scattered across automations, templates, and helpers. Energy Dispatcher centralises the energy decision and leaves device control to your existing automations.

For each load it answers:

Should this load run now, and with which energy source?

Example output:

energy_dispatcher.dehumidifier

state: ON

energy_mode: SOLAR

Your automation then decides what that means for the device — humidity setpoint, heating mode, charging current, etc.

Separation of concerns

Energy Dispatcher Your automations
Spot price evaluation Device setpoints
Grid import/export state Operating modes
Self-consumption vs export economics Physical on/off control
Optional power guard
Run / don’t-run recommendation

That keeps energy logic in one place and automations simple.

Features (current)

  • Generic spot price sensor — works with Nord Pool, Tibber, Amber, etc. (today + tomorrow when available)
  • Grid import & export sensors (W) for surplus detection and power guard
  • Per-load rules — allowed price levels, required power, optional minimum runtime (daily/weekly)
  • Self-consumption (SOLAR mode) — recommend running on export when export revenue is below a threshold
  • Runtime scheduling — missing daily/weekly minutes scheduled on cheapest allowed hours
  • Power guard — optional hourly import limit (kWh) with WARNING / CRITICAL states
  • Services — manual override, clear override, force recalculate
  • Hub architecture — one global config entry; each load is a subentry with its own entity

Each load gets an entity like energy_dispatcher.<load_id> with attributes such as energy_mode, reason, reason_text, next_opportunity, and grid_state.

Example automation

action:

  • choose:

  • conditions:

  • condition: template

value_template: “{{ state_attr(‘energy_dispatcher.dehumidifier’, ‘energy_mode’) == ‘SOLAR’ }}”

sequence:

  • action: humidifier.set_humidity

data:

humidity: 50

  • conditions:

  • condition: template

value_template: “{{ state_attr(‘energy_dispatcher.dehumidifier’, ‘energy_mode’) == ‘GRID_CHEAP’ }}”

sequence:

  • action: humidifier.set_humidity

data:

humidity: 65

Installation (HACS)

  1. HACS → Integrations → ⋮ → Custom repositories
  2. Add: https://github.com/mberglundmx/ha-energy-dispatcher
  3. Category: Integration
  4. Install Energy Dispatcher, restart HA
  5. Settings → Devices & services → Add integration → Energy Dispatcher
  6. Add loads from the integration page (Add load)

Requires Home Assistant 2025.7+ (config subentries).

Status & scope

This is early-stage (v0.1.12). It works well for independent load decisions, but deliberately does not do global load prioritisation or capacity allocation between loads — that stays in your automations.

Planned direction includes DSO-specific power guard strategies (e.g. Ellevio-style peak billing), but the current power guard is a simple hourly kWh limit.

Links

I’d love feedback on the concept, config UX, and real-world use cases. If you try it, please share what loads you’re dispatching and what price/export sensors you’re using.

Thanks!