Retrieve interval meter data from SA Power Networks
Project description
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.2.2 requires the Pandas-based nemreader 0.9 API. The dependency is
therefore constrained to nemreader>=0.9,<1.
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"],
)
print(sapn.getNMIs())
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.
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
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sapnmeterdata-0.2.2.tar.gz.
File metadata
- Download URL: sapnmeterdata-0.2.2.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b28f358bd44e05b07064c8d1b823b34338cf1dcee94d5e264c5171f03711dc5
|
|
| MD5 |
1d4269a90299575bdb985f9b6c0e8cb1
|
|
| BLAKE2b-256 |
5c5d9184e342ebff63f0c3312c9607d03b721952cf550cfbb004ef0ff6c01980
|
Provenance
The following attestation bundles were made for sapnmeterdata-0.2.2.tar.gz:
Publisher:
publish.yml on bfulham/sapnmeterdata
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sapnmeterdata-0.2.2.tar.gz -
Subject digest:
1b28f358bd44e05b07064c8d1b823b34338cf1dcee94d5e264c5171f03711dc5 - Sigstore transparency entry: 2255639273
- Sigstore integration time:
-
Permalink:
bfulham/sapnmeterdata@544867fa2c3cc393967e78da43e0e99906e9fe70 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/bfulham
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@544867fa2c3cc393967e78da43e0e99906e9fe70 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sapnmeterdata-0.2.2-py3-none-any.whl.
File metadata
- Download URL: sapnmeterdata-0.2.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d8c9f98d6ae0d8ef59549485d3d5375607768f58320124a5370e71526a638ee
|
|
| MD5 |
cde13cf7209a8f7e459a6b85b12cee12
|
|
| BLAKE2b-256 |
1280838acb7c0b2a81098e00967c479c48a0d336fbb960f701df7b6549fd8237
|
Provenance
The following attestation bundles were made for sapnmeterdata-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on bfulham/sapnmeterdata
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sapnmeterdata-0.2.2-py3-none-any.whl -
Subject digest:
8d8c9f98d6ae0d8ef59549485d3d5375607768f58320124a5370e71526a638ee - Sigstore transparency entry: 2255639305
- Sigstore integration time:
-
Permalink:
bfulham/sapnmeterdata@544867fa2c3cc393967e78da43e0e99906e9fe70 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/bfulham
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@544867fa2c3cc393967e78da43e0e99906e9fe70 -
Trigger Event:
release
-
Statement type: