SA Power Networks meter data

A .NET tool and Home Assistant integration for downloading SA Power Networks electricity meter data and importing historical readings.

.NET

Home Assistant

For folks living in South Australia, electricity is distributed by SA Power Networks. As an electricity consumer, you don’t normally deal with them directly. Instead you go through a retail company, of which there are a number to choose from.

SA Power Networks provide a service that allows you as a consumer to download your electricity data - Your Meter Data (you register for the service here).

Once you sign in you either download a PDF summary or a CSV file (in ‘NEM12’ format) with all your meter data, which includes both incoming and outgoing (like excess solar or battery) amounts.

I was keen to get that data so I could do some analysis of our power usage.

Having to repeatedly sign into that page and click on the various options just to download a CSV is a bit annoying. Ideally they’d provide a customer-facing API that I could call, but they don’t. (I presume they do provide an API for the electricity retailers).

So I wrote a .NET library and an example console application that will do all that for you from the command line. Source available at https://github.com/flcdrg/sapowernetworks-meterdata-net.

You just supply your email address and password (that you signed up to the Your Meter Data site with) and it will grab the CSV for you:

dotnet run --project src/Gardiner.SaPowerNetworks.MeterData.Console -- --email your@email.com --password 'YOURPASSWORD' --file data.csv

If all goes well, will produce:

Logging in as your@email.com...
Logged in successfully.
Found 1 NMI(s):
  200012345678  Home  STREET SUBURBNAME 5000
Fetching data from 2026-08-18 to 2026-08-20...
Saved detailed NEM12 CSV to /Users/david/dev/sapowernetworks-meterdata-net/data.csv

The data looks something like this (truncated):

200,1234567899,E1B1,E1,E1,,LG1201234567,KWH,05,
300,20260619,0.00000000000000,0.00000000000000,0.00000000000000,0.00000000000000,0.00000000000000,
400,1,154,F19,,
400,155,288,A,,

And what about Home Assistant?

Hey, wouldn’t this be a great data source for integrating with Home Assistant? You could use it to import your electricity meter data directly into HA. Well yes it would, but as nice as my console app is, it’s written in .NET and Home Assistant integrations are written in Python.

So I used Copilot to create a new Home Assistant integration that imports the data each day automatically! It was able to use the .NET implementation as a reference and created equivalent Python code that would work with Home Assistant.

The source for the integration is at https://github.com/flcdrg/sapowernetworks-meterdata-ha. For the moment you will need to add that as a custom repository in Home Assistant HACS, but I’ve submitted it to be listed so that you will be able to just search for it in the HACS store.

The integration provides a control and a number of sensors:

Screenshot of Integration in Home Assistant

But because all the data is historic, it doesn’t provide a sensor with the current reading. Instead it publishes the historic data to Home Assistant’s Recorder as statistics.

One way to view the data is via a Statistics graph card.

eg.

Screenshot of Statistics Graph settings in Home Assistant

- type: statistics-graph
  entities:
    - sapowernetworks:9999999_import_e1
    - sapowernetworks:9999999_export_b1
  days_to_show: 7
  period: day
  chart_type: bar
  stat_types:
    - change
  logarithmic_scale: false

Which can give you a graph like this:

Seven-day Home Assistant statistics graph showing electricity imported from and exported to the grid

The blue ‘import’ is the electricity that came from the grid into the house. The yellow ‘export’ is excess solar power that was exported back to the grid.

The Saturday 19th and Sunday 20th were both beautiful sunny days here in Adelaide. The reason for the differences in the amounts on those days is that Saturday I was out driving most of the day, so we did not charge our car during the 11am-2pm free period that our current electricity plan offers. But Sunday once I got home from church the car was plugged in and recharged, so for that period while it was just as sunny, that solar power was going straight into our car instead of being exported.