sapnmeterdata
sapnmeterdata is an unofficial Python client for downloading NEM12 interval
meter data from SA Power Networks' Your Meter Data customer portal.
It signs in with an existing SAPN portal account, discovers the NMIs assigned to that account, requests a detailed NEM12 report, and returns the readings as a Pandas DataFrame.
This project is not affiliated with or supported by SA Power Networks. It relies on the portal's web interface and may require updates when that interface changes.
Installation
python -m pip install sapnmeterdata
Version 0.3.3 requires Python 3.12 or newer. It uses the pandas-based
nemreader 0.9 parser so it remains compatible with older processors used by
some Home Assistant hosts. The public result is a Pandas DataFrame.
SAPN account
Register for the free Your Meter Data service before using this package:
https://www.sapowernetworks.com.au/your-power/manage-your-power-use/your-meter-data/
Only access NMIs for which you are the customer or an authorised representative. Do not commit SAPN credentials to source control.
Example
import os
from datetime import datetime, timedelta
from sapnmeterdata import login
sapn = login(
os.environ["SAPN_EMAIL"],
os.environ["SAPN_PASSWORD"],
)
for assignment in sapn.getNMIAssignments():
print(
assignment.nmi,
assignment.friendly_name,
assignment.address,
assignment.meter_type_description,
)
print(sapn.getNMIs()) # Backwards-compatible NMI-only list.
end = datetime.now()
start = end - timedelta(days=14)
data = sapn.getAllData(start, end)
print(data)
Retrieve one NMI:
from sapnmeterdata import meter
single_meter = meter("YOUR_NMI", sapn)
data = single_meter.getdata(start, end)
Retrieve selected NMIs:
from sapnmeterdata import getall
data = getall(
["FIRST_NMI", "SECOND_NMI"],
start,
end,
sapn,
)
If one NMI has no downloadable data for the requested period, getall() emits
a MeterDataWarning, skips only that NMI, and continues retrieving the others.
The returned DataFrame records those NMIs in
data.attrs["skipped_nmis"]. Calling meter.getdata() directly for the same
NMI raises NoDataError.
Returned data
Meter readings are returned as a Pandas DataFrame:
- the index contains the interval start timestamp;
- columns use a two-level
meter/channelMultiIndex; - multiple NMIs are outer-joined by timestamp.
Common NEM12 channels include E1 for general consumption, E2 for
controlled load, and B1 for solar export. The exact channels depend on the
meter configuration.
SAPN data is historical interval data, not a real-time power feed.
Meter assignments
login.getNMIAssignments() returns an NMIAssignment object for every meter
on the account. login.get_nmi_assignments() is an equivalent PEP 8 alias.
Convenient properties include:
nmifriendly_name— normally SAPN's meter description, such asMRCorTRACKSIDE PUMPdescription,address,customer_name,business_name, andcompany- assignment identifiers, default/hidden flags, and the UTC
start_date - meter type and description
- individual supply-address fields
SAPN can add fields without notice. To avoid discarding information:
assignment.detailscontains the complete nestednmiAssignrecord;assignment.rawcontains the complete outer assignment response;assignment.to_dict()returns all convenient fields plus deep copies of both raw dictionaries.
getNMIs() remains supported and returns only the NMI strings. Assignment
results are cached for the authenticated session; pass refresh=True to either
method to request them again.
Errors
The public exception types are:
LoginError— the login form changed, credentials were rejected, or SAPN requested another authentication step;AuthError— the authenticated session expired or Salesforce remoting metadata could not be found;NoDataError— SAPN returned no downloadable NEM12 payload for a particular NMI and date range;FetchError— another portal request, RPC response, or NEM12 parse failed.
MeterDataWarning is emitted when getall() catches NoDataError for one NMI
and continues with the rest.
Development
Create a Python 3.12+ virtual environment and install the package with its current development tools:
python -m pip install ".[dev]"
Run the unit tests:
python -m unittest discover -s tests -v
Build the source distribution and wheel:
python -m build
See RELEASING.md for the GitHub Actions and PyPI Trusted Publishing setup.
Metadata
Release files for sapnmeterdata 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sapnmeterdata-0.3.3.tar.gz | 22.2 kB | With provenance | Details for sapnmeterdata-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sapnmeterdata-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for sapnmeterdata-0.3.3-py3-none-any.whl |
Total release size: 34.1 kB
Release files / sapnmeterdata-0.3.3.tar.gz
| Download URL | sapnmeterdata-0.3.3.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a59463d5fa68b4efea9d288db27a9ec47105d25adcc0d695665328e3b91965ba
|
|
BLAKE2b-256 checksum How to use checksums |
c6497f92d05b9471026df44c31d7d0970c6c71b638b54d57bfe46efdba104d91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.
Transparency logRelease files / sapnmeterdata-0.3.3-py3-none-any.whl
| Download URL | sapnmeterdata-0.3.3-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5e1fc488ac242987f5a1e97eefafc0f46f1a2f63b74354001312ae54ddf80cd
|
|
BLAKE2b-256 checksum How to use checksums |
14a3a1a9a3a9ac212b51b04ae05919c5110fe89cc38d648202f53a8833a7dc7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.
Transparency logSecurity for sapnmeterdata 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sapnmeterdata-0.3.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.