Skip to main content

Enea Client

test workflow

A standalone Python script for downloading hourly energy consumption data from the Enea customer portal (ebok.enea.pl). This tool automates the process of logging into the Enea portal, retrieving hourly energy consumption data for a given month in CSV format, and optionally running post-processing scripts (which can be used later, for example, to import data into Home Assistant or other systems).

The story behind this project, covering both the motivation and the process, is described in this blog post.

Requirements

  • Python 3.9 or higher, no external packages needed - only standard library modules are used.
  • Valid Enea ebok customer account credentials and an energy meter that supports real-time data reporting (check if you have data available at https://ebok.enea.pl/meter/summaryBalancingChart).

Usage

Installation

Package is available on PyPI, so you can install it with pip:

pip install enea-client

Basic Usage

Download specific months in CSV format. Raw CSV data is saved to the specified output directory without sanitization. Optionally, a post-processing script can sanitize and transform the downloaded files.

python -m enea_client \
    --enea-login your-email@example.com \
    --enea-password your-password \
    --enea-pod-guid your-pod-guid \
    --output-dir ./energy_data \
    --dates 12.2025,01.2026 \
    --post-process-script ./process_data.sh \
    --verbose

Where command line arguments are:

  • --enea-login: Your Enea portal email
  • --enea-password: Your Enea portal password
  • --enea-pod-guid: Your Point of Delivery GUID (found in your Enea account). See "Finding Your POD GUID" section below
  • --output-dir: Directory to save downloaded CSV files
  • --dates: Comma-separated list of months to download (format: MM.YYYY)
  • --post-process-script: (Optional) Path to a script that will be executed after download completes, receiving paths to all generated CSV files as arguments
  • --verbose: (Optional) Enable verbose logging for debugging purposes

Finding Your POD GUID

This example uses the Chrome browser:

  1. Log into your Enea customer portal and navigate to https://ebok.enea.pl/meter/summaryBalancingChart.
  2. Open browser developer tools and go to the Network tab.
  3. Choose a day with available data and click to download CSV data.
  4. Find request named csv in the Network tab.
  5. The pointOfDeliveryId parameter in the request URL is your POD GUID (see screenshot below).

Finding POD GUID

Output Format

The script saves the CSV string returned by the Enea API for each specified month in a separate file in the output directory. It does not remove placeholder rows, NUL bytes, or Excel-style wrappers, and decimal values retain their commas. An example output file for January 2026 would look like this (actual NUL bytes are shown as \0 for readability):

Data;"Wolumen energii elektrycznej pobranej z sieci przed bilansowaniem godzinowym";"Wolumen energii elektrycznej oddanej do sieci przed bilansowaniem godzinowym";"Wolumen energii elektrycznej pobranej z sieci po bilansowaniu godzinowym";"Wolumen energii elektrycznej oddanej do sieci po bilansowaniu godzinowym"
\0"=""2026-01-01 00:59"""\0;"0,123";"0";"0,123";"0"
\0"=""2026-01-01 01:59"""\0;"0,124";"0";"0,124";"0"

Post-processing Scripts

If you specify a --post-process-script, it will be executed after all data has been downloaded. The script receives the paths of all raw CSV files as command-line arguments. Without a post-processing script, no sanitization takes place.

The example scripts/post_process_script.sh removes NUL bytes, then uses scripts/enea_to_home_assistant.awk to drop rows containing "---", remove Excel-style wrappers, and convert commas between digits to decimal points before generating a Home Assistant statistics CSV. Downloaded input files remain unchanged. Keep both files together in the same directory when deploying the example; the Bash script locates the converter relative to itself, regardless of the working directory.

The example requires Bash, tr, awk, GNU-compatible sed (for sed -i), and curl. Set these environment variables:

  • ENEA_CLIENT_POST_PROCESS_HOME_ASSISTANT_CONFIG_DIR: Home Assistant configuration directory where the processed CSV will be written.
  • ENEA_CLIENT_POST_PROCESS_OUTPUT_PATH: Output filename relative to that directory, also sent to Home Assistant for import.
  • ENEA_CLIENT_POST_PROCESS_HOME_ASSISTANT_TOKEN: Home Assistant access token.

The example imports into Home Assistant at http://localhost:8123. The scripts are provided in this repository, not included in the Python package.

Security Considerations

Consider using environment variables instead of command-line arguments for sensitive data. See .env.example for reference and advanced usage tab below.

Advanced Usage

Download data automatically every day, then process the data with custom scripts and import it into your Home Assistant energy tab.

  1. Configure custom Home Assistant sensors for export and import energy data. Since data is available with a few days delay, a custom integration is needed to import data. See Home Assistant Statistics Integration for details. Example:

    a. Create template sensors in your configuration.yaml:

    template:
        - sensor:
            - name: Grid import energy
             unique_id: grid_import_energy
             state: 0
             unit_of_measurement: "kWh"
             device_class: energy
             state_class: total_increasing
    
            - name: Grid export energy
             unique_id: grid_export_energy
             state: 0
             unit_of_measurement: "kWh"
             device_class: energy
             state_class: total_increasing
    

    b. Import one point with value 0 for each sensor to initialize it. The date should be the start of the statistics period. All future data will append to this initial value.

    Example of import CSV file in the format expected by the Home Assistant Statistics Integration:

    statistic_id,unit,start,delta
    sensor.grid_import_energy,kWh,2026-01-01 00:00,0.618
    sensor.grid_export_energy,kWh,2026-01-01 00:00,0
    sensor.grid_import_energy,kWh,2026-01-01 01:00,0.581
    sensor.grid_export_energy,kWh,2026-01-01 01:00,0
    
  2. Create a post-processing script that processes the downloaded CSV files and imports them into your home assistant installation. See scripts/post_process_script.sh for an example.

  3. Create a systemd service and timer to run the script daily. See scripts/enea_client.service and scripts/enea_client.timer for examples.

Development

Install with test dependencies:

pip install -e .[test]

Run tests with coverage:

coverage run -m pytest -v

Caveats

The purpose of this tool is to provide a simple way to download energy consumption data from the Enea portal and integrate it into other systems. It is not an official Enea product and is not affiliated with Enea in any way. Use at your own risk.

Contributing

This is a standalone tool with no external dependencies. Contributions are welcome!

Metadata

Release files for enea-client 0.1.2

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

Source distribution (sdist)

Source distribution for enea-client 0.1.2
File Size Uploaded Provenance
enea_client-0.1.2.tar.gz 7.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for enea-client 0.1.2
File Interpreter ABI Platform
enea_client-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 kB

Release files / enea_client-0.1.2.tar.gz

Download URL enea_client-0.1.2.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7b4a7a252536404448fb3c35a494d4bc91bcc4516f150abd22033a009048acfc
BLAKE2b-256 checksum
How to use checksums
0a2a454fd8566921db9d1780a018c499e3953ade41b67b91e84573e40c60a2cb
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 Oct 11, 2026.

Transparency log

Release files / enea_client-0.1.2-py3-none-any.whl

Download URL enea_client-0.1.2-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d87524ee7d9915ec9fcf95f74fc2b3a00532b11394275bd4edea9b8882f51c59
BLAKE2b-256 checksum
How to use checksums
a04ae3654f358744aebb0116917ef2ab6cd70ce6126f2722dc8688ed16c3cf09
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 Oct 11, 2026.

Transparency log

Security for enea-client 0.1.2

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for enea_client-0.1.2.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 Oct 11, 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