Skip to main content

Leneda API Client

PyPI version Python Versions License

A Python client for interacting with the Leneda energy data platform API.

PLEASE NOTE: As long as the library is in a version below 1.0.0, breaking changes may also be introduced between minor version bumps.

Overview

This client provides a simple interface to the Leneda API, which allows users to:

  • Retrieve metering data for specific time ranges
  • Get aggregated metering data (hourly, daily, weekly, monthly, or total)
  • Create metering data access requests
  • Use predefined OBIS code constants for easy reference

Installation

pip install leneda-client

Trying it out

$ export LENEDA_ENERGY_ID='LUXE-xx-yy-1234'
$ export LENEDA_API_KEY='YOUR-API-KEY'
$ python examples/basic_usage.py --metering-point LU0000012345678901234000000000000
Example 1: Getting hourly electricity consumption data for the last 7 days
Retrieved 514 consumption measurements
Unit: kW
Interval length: PT15M
Metering point: LU0000012345678901234000000000000
OBIS code: ObisCode.ELEC_CONSUMPTION_ACTIVE

First 3 measurements:
Time: 2025-04-18T13:30:00+00:00, Value: 0.048 kW, Type: Actual, Version: 2, Calculated: False
Time: 2025-04-18T13:45:00+00:00, Value: 0.08 kW, Type: Actual, Version: 2, Calculated: False
Time: 2025-04-18T14:00:00+00:00, Value: 0.08 kW, Type: Actual, Version: 2, Calculated: False

Example 2: Getting monthly aggregated electricity consumption for 2025
Retrieved 4 monthly aggregations
Unit: kWh

Monthly consumption:
Period: 2024-12 to 2025-01, Value: 30.858 kWh, Calculated: False
Period: 2025-01 to 2025-02, Value: 148.985 kWh, Calculated: False
Period: 2025-02 to 2025-03, Value: 44.619 kWh, Calculated: False
Period: 2025-03 to 2025-04, Value: 29.662 kWh, Calculated: False

Listing metering points for a sharing group

You can retrieve the metering points belonging to a sharing group for a given date.

The Leneda API expects the sharing group contract number, for example CR00007479.

If no date is provided, the client uses today's date.

import asyncio
import os
from datetime import date

from leneda import LenedaClient


async def main() -> None:
    client = LenedaClient(
        api_key=os.environ["LENEDA_API_KEY"],
        energy_id=os.environ["LENEDA_ENERGY_ID"],
    )

    groups = await client.list_sharing_groups()

    for group in groups:
        print(f"{group.contract_number} | {group.type}")

        metering_points = await client.get_sharing_group_metering_points(
            group.contract_number,
            on_date=date.today(),
        )

        for metering_point in metering_points:
            print(f"  {metering_point}")


asyncio.run(main())

Metadata

Release files for leneda-client 0.7.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 leneda-client 0.7.0
File Size Uploaded Provenance Actions
leneda_client-0.7.0.tar.gz 22.2 kB With provenance Details for leneda_client-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for leneda-client 0.7.0
File Interpreter ABI Platform Actions
leneda_client-0.7.0-py3-none-any.whl Python 3 none any Details for leneda_client-0.7.0-py3-none-any.whl

Total release size: 35.9 kB

Release files / leneda_client-0.7.0.tar.gz

Download URL leneda_client-0.7.0.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4ad22d8a7d99c6fbc3ab5f5d38563ff5449beedbefed1adcb07603d1089c902f
BLAKE2b-256 checksum
How to use checksums
21b25bcedc40264de213c305eb38c31de919fa79e7c498f065c5d26e32c63764
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 3, 2026.

Transparency log

Release files / leneda_client-0.7.0-py3-none-any.whl

Download URL leneda_client-0.7.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e3b1d0fc4575e42834dd82840bbcf96d58c08720f5d974b512bbc2cea4bbb72
BLAKE2b-256 checksum
How to use checksums
e61376904c177e9b6d489552e7a21f78ac4d1c817fe2bc7c55c3d82b0034528a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 3, 2026.

Transparency log

Security for leneda-client 0.7.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 leneda_client-0.7.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 Jun 3, 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