Skip to main content

Async client for Essent dynamic energy prices

Project description

Essent dynamic pricing client

Async client for Essent's public dynamic price API, returning normalized electricity and gas tariffs ready for Home Assistant or other consumers. Tariff start/end values are returned as timezone-aware datetimes in the Europe/Amsterdam timezone.

Usage

import asyncio
from aiohttp import ClientSession
from essent_dynamic_pricing import EssentClient

async def main():
    async with ClientSession() as session:
        client = EssentClient(session=session)
        data = await client.async_get_prices()

        # Electricity data is always available
        print(f"Electricity: {data.electricity.min_price} - {data.electricity.max_price} €/{data.electricity.unit}")

        # Gas data may be None if unavailable from API
        if data.gas:
            print(f"Gas: {data.gas.min_price} - {data.gas.max_price} €/{data.gas.unit}")
        else:
            print("Gas data not available")

asyncio.run(main())

Breaking Changes in v0.3.0

The gas field in EssentPrices is now Optional[EnergyData] instead of required. This handles cases where the Essent API temporarily doesn't provide gas data. Electricity data is still required.

Before (v0.2.x):

data = await client.async_get_prices()
print(data.gas.min_price)  # Always worked

After (v0.3.0):

data = await client.async_get_prices()
if data.gas:
    print(data.gas.min_price)  # Check for None first

Development / tests

  1. Install dev deps (adds pytest and pytest-asyncio):
    pip install -e .[test]
  2. Run tests:
    pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

essent_dynamic_pricing-0.3.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

essent_dynamic_pricing-0.3.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file essent_dynamic_pricing-0.3.1.tar.gz.

File metadata

  • Download URL: essent_dynamic_pricing-0.3.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for essent_dynamic_pricing-0.3.1.tar.gz
Algorithm Hash digest
SHA256 97dc4ed328e3122e1e55469b90c4babeaffcc8064936371d337e86a2daacff16
MD5 3c612ea4a0d13cb280e2088ac9fbeb2f
BLAKE2b-256 496fea01c88aaafcffbbf13b6a5e81fcdebfa363a430ac6fd436ba10a4f72d4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for essent_dynamic_pricing-0.3.1.tar.gz:

Publisher: publish.yml on jaapp/py-essent-dynamic-pricing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essent_dynamic_pricing-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for essent_dynamic_pricing-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a332d2e9404c387c719591ec12ceb160aad1ed3c1b5a14da937aef9090ac3cf
MD5 8bb5a2213744c05c56d9e60358dcd994
BLAKE2b-256 ce096fdb34b83c5d534a4fdbf7fc2918454e7b13f62690a86e967817606f0d69

See more details on using hashes here.

Provenance

The following attestation bundles were made for essent_dynamic_pricing-0.3.1-py3-none-any.whl:

Publisher: publish.yml on jaapp/py-essent-dynamic-pricing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page