[App][Pro] Energy Allocator

Your home uses energy from several places at once - the grid, solar panels, and a home battery. This app looks at the meters you already have and works out how much of each device’s energy came from the grid, from solar, and from the battery.

To do this, it needs permission to manage other devices, so it can read their energy meters (meter_power). Homey will ask you to approve this when you install the app.

Contribute

If you enjoy what I do, consider supporting me on Ko-fi or Paypal! Every little bit means the world!

ko-fi

paypal-donate

How it works

Every 5 minutes, the app reads your grid, solar, and battery meters, plus the meters of the devices you’re following, and splits each device’s usage the same way the house’s energy balances:

solar + grid import + battery discharge = house use + grid export + battery charge

If a meter looks reset, the numbers don’t add up, or Homey or the app restarts mid-interval, that reading is skipped rather than guessed. Cumulative totals can then lag very slightly behind reality, but the Grid allocation / Self-sufficiency percentages aren’t affected, since they’re smoothed and self-correcting.

What you need

  • A grid meter that reports imported energy (required). Exported energy is optional - leave it unset if your meter doesn’t report it, or you don’t export any.
  • Solar and/or battery meters (optional) - add as many as you have.
  • Devices to follow, each with its own energy meter (most smart plugs, EV chargers, heat pumps, etc. have one).

Two kinds of devices

  • Device Energy Allocation - follows one meter, or (in summary mode) several meters added together, e.g. three heating circuits combined into one “Heating” device.
  • Whole House Energy Allocation - one device for the whole home’s split, no matter which devices you’re following. Add it once.

Setting it up

  1. Open the app’s Settings. Choose your grid meter’s import capability (and export, if it has one). Add your solar and/or battery meters the same way.
  2. Add a Whole House Energy Allocation device for the household total, and/or one or more Device Energy Allocation devices for specific appliances. Pairing asks you to pick individual or summary mode, then the meter(s) to follow.
  3. Picked the wrong device or meter? No need to delete and start over - use Repair on the device to change it. Nothing resets; the totals keep counting from the new source.

What you’ll get

Each device shows:

  • Its grid, solar, and battery energy (kWh), plus a total (Device Energy Allocation only). The battery figure is just energy that left the battery; its original grid/solar mix isn’t tracked here.
  • Grid allocation and Self-sufficiency (%): What share of a device’s energy over the last 30 minutes came from the grid versus from solar and/or the battery. Self-sufficiency is just 100% minus Grid allocation; both are smoothed over that window so they don’t jump around.
  • “Energy share changed” and “Energy allocation changed” Flow triggers.
  • A “Reset allocation meters” maintenance action (in the device’s menu) to set its counters back to zero.
  • Repair (also in the device’s menu) to change which meter(s) it follows without losing its totals.

Useful links

Hints and FAQ

Do I need solar panels or a battery to use this?

Only a grid meter with an imported-energy counter is strictly required to set up the app, but without at least solar or a battery configured there’s nothing to split - every device would simply show 100% grid. Solar and battery are optional; their capabilities only appear on a device once you’ve added at least one such source in Settings.

My grid meter doesn't report exported energy - is that a problem?

Leave that field empty in Settings and it’s treated as zero. Grid import alone is enough to correctly track grid-sourced consumption. The only downside is during periods where your solar or battery actually export surplus to the grid: without an export reading, that surplus gets counted as if the house used it, slightly inflating solar/battery’s apparent share at those times. If you rarely or never export (no solar, or a small self-consuming system), this makes no practical difference.

Why do I have to manually pick a capability instead of the app finding it automatically?

Capability ids for import, export, production, charge and discharge energy aren’t standardized across drivers - for example, some P1 meter apps use different ids for the same thing. You map each role once, to whichever capability your specific device exposes.

What's the difference between 'Device Energy Allocation' and 'Whole House Energy Allocation'?

Device Energy Allocation follows one or more specific counters and works out where that energy came from. Whole House Energy Allocation is a single device reflecting the entire home’s split, regardless of which individual devices you’re tracking.

What's 'Individual' vs. 'Summary' mode?

Individual creates one allocator per counter you select - a separate tile per appliance. Summary creates a single device that adds several counters together first, for one combined tile.

Can I add the same device or counter more than once?

Yes, on purpose - for example to feed two differently-named allocators, or to include one counter in more than one summary device.

I picked the wrong device/counter - do I have to delete and re-pair?

No - open the device’s settings and choose Repair. You can reselect the source(s); running totals aren’t reset, they simply continue from the new source. Repair can’t change individual/summary mode, only the source(s).

Why don't these numbers show up in Homey's Energy tab?

On purpose - see “What you’ll get” in the overview post. They’re estimates derived from meters Homey already counts, so including them too would double count.

A device shows 0 right after I add it, or after changing Settings

The app samples every 5 minutes. The very first sample after startup, pairing, or a settings change only establishes a starting point - real numbers appear from the sample after that.

My meter reports in coarse steps (e.g. 0.1 kWh) and I see gaps

At very low power, a coarse meter may not tick within one 5-minute sample, so that interval is skipped rather than guessed. Nothing is lost from the meters themselves - the next interval catches up as soon as a real change is seen.

What do 'Grid allocation' and 'Self-sufficiency' mean?

Grid allocation is the percentage of a device’s recent consumption (smoothed over the last 30 minutes) that came from the grid. Self-sufficiency is the rest - the percentage that came from solar and/or the battery.

How do I get notified when the split changes?

Use the “Energy allocation changed” Flow trigger - set how many percentage points it must move before firing in Settings. For a plain threshold check (“is grid allocation above 50%?”), use Homey’s own Logic card with the “Grid allocation” or “Self-sufficiency” number token; no separate condition card is needed for that.

TODO / Features requested

  • Per-device source overrides - right now, all allocators share one house-wide source configuration (one grid meter, one set of solar/battery meters) set in the app settings. Letting an individual allocator override part of that is being considered for a future version.
  • More Flow cards, as requests come in - let us know in this topic what you’d find useful.

Known issues

  • The app has been tested on my own setup, but not across every meter and driver combination out there. If something looks off, please report it in this topic with your meter setup.

Cool will this solve this?

Energy tab and a trading home battery: consumption and cost don’t add up

My setup: Homey Energy Dongle (P1), Solis inverter, Zonneplan home battery,
dynamic tariff. The battery charges and discharges on price, not on my
consumption — and that last part is what breaks the Energy tab for me.

A random day:

  • Grid: 40.7 kWh imported, 17.9 kWh exported
  • Battery: 30.5 kWh charged, 17.9 kWh discharged — about 23 kWh of that was
    pure grid-to-grid trading
  • Solar: 7 kWh
  • Actual household consumption: ~17 kWh
  • What my supplier actually bills: 10.8 kWh import, 2.5 kWh export, with the
    trading settled separately as its own line

Homey Energy shows “Electricity EUR 7.42”. My supplier charges EUR 1.60. The
difference is that Homey prices my full gross import at the spot rate, including
the ~23 kWh that only went into the battery to be sold again a few hours later.

I understand where this comes from — there’s a good answer in “Is there a
description of what exactly drives each bit of the Energy display?” saying the
Energy tab is built for the common case of a meter, a battery and a charger. My
point is that “the common case” is shifting fast in NL and BE.

Three things that would fix it:

  1. Use the device’s own daily counters when it has them.
    My battery exposes meter_power.daily_import and daily_export. Energy reports
    14.7 kWh net today while those counters say 12.56 — and the counters match my
    supplier’s own app exactly. I see the same on the solar side: Energy once
    showed 19 kWh on a day the inverter itself reported 30.8. It looks like Energy
    integrates measure_power over time instead of reading the cumulative counter,
    which goes wrong for devices that switch fast (10 kW bursts here) or poll
    slowly from a cloud API.

    Related question: the docs say a home battery needs two meter_power
    capabilities to be reported in kWh. Does anyone know whether this is on
    Athom’s side, or whether a battery app simply has to declare those the way the
    energy spec expects? Happy to raise it with the app developer instead if so.

  2. Split battery flows by source and destination.
    Energy currently shows only “Battery: net X kWh”. For a trading battery four
    flows matter: solar->battery, grid->battery, battery->home, battery->grid.
    Without that split there’s no way to separate trading from own use. And
    because Home is a residual (Grid + Solar - Battery - EV), any error in the
    battery figure lands straight in the household number.

  3. Price the billable part, not the gross part.
    Import minus what went straight into the battery, export minus what came
    straight out of it, with the trading as its own line. My supplier already does
    exactly that. As long as Homey prices gross import, the cost figure is simply
    wrong for anyone running a trading battery.

Why this matters beyond my own house: a household battery on a dynamic contract
moves far more energy than the house consumes. Mine moved 48 kWh today against
17 kWh of actual consumption — roughly three times as much. So a few percent of
drift on the battery reading becomes 10%+ on the household figure, and the cost
number ends up more than four times too high. Zonneplan, Sessy, HomeWizard,
Marstek — they all trade now, and that group is growing quickly.

I’ve worked around it with a HomeyScript that derives all four flows from the
devices’ own daily counters. It took a fair few iterations before the energy
balance actually closed, and it really shouldn’t be necessary.

Anyone else with a trading battery seeing the same? And has anyone found a way to
make the Energy tab reflect this without external scripting?

I don’t have a home battery, my use case was for EV charging. For now, battery handling here is a simple version, and not tested against a battery that charges and discharges by price like yours.

Still, checked your numbers against how it works:

  • pv + grid import + battery discharge - grid export - battery charge = house consumption
  • 7 + 40.7 + 17.9 - 17.9 - 30.5 = 17.2 kWh

That matches your real ~17 kWh. The equation cancels out the battery cycling on its own, same as your script. It also works out that none of that consumption came from the battery that day: PV and grid charged it, the discharge went straight back to export.

This app provides two devices

  • one for the whole-house split
  • one per monitored appliance, both give grid/pv/battery kWh.

This doesn’t touch Homey Energy itself, it deliberately avoids the capabilities Homey Energy reads, so it’s a separate figure, not a fix to the Energy tab.

You can the use Power by the Hour for the cost summaries with kWh values from this app. Use the virtual summarizer and feed with a flow.