Energy Meter Tracker

Energy Meter Tracker — Half-hourly electricity metering app for Home Assistant

GitHub Repository

I’ve built a Home Assistant app that records your electricity usage in precise half-hour blocks — the same intervals UK energy supplier uses for billing.

Why?

The built-in Energy dashboard tracks totals but doesn’t give you visibility into individual half-hour periods. If you’re on an Agile or time-of-use tariff, or you want to understand how your battery, EV charger or heat pump is affecting your grid consumption, you need half-hourly data.

What it does

  • Records import and export meter readings at every :00 and :30 boundary
  • Boundary interpolation — even if your sensor updates every 60 seconds, the block delta is calculated precisely to the boundary timestamp, not to whenever the last reading happened to land
  • Sub-meter support — track EV chargers, home batteries and heat pumps; the engine distributes grid consumption across them using a grid-authoritative algorithm (the main meter is always the source of truth)
  • Gap filling — if the app restarts mid-session it detects missing blocks and interpolates them automatically
  • Backup — data is copied to /share after every block finalise, with zip snapshots before every config change
  • Four HA sensors — cumulative import/export kWh and cost, compatible with the Energy dashboard and Utility Meter
  • Web UI — config wizard, charts, logs viewer, help page, all accessible from the sidebar

Requirements

Installation

Add the repository to your HA app store:

https://github.com/RGx01/energy-meter-tracker-addon

Settings → Apps → App Store → ⋮ → Repositories → paste the URL above.

Disclaimer

This app is for informational use only. It provides a close approximation of your half-hourly consumption based on local sensor readings. It cannot replicate your supplier’s authoritative HH reconciliation — do not use it for billing disputes.

Feedback welcome

This is a v1.1.0 release — feedback, bug reports and feature requests are very welcome via GitHub Issues. I’m particularly interested in hearing from users with tariff types and set ups.


2 Likes

Who told you my energy supplier uses half hour blocks?

Whoever it was, they are wrong. My energy supplier uses 5 minute blocks.

Thanks @tom_l. I updated the description to be UK suppliers. My first app, never going to be perfect or universal. Take it easy.

1 Like

I was just joking about your choice of words. No hard feelings.

Hi All
Is it going to work with Mini Octopus

In short, I don’t think it’s possible right now. The app relies on meter reads for any missed reconciliation, If anyone knows if it is possible it would be @BottlecapDave as his integration provides demand power from the mini. I read in a few places that the mini only works with import but mine does export too so there could be some hope.

@tom_l I’ve made some changes, meters with reconciliation windows of 5, 15 and 30 minute blocks are now supported.

Is it possible to add to config Battery Tesla Powerwall 3 , and how . And yes its work great with octopus mini

Sub meters are for import only do not use a net sensor. You’ll need to create a sensor that just tracks your pw 3 import (example below).

        # Inverter using the grid
        - name: "PW Inverter in Power"
          unique_id: pw_inverter_in_power
          state: >
            {% set val = states('sensor.pw_inverter_power')|int(default=0) %}
            {{ (0 - val) if is_number(val) and (val|int < 0) else 0 }}
          unit_of_measurement: "W"
          state_class: measurement
          device_class: "power"
          icon: mdi:battery
  powercalc:
    energy_update_interval: 60
      - entity_id: sensor.pw_inverter_in_power
        power_sensor_id: sensor.pw_inverter_in_power
        name: PW In Aggregated
        fixed:
          power: "{{ states('sensor.pw_inverter_in_power')| int(default=0) }}"

I have no idea how you’ve got it working using an octopus mini. please share.

I installed this HA app a few days ago as it looked quite cool. I added my main meter (reading data from the Hildebrand CAD). Due to my error, I set the Import Rate Sensor to the wrong entity. Then I added my EV and heat pump. I thought is was cool that the Import Rate Sensor was replicated from the main meter.

I quickly realised that the main meter Import Rate Sensor was incorrect so fixed it. I assumed that the sub meter values would automatically change when the main meter value changed… because the wording imlies that (‘pre-filled from main meter’). This led to some very weird charts. However, I have now fxed the sub meter Import Rate Sensors and all is OK.

I think the main meter Import Rate Sensor should automatically change the sub meter sensors OR the wording be changed to cope with stupid people like me.

Other than this minor issue (which is now fixed), I really like this app. I look forwatd to receiving my Octopus bill and comparing the result.

1 Like

Thanks for the feedback. It’s hard to see what users may see when developing in isolation. I’ll change this for the upcoming 2.6.0 release. I don’t have a heat pump either so I’m excited (and nervous) to see your results!! hopefully you’ve set the inverter possible flag correctly if your pump can run off the house battery.

2.6.0 I’m hoping to release today. It partially completes the CO2 Insights vision that has been building since 2.3.0 onwards. Open to genuine feedback as I’ve developed this singularly and recognise the closeness to the project is often blinding. I do genuinely believe that this offers closer insight because we’re gathering block level carbon information against real metered usage.

2.3.0 → 2.5.0 gave us these building blocks enabling the insights

I just put my sensors from octopus addon from HA in setting and its work . Also work and for export





1 Like

Interesting, what kind of resolution are those readings? the resolution is really important to the quality of the results. If the resolution is greater than 1 read per minute then results won’t match real meter reconciliation periods. There’s more info in the wiki and readme. Reads arriving late from cloud api’s will also have a negative effect.

FYI The timezone you have set should be Europe/London, not a huge issue but the accounting will be slightly wrong as blocks recorded up until now will have the wrong midnight by an hour. It’s a problem on my side that I need to think through because blocks are all stored as UTC but they also have a local time stored to make SQL behind the charts and billing summaries a bit easier. so essentially if you’ve used UTC as your timezone the billing will be wrong in summer until I do the hard work in SQL.

Release 2.8.0 resolves my cheap shortcut dealing with timezones, be sure to set the locale in settings until I update the meter config to self discover.

Also fuel mix is now included in the live power dashboard and carbon insights for UK users. A new usage insights tab is also available.

I’ve had a few DM’s with questions, I’ve added the Wiki which should help.

V3.0.0 Now available - Now includes Octopus billing settlement (sourced from Kraken/Octopus API), IOG rate overlay (Ohme supported optimistically see wiki) and ability to use Octopus mini as import if no other source is available.