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())

Demos

See the demos folder for cURL, Python notebook, Node-RED, and Apache NiFi examples.

Node-RED examples include:

Development

Setup

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

energyid_webhooks-0.0.16.tar.gz (121.5 kB view details)

Uploaded Source

Built Distribution

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

energyid_webhooks-0.0.16-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file energyid_webhooks-0.0.16.tar.gz.

File metadata

  • Download URL: energyid_webhooks-0.0.16.tar.gz
  • Upload date:
  • Size: 121.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for energyid_webhooks-0.0.16.tar.gz
Algorithm Hash digest
SHA256 66ccd18e78a6de032a9b6d42a9b0f4df2a3740cb7ad62dbc009c004d57eeee9f
MD5 754a21366e28f1aa3a18971848668ab8
BLAKE2b-256 1346a7534dce976ff48f686a3cf1ebcd0f0e1c3bc687d6928af29da0635b6064

See more details on using hashes here.

Provenance

The following attestation bundles were made for energyid_webhooks-0.0.16.tar.gz:

Publisher: publish.yml on EnergieID/energyid-webhooks-py

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

File details

Details for the file energyid_webhooks-0.0.16-py3-none-any.whl.

File metadata

File hashes

Hashes for energyid_webhooks-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 122dd0a82ef2015fb49671f55665a92d701dbc99923d44f9ee52f84bd3418ce5
MD5 416246ad8a446a8d409f495c994f3aca
BLAKE2b-256 2485a4d8b7ee4a8d2941e81ea7f848b2f2cb79e3b9afe20ad57210fef5c510bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for energyid_webhooks-0.0.16-py3-none-any.whl:

Publisher: publish.yml on EnergieID/energyid-webhooks-py

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

Release history Release notifications | RSS feed

This release

0.0.16 This release

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.10

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 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