Skip to main content

A highlevel interface for the reporting API

Project description

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)

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

frequenz_reporting_python-0.4.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

frequenz_reporting_python-0.4.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file frequenz_reporting_python-0.4.0.tar.gz.

File metadata

File hashes

Hashes for frequenz_reporting_python-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5cf47d4b6eb13ffe19f4a0ab680948701e43f181cbb3d417529cc2c65e06b9eb
MD5 acd832ed9cc1b771e77cf43c11ec408a
BLAKE2b-256 d617a2c262b881e5f6a6c4e74ab7264892f64f3eff85ea0b8154e10c89c40996

See more details on using hashes here.

Provenance

The following attestation bundles were made for frequenz_reporting_python-0.4.0.tar.gz:

Publisher: ci.yaml on frequenz-floss/frequenz-reporting-python

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

File details

Details for the file frequenz_reporting_python-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for frequenz_reporting_python-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e7e2cbc947937205e767ae7d9d06d55c64f9009737ddca2b1f0fdcfdf0cdc01
MD5 e96f344616ef739f5466645ea39c7fdd
BLAKE2b-256 312014fd339132dcb7a7a9f14c39b4020ca9761eb959a050d367fcf5b03f24f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for frequenz_reporting_python-0.4.0-py3-none-any.whl:

Publisher: ci.yaml on frequenz-floss/frequenz-reporting-python

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