meridian-energy
Python client for the Meridian Energy (NZ) customer API.
Unofficial. Not affiliated with or endorsed by Meridian Energy.
Talks to the current MyMeridian stack:
- Email one-time code (
auth.meridianenergy.nz) - Firebase custom-token exchange
- GraphQL (“Kraken”) at
api.meridianenergy.nz
Install
pip install meridian-energy
# or
uv add meridian-energy
Requires Python 3.11+.
CLI
uvx meridian login # emails a code, prompts for it
uvx meridian accounts
uvx meridian usage --days 14
uvx meridian usage --json
uvx meridian status
uvx meridian logout
Tokens are cached at ~/.cache/meridian-energy/tokens.json (mode 0600).
Override with --token-cache or MERIDIAN_TOKEN_CACHE. Email can come from
MERIDIAN_EMAIL.
Library
import asyncio
import httpx
from meridian_energy import MeridianEnergyApi, MeridianEnergyAuth
async def main() -> None:
auth = MeridianEnergyAuth()
async with httpx.AsyncClient(timeout=30) as http:
journey = await auth.request_otp(http, "you@example.com")
await auth.verify_otp(http, "you@example.com", "123456", journey)
async with MeridianEnergyApi(auth) as api:
for account in await api.get_accounts():
print(account.number, account.primary_icp)
usage = await api.get_usage(account.number, days=10)
print(usage.import_kwh, usage.export_kwh, usage.cost_nzd)
asyncio.run(main())
Resume a session from stored tokens (refresh is transparent):
from meridian_energy import MeridianEnergyAuth, MeridianEnergyApi, TokenSet
async def save(tokens: TokenSet) -> None:
store.write(tokens.to_dict())
auth = MeridianEnergyAuth(
tokens=TokenSet.from_dict(store.read()),
on_token_update=save,
)
api = MeridianEnergyApi(auth)
Development
uv sync --group dev
uv run ruff check src tests
uv run ruff format src tests
uv run ty check src
uv run pytest
Home Assistant
The companion integration is hardbyte/ha-meridian-energy.
Metadata
Release files for meridian-energy 0.1.5
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 |
|---|---|---|---|---|
| meridian_energy-0.1.5.tar.gz | 42.1 kB | Without provenance | Details for meridian_energy-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meridian_energy-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for meridian_energy-0.1.5-py3-none-any.whl |
Total release size: 64.3 kB
Release files / meridian_energy-0.1.5.tar.gz
| Download URL | meridian_energy-0.1.5.tar.gz |
|---|---|
| Size | 42.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb49e16f58eb6caeefe106fd93ff86530f7d72ae8c500fe96a3cc08ca444eb28
|
|
BLAKE2b-256 checksum How to use checksums |
58b4ba83ed229edb81549346691b40161895fcc8b49ac75dc10fa088347ece7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / meridian_energy-0.1.5-py3-none-any.whl
| Download URL | meridian_energy-0.1.5-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bda1695bc154a08fa2c97b33bcd3afedf8a31910a445aff38a82c048b391d683
|
|
BLAKE2b-256 checksum How to use checksums |
8ba7649f1a40c449712361a8dabd41c5d4e293cffc52baaef4c058f040885ddc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for meridian-energy 0.1.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.