Skip to main content

Reporting Highlevel Interface

Build Status PyPI Package Docs

Introduction

A highlevel interface for the reporting API

Supported Platforms

The following platforms are officially supported (tested):

  • Python: 3.11
  • Operating System: Ubuntu Linux 20.04
  • Architectures: amd64, arm64

Contributing

If you want to know how to build this project and contribute to it, please check out the Contributing Guide.

Installation

# Choose the version you want to install
VERSION=0.3.0
pip install frequenz-reporting-python==$VERSION

Initialize the client

from datetime import datetime

from frequenz.client.common.metric import Metric
from frequenz.client.reporting import ReportingApiClient
from frequenz.reporting._reporting import cumulative_energy

# Change server address
SERVICE_ADDRESS = "grpc://replace-this-with-your-server-url:port"
API_KEY = open('api_key.txt').read().strip()
client = ReportingApiClient(service_address=SERVICE_ADDRESS, key=API_KEY)

Calculate cumulative energy for a single microgrid and component:

If the component does not measure Metric.AC_ACTIVE_ENERGY, set use_active_power=True to utilize Metric.AC_ACTIVE_POWER instead.

A resampling period can be set that alters how NaNs are handled, resulting in varying results. NaN values are ignored in sums, which may lead to significant data loss if many are present in the raw data. There is no universally correct method for handling NaNs, as their causes can vary.

energy_reading = await cumulative_energy(
			client=client,
                        microgrid_id=1,
                        component_id=100,
                        start_time=datetime.fromisoformat("2024-09-01T00:00:00"),
                        end_time=datetime.fromisoformat("2024-09-30T00:00:00"),
                        use_active_power=True,
                        resampling_period=timedelta(seconds=10),
    )

print(energy_reading)

Metadata

Release files for frequenz-reporting-python 0.5.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 frequenz-reporting-python 0.5.0
File Size Uploaded
frequenz_reporting_python-0.5.0.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for frequenz-reporting-python 0.5.0
File Interpreter ABI Platform
frequenz_reporting_python-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / frequenz_reporting_python-0.5.0.tar.gz

Download URL frequenz_reporting_python-0.5.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
16a43883a97eded623ab88feaca0945486e0f55ffc132d5a4e66b176c1bbf5ec
BLAKE2b-256 checksum
How to use checksums
dcab583e53e11ea63838396d07f7d42d201449c260cf208d9297d3fb9cd08558
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jul 23, 2025.

Transparency log

Release files / frequenz_reporting_python-0.5.0-py3-none-any.whl

Download URL frequenz_reporting_python-0.5.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dc721242210b4ef2143eba8ccc9d06bb349ef4da6d0706a0ef53510ee59cb82
BLAKE2b-256 checksum
How to use checksums
24b4f6525bd5ea1f1c006a05a8476c859ac8755f0d92bdb89707ba3fcd52d65a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jul 23, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

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