Skip to main content

Standalone Python tool for downloading hourly energy consumption data from Enea customer portal (ebok.enea.pl)

Project description

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. Files are sanitized and saved to the specified output directory. Optionally, a post-processing script can be specified.

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 data for each specified month in a separate CSV file in the output directory. An example output file for January 2026 would look like this:

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"
"2026-01-01 00:59";"0.123";"0";"0.123";"0"
"2026-01-01 01:59";"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 generated CSV files as command-line arguments.

See example post-processing script post_process_script.sh in the scripts/ directory for reference.

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!

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

enea_client-0.1.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

enea_client-0.1.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file enea_client-0.1.1.tar.gz.

File metadata

  • Download URL: enea_client-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for enea_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ca1a59ecf1ad96d41bd874e6b9325bd2ecdb2d368b3a1138cf323c2794d21c8e
MD5 85d8129ef007f4a5ac83f6bef269a186
BLAKE2b-256 a7133e6b1e89cfc450da9a1e12124990abf8a90d7e60fea968b7cfee47d2dd70

See more details on using hashes here.

Provenance

The following attestation bundles were made for enea_client-0.1.1.tar.gz:

Publisher: publish.yml on zpieslak/enea-client

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

File details

Details for the file enea_client-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: enea_client-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for enea_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e425694c07399cb0e1ef2bc14743e99d4728eff8b9f2d504d1f7c5030a27822e
MD5 e13ed0bb48e10743cb6c45e43b8fbe0a
BLAKE2b-256 241867bf855f460a802ed8b1788e601679285269faff078f8b318058a09e616c

See more details on using hashes here.

Provenance

The following attestation bundles were made for enea_client-0.1.1-py3-none-any.whl:

Publisher: publish.yml on zpieslak/enea-client

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