Python client for the Pinergy API
Project description
Pinergy Python Client
Python client for the Pinergy API, reverse-engineered from the official Android app.
Disclaimer: This is an unofficial client and is not affiliated with or endorsed by Pinergy. It is based on independent research and reverse-engineering of the public API. Use at your own risk; the API may change without notice and the authors assume no liability for any use of this software.
- Auth: Session-based; login with email/password to obtain an
auth_tokensent on subsequent requests. - Endpoints: Balance, usage, top-up, compare, profile, notifications, config, landlord check, etc.
Requirements
- Python 3.13+
requests,rich,rich-click,python-dotenv
Install
From PyPI (Python 3.13+):
pip install pinergy
Optional: use a virtual environment and/or uv:
python3 -m venv .venv
source .venv/bin/activate # or on Windows: .venv\Scripts\activate
pip install pinergy
Install from source (development): from the project root (directory containing pyproject.toml):
pip install -e ".[dev]"
# or: uv pip install -e ".[dev]"
Usage
Both the library and CLI can use the same environment variables (or a .env file with python-dotenv). Set any of:
PINERGY_EMAIL/PINERGY_PASSWORD— for loginPINERGY_AUTH_TOKEN— use an existing token (skip login)PINERGY_BASE_URL— optional; defaulthttps://api.pinergy.ie/api
As a library
The client reads PINERGY_BASE_URL, PINERGY_AUTH_TOKEN, and (for login) PINERGY_EMAIL / PINERGY_PASSWORD from the environment when you don’t pass them. Use a .env file and python-dotenv if you like.
import json
from pinergy_client import PinergyClient
# Uses PINERGY_* env vars automatically (or .env with load_dotenv())
client = PinergyClient()
# Log in if no PINERGY_AUTH_TOKEN set (email/password from env)
if not client.auth_token:
resp = client.login()
if not resp.success:
print(resp.message)
exit(1)
print(f"Balance: €{client.balance().balance:.2f}")
# Level Pay / rebrand usage
level_pay = client.get_level_pay_usage()
print("Level Pay usage:", json.dumps(level_pay.usage_data, indent=2, default=str))
client.close()
You can pass credentials explicitly instead of using env:
client = PinergyClient()
resp = client.login(email="you@example.ie", password="your_password")
# or: client = PinergyClient(auth_token="existing_token")
CLI
Uses rich and rich-click. All options can be provided via env vars, so you can omit --email, --password, --token when they are set.
# With PINERGY_EMAIL and PINERGY_PASSWORD set, login needs no args
pinergy login
# With PINERGY_AUTH_TOKEN set, authenticated commands need no args
pinergy balance
pinergy usage
# Level Pay / rebrand usage (summary tables; use --raw for full JSON)
pinergy level-pay-usage
# Account (notification prefs: email, SMS)
pinergy account
# Compare (your usage vs average home)
pinergy compare
# Active top-ups (auto & scheduled)
pinergy active-topups
# Top-up history
pinergy topup-history
# Config (top-up amounts, thresholds)
pinergy config
# Defaults (house/heating types; no auth)
pinergy defaults
# Landlord check (no auth)
pinergy landlord-check --premises P123456
Level Pay output — The API returns usage with half-hourly resolution (48 slots per day: 00:00, 00:30, …). The CLI prints compact summary tables: daily, peak half-hours (average) — top 5 consumption and top 5 cost slots — then last 7 days, weekly, and monthly. Each table shows Total kWh, Total €, then for each plan in the data (e.g. Standard, Drive, or other tariff names) both kWh and € columns. Plan names are read from the API, so different plans are supported. Example extract:
Level Pay — Daily (recent days)
┃ Date ┃ Total kWh ┃ Total € ┃ Drive kWh ┃ Standard kWh ┃ Drive € ┃ Standard € ┃
│ 21/02 │ 12.61 │ €0.73 │ 12.48 │ 0.12 │ €0.69 │ €0.05 │
...
Level Pay — Peak half-hours (average)
┃ Top consumption ┃ Avg kWh ┃ Top cost ┃ Avg € ┃
│ 02:00 │ 5.541 │ 02:00 │ €0.304 │
...
Level Pay — Weekly
┃ Week ┃ Total kWh ┃ Total € ┃ Standard kWh ┃ Drive kWh ┃ Standard € ┃ Drive € ┃
│ 09/02 │ 198.66 │ €13.66 │ 8.38 │ 190.28 │ €3.21 │ €10.45 │
Use --raw to print the full JSON (including half-hourly series per day).
Tests
Unit tests (no network, mocked):
pytest tests/unit -v
Integration tests (real API; require credentials in env):
- Copy
.env.exampleto.envand setPINERGY_EMAILandPINERGY_PASSWORD(orPINERGY_AUTH_TOKEN). - Run:
pytest tests/integration -v -m integration
Or run all tests (integration tests are skipped if env is not set):
pytest tests -v
API coverage
- Auth: login, logout, forgot password, change password
- Balance & top-up: balance, topUp, scheduleTopUp, autoTopUp, active top-ups, top-up history
- Usage: usage (day/week/month), levelPayUsage
- Compare: compare
- Profile: edit profile, update house, notification settings, update device token
- Cards: delete credit card (add/edit go through Credorax HPP flow)
- Config: configinfo, defaultsinfo
- Landlord: landlordcheck, landlordverify
Request/response types are implemented as dataclasses; see pinergy_client.models.
- Releasing: See RELEASING.md for CI/CD and PyPI publish steps.
- API details: Pinergy API reverse-engineering notes document how the API was derived from the Android app.
License
MIT.
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 pinergy-0.1.1.tar.gz.
File metadata
- Download URL: pinergy-0.1.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0141352ca73ffac0958d5d1a7bbd268f9b546511d1c2f17c0cbd12389580a370
|
|
| MD5 |
22c02faaf459821e944ebe6ee093dd3f
|
|
| BLAKE2b-256 |
4de876b443a78f340692325f3e7726fe6469ce1d25ba66e5db412164b4263ddf
|
File details
Details for the file pinergy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pinergy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
675d8d41de9b4067c8451e98bdce1a3e2c5eb4debf34846d238333fdb698a514
|
|
| MD5 |
5f4f767537cd287e787d51c0b4f28892
|
|
| BLAKE2b-256 |
bcf907274ea8e95eccb6ca48e6b0bdfe6fae246c047ba75adf657461e2b55e4d
|