Skip to main content

alt Header of the easyEnergy package

GitHub Release Python Versions Project Stage Project Maintenance License

GitHub Activity PyPi Downloads GitHub Last Commit Open in Dev Containers

Build Status Typing Status Code Coverage OpenSSF Scorecard

Asynchronous Python client for the easyEnergy price API.

About

A Python package for retrieving dynamic electricity and gas prices from easyEnergy. The package uses the current price-graph API and supports both hourly and quarter-hour electricity prices.

Installation

pip install easyenergy

To use the CLI as well:

pip install "easyenergy[cli]"

Data

[!NOTE] The bundled example scripts are plain Python usage examples. They intentionally use fixed request dates so you can test a known day; adjust those dates when you want to inspect another period.

You can read the following datasets with this package:

Electricity prices

[!IMPORTANT] The new easyEnergy price API exposes multiple electricity price components per interval. For electricity usage you can select either the market price (price / priceIncVat) or the billed invoice price (invoicePrice). Return to grid is mapped to the VAT-inclusive return price field (priceIncVat).

[!TIP] A single energy_prices(...) fetch exposes both current_market_price and current_invoice_price, plus market_prices and invoice_prices. That makes it straightforward to create separate Home Assistant price entities for the Energy dashboard without extra API calls.

Electricity prices can be requested per hour or per quarter. This package defaults to hourly data for backwards compatibility, but quarter prices are also supported through ElectricityGranularity.QUARTER.

Usage properties:

Property Type Description
current_price float Current usage price for the active interval
current_market_price float Current market price (including VAT)
current_market_price_excluding_vat float Current market price (excluding VAT)
current_invoice_price float Current invoice/billed price
average_price float Average price over all intervals
extreme_prices tuple Minimum and maximum price (min, max)
highest_price_time datetime Timestamp of the highest price
lowest_price_time datetime Timestamp of the lowest price
pct_of_max float Current price as percentage of maximum
periods_priced_equal_or_lower int Number of intervals with current price or lower
periods_priced_equal_or_higher int Number of intervals with current price or higher
prices dict Usage price series (datetime → price)
market_prices dict Market prices including VAT
market_prices_excluding_vat dict Market prices excluding VAT
invoice_prices dict Invoice/billed prices

Return properties:

Property Type Description
current_return_price float Current return/feed-in price
average_return_price float Average return price
extreme_return_prices tuple Minimum and maximum return price
highest_return_price_time datetime Timestamp of highest return price
lowest_return_price_time datetime Timestamp of lowest return price
pct_of_max_return float Current return as percentage of maximum
return_periods_priced_equal_or_higher int Return intervals with current price or higher
return_prices dict Return price series (datetime → price)

Interval data:

Full interval rows via energy.intervals, each containing: price, price_inc_vat, energy_tax, purchase_price, invoice_price, average, average_inc, unit, and granularity.

Gas prices

The gas prices are fixed per day in the new price API.

Property Type Description
current_price float Current gas price
average_price float Average gas price
extreme_prices tuple Minimum and maximum price (min, max)
highest_price_time datetime Timestamp of the highest price
lowest_price_time datetime Timestamp of the lowest price
prices dict Gas price series (datetime → price)

Full interval rows available via gas.intervals.

Example

import asyncio

from datetime import date
from easyenergy import (
    EasyEnergy,
    ElectricityGranularity,
    VatOption,
)


async def main() -> None:
    """Fetch electricity and gas prices from easyEnergy."""
    async with EasyEnergy(vat=VatOption.INCLUDE) as client:
        start_date = date(2026, 4, 19)
        end_date = date(2026, 4, 19)

        energy = await client.energy_prices(
            start_date,
            end_date,
            granularity=ElectricityGranularity.QUARTER,
        )
        gas = await client.gas_prices(start_date, end_date)

    print(f"Quarter intervals: {len(energy.intervals)}")
    print(f"Current market price: {energy.current_market_price}")
    print(f"Current invoice price: {energy.current_invoice_price}")
    print(f"Average price: {energy.average_price}")
    print(f"Average return price: {energy.average_return_price}")
    print(f"First electricity interval: {energy.intervals[0]}")
    print(f"Average gas price: {gas.average_price}")
    print(f"First gas interval: {gas.intervals[0]}")


if __name__ == "__main__":
    asyncio.run(main())

Examples

The repository ships plain usage examples under examples/:

poetry run python ./examples/energy.py
poetry run python ./examples/gas.py
poetry run python ./examples/prices_list.py

Those files are intentionally simple and meant as package-usage references, not as a full CLI. Update the fixed request date constants in the files when you want to inspect another day.

CLI Tool

The package also ships a Rich/Typer-based CLI under src/easyenergy/cli:

poetry run easyenergy energy --date 2026-04-19
poetry run easyenergy energy --date 2026-04-19 --price-type invoice
poetry run easyenergy gas --start-date 2026-04-01 --end-date 2026-04-02
poetry run easyenergy prices-list --date 2026-04-19 --granularity quarter
poetry run easyenergy entities --date 2026-04-19

The entities command shows all available properties for Home Assistant integration, grouped by usage, return, and gas.

Useful CLI options:

  • --date YYYY-MM-DD for a single day
  • --start-date YYYY-MM-DD --end-date YYYY-MM-DD for a range
  • --vat include|exclude to switch between market prices with or without VAT
  • --price-type market|invoice to choose between market and billed electricity usage prices
  • --granularity hour|quarter for electricity commands
  • --limit N to limit the number of printed intervals; without it, all returned intervals are shown

Class Parameters

Parameter value Type Description
vat enum (default: VatOption.INCLUDE) Include or exclude VAT on class level

Function Parameters

Parameter value Type Description
start_date date The start date of the selected period
end_date date The end date of the selected period
vat enum (default: class value) Include or exclude VAT (VatOption.INCLUDE or VatOption.EXCLUDE)
granularity enum (electricity only) Electricity granularity (ElectricityGranularity.HOUR or ElectricityGranularity.QUARTER)

Contributing

This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We've set up a separate document for our contribution guidelines.

Thank you for being involved! :heart_eyes:

Setting up development environment

The simplest way to begin is by utilizing the Dev Container feature of Visual Studio Code or by opening a CodeSpace directly on GitHub. By clicking the button below you immediately start a Dev Container in Visual Studio Code.

Open in Dev Containers

This Python project relies on Poetry as its dependency manager, providing comprehensive management and control over project dependencies.

You need at least:

Installation

Install all packages, including all development requirements:

poetry install

Poetry creates by default an virtual environment where it installs all necessary pip packages.

Prek

This repository uses the prek framework, all changes are linted and tested with each commit. To setup the prek check, run:

poetry run prek install

And to run all checks and tests manually, use the following command:

poetry run prek run --all-files

Testing

It uses pytest as the test framework. To run the tests:

poetry run pytest

To update the syrupy snapshot tests:

poetry run pytest --snapshot-update

License

MIT License

Copyright (c) 2022-2026 Klaas Schoute

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release files for easyenergy 3.0.1

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

Source distribution (sdist)

Source distribution for easyenergy 3.0.1
File Size Uploaded
easyenergy-3.0.1.tar.gz 21.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for easyenergy 3.0.1
File Interpreter ABI Platform
easyenergy-3.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 41.4 kB

Release files / easyenergy-3.0.1.tar.gz

Download URL easyenergy-3.0.1.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
54b4a32f177040df60590f48eab600adbea5ec03cdcac9fb9ac56bb3da5df272
BLAKE2b-256 checksum
How to use checksums
2619edb22ae4f2cf05a58a641727a52edb8ccb20c1515a6ee6eb34fc792faaa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 May 9, 2026.

Transparency log

Release files / easyenergy-3.0.1-py3-none-any.whl

Download URL easyenergy-3.0.1-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
490c1d2a4e670d157fcc8b69ee48cf3d9fe103f3b8c6c33d00b86f38a4a52550
BLAKE2b-256 checksum
How to use checksums
932a76b9c4f9b6486763073fe4d916aac32e152504382f80c42e02f9ecb1744a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 May 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.0.1 This release

2 release files

3.0.0

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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