Skip to main content

Energy Tracker API Client

Async Python client for the Energy Tracker public REST API.

Installation

pip install energy-tracker-api

Requirements

  • Python 3.14+
  • Personal Access Token from Energy Tracker

Quick Start

import asyncio
from decimal import Decimal
from energy_tracker_api import EnergyTrackerClient, CreateMeterReadingDto

async def main():
    async with EnergyTrackerClient(access_token="your-token") as client:
        # List devices
        devices = await client.devices.list_standard()

        # Create a meter reading
        reading = CreateMeterReadingDto(value=Decimal("12345.67"))
        await client.meter_readings.create(
            device_id="your-device-id",
            meter_reading=reading,
        )

asyncio.run(main())

Resources

The client exposes four resource groups — all endpoints, parameters, and DTOs are documented in the OpenAPI specification.

Resource Methods
client.devices list_standard(), list_virtual()
client.meter_readings list(), create(), delete(), export()
client.environments list(), get(), create(), delete(), create_entry(), delete_entry()
client.calculations daily_values(), extrapolations()

Starting with version 3.0.0, meter-reading CSV exports default to semicolon (;). To preserve the comma-separated output of version 2.x, explicitly set delimiter=CsvDelimiter.COMMA in ExportMeterReadingsDto.

Configuration

client = EnergyTrackerClient(
    access_token="your-token",
    base_url="https://custom-api.example.com",  # Optional
    timeout=30,                                 # Optional, default: 10s
    calculation_timeout=60,                     # Optional, calculations only
)

Error Handling

All API errors inherit from EnergyTrackerAPIError and carry an api_message list with details from the server. Each operation accepts only its documented success status (200, 201 or 204). Unexpected statuses and redirects raise EnergyTrackerAPIError; redirects are not followed.

from energy_tracker_api import (
    EnergyTrackerAPIError,
    ValidationError,
    AuthenticationError,
    ForbiddenError,
    ResourceNotFoundError,
    ConflictError,
    RateLimitError,
)

try:
    await client.meter_readings.create(device_id, reading)
except RateLimitError as e:
    print(f"Retry after {e.retry_after}s")
except EnergyTrackerAPIError as e:
    print(e.api_message)

Development

make install-dev  # Install dependencies
make test         # Run tests
make type-check   # mypy
make format       # black + isort
make lint         # Linters
make check-dist   # Build, validate and import an isolated wheel installation

Package metadata, version and dependencies are maintained in pyproject.toml. The requirements files are compatibility entry points for installing the package and its development extra. The Makefile uses python3.14 by default; override it with make install-dev PYTHON=/path/to/python3.14 when needed.

Meter reading values must be finite Decimal values. The client serializes them as fixed-point strings without redundant fractional zeros and never rounds them. Server-side range and precision validation still applies. When creating and deleting the same reading, reuse its timestamp; prefer UTC-aware timestamps with whole seconds as shown in example.py.

License

MIT

Metadata

Release files for energy-tracker-api 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for energy-tracker-api 3.0.0
File Size Uploaded Provenance Actions
energy_tracker_api-3.0.0.tar.gz 38.9 kB With provenance Details for energy_tracker_api-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for energy-tracker-api 3.0.0
File Interpreter ABI Platform Actions
energy_tracker_api-3.0.0-py3-none-any.whl Python 3 none any Details for energy_tracker_api-3.0.0-py3-none-any.whl

Total release size: 59.7 kB

Release files / energy_tracker_api-3.0.0.tar.gz

Download URL energy_tracker_api-3.0.0.tar.gz
Size 38.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cb754a3dd17e0aeeccfba48ffe831188e0cc6f6872138b3272d10d53073e7b70
BLAKE2b-256 checksum
How to use checksums
0a6194994acddbfb195dc171158164c6392e2a75ae8227c99daf934010af62cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Sep 30, 2026.

Transparency log

Release files / energy_tracker_api-3.0.0-py3-none-any.whl

Download URL energy_tracker_api-3.0.0-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
648f5e5a186855e0bca72b83bd77ed9d05db458215edb2baaa5a9a270a24c829
BLAKE2b-256 checksum
How to use checksums
5926fe66c770b33f66fd9b431b3eec3d452f429f5a7b6230a72f43231fd93cf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Sep 30, 2026.

Transparency log

Security for energy-tracker-api 3.0.0

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.

Select from 2 files

Attestation for energy_tracker_api-3.0.0.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 Sep 30, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page