Skip to main content

Light weight python package to interface with EnergyID webhooks

Project description

energyid-webhooks-py

Light weight Python package to interface with EnergyID Webhooks

Installation

pip install energyid-webhooks

Usage

Get your URL at https://app.energyid.eu/integrations/WebhookIn

from energyid_webhooks import WebhookClient

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

client = WebhookClient(url)

# Get some information about the webhook

print(client.get())

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

Async usage

import asyncio
from energyid_webhooks import WebhookClientAsync

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

client = WebhookClientAsync(url)

async def main():
    # Get some information about the webhook

    print(await client.get())

    # 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]]
    }

    await client.post(data)

asyncio.run(main())

Demo Notebook

See demo.ipynb for a demo notebook.

Development

Setup

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

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

energyid-webhooks-0.0.6.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

energyid_webhooks-0.0.6-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page