Skip to main content

energyid-webhooks

Python package for interfacing with EnergyID Webhooks (supports both V1 and V2 APIs)

Installation

pip install energyid-webhooks

Features

  • V2 API support with device provisioning and claiming
  • Authentication with automatic token renewal
  • Smart sensor bundling for efficient data transmission
  • Async support
  • Full type hints

Type Checking

This package is fully type-hinted and checked with strict mypy settings.

V2 API Usage (Recommended)

The V2 API includes device provisioning, authentication, and smart bundling:

import asyncio
from energyid_webhooks import WebhookClient

# Create the client
client = WebhookClient(
    client_id="your_provisioning_key",
    client_secret="your_provisioning_secret",
    device_id="unique_device_id",
    device_name="My Device",
    reauth_interval=24  # Hours between token refresh
)

async def main():
    # Authenticate with EnergyID
    is_claimed = await client.authenticate()

    if not is_claimed:
        # Device needs to be claimed
        claim_info = client.get_claim_info()
        print(f"Claim your device at {claim_info['claim_url']} with code {claim_info['claim_code']}")
        # Wait for claiming...
        return

    # Add and update sensors
    client.update_sensor("el", 1250.5)  # Electricity consumption
    client.update_sensor("pv", 3560.2)  # Solar production

    # Synchronize with EnergyID
    await client.synchronize_sensors()

    # Or enable automatic synchronization
    client.start_auto_sync(interval_seconds=300)  # Every 5 minutes

    # Don't forget to close when done
    await client.close()

asyncio.run(main())

V1 API Usage (Legacy)

The original API is still available for backward compatibility:

from energyid_webhooks import WebhookClientV1, WebhookPayload

url = "https://app.energyid.eu/integrations/WebhookIn/..."

client = WebhookClientV1(url)

# Post some data to the webhook
data = {
    'remoteId': 'my-solar-inverter',
    'remoteName': 'My Solar Panels',
    'metric': 'solarPhotovoltaicProduction',
    'metricKind': 'total',
    'unit': 'kWh',
    'interval': 'P1D',
    'data': [['2022-10-05T08:00+0200', 0.004]]
}

client.post(data)

V1 Async Usage (Legacy)

import asyncio
from energyid_webhooks import WebhookClientAsyncV1

url = "https://app.energyid.eu/integrations/WebhookIn/..."

client = WebhookClientAsyncV1(url)

async def main():
    data = {
        'remoteId': 'my-solar-inverter',
        'remoteName': 'My Solar Panels',
        'metric': 'solarPhotovoltaicProduction',
        'metricKind': 'total',
        'unit': 'kWh',
        'interval': 'P1D',
        'data': [['2022-10-05T08:00+0200', 0.004]]
    }

    await client.post(data)

asyncio.run(main())

Demo Notebook

See energyid_webhook_demo.ipynb for a complete V2 API demo.

Development

Setup

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Metadata

Release files for energyid-webhooks 0.0.10

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

Source distribution (sdist)

Source distribution for energyid-webhooks 0.0.10
File Size Uploaded Provenance Actions
energyid_webhooks-0.0.10.tar.gz 162.7 kB With provenance Details for energyid_webhooks-0.0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for energyid-webhooks 0.0.10
File Interpreter ABI Platform Actions
energyid_webhooks-0.0.10-py3-none-any.whl Python 3 none any Details for energyid_webhooks-0.0.10-py3-none-any.whl

Total release size: 176.1 kB

Release files / energyid_webhooks-0.0.10.tar.gz

Download URL energyid_webhooks-0.0.10.tar.gz
Size 162.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d57e4e0bcc9015c8a28f3825a38789ae0c301904ca39784afb0de8d98a395dbc
BLAKE2b-256 checksum
How to use checksums
19295d388f6f35583a4a91e3a0e27c236ec6e3ca7d6d6306922ac5809bdd6334
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 Feb 28, 2025.

Transparency log

Release files / energyid_webhooks-0.0.10-py3-none-any.whl

Download URL energyid_webhooks-0.0.10-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc785272e4fdf2606256d1ae24c9409741d2663d907d43a6000c374590abcb38
BLAKE2b-256 checksum
How to use checksums
52bb979630747344c6ed5fe8412daa4b90851147a5d10a3f42986927573a8a50
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 Feb 28, 2025.

Transparency log

Security for energyid-webhooks 0.0.10

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for energyid_webhooks-0.0.10.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 Feb 28, 2025.

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