Skip to main content

Python: Innergrid

Asynchronous Python client that reads the energy and building data that the Innergrid energy management platform publishes over MQTT for a customer site: the grid connection, energy categories, electricity meters and circuits, charge points, the energy manager, spaces, the server and Milesight LoRaWAN sensors.

Installation

pip install innergrid

Usage

import asyncio

from innergrid import Innergrid, Update


def on_update(update: Update) -> None:
    print(update.key, update.data)


async def main() -> None:
    client = Innergrid("192.0.2.10", 1883, topic_prefix="mysite")
    # Check the settings: wait for the first message below the prefix.
    await client.wait_for_data()
    # Runs until the connection is lost; connect again to continue.
    await client.listen(on_update)


asyncio.run(main())

The callback of listen() gets an Update with the data of a topic, or a Removal when the instance of a topic is gone (the platform then publishes an empty message on its topic).

listen() and wait_for_data() raise InnergridAuthError when the broker rejects the login and InnergridConnectionError when the connection fails or is lost. wait_for_data() raises InnergridTimeoutError when no data arrives in time.

Topics

Topic Model
<prefix>/customersites/<id>/live Site
<prefix>/categories/<id>/live Categories
<prefix>/electricitymeters/<id> ElectricityMeter
<prefix>/circuits/<id>/live Circuit
<prefix>/chargepoints/<id> ChargePoint
<prefix>/energymanagers/<id>/state EnergyManager
<prefix>/spaces/<id>/live Space
<prefix>/system SystemStatus
<prefix>/events/chargepoints/<id>/<event> ChargePointEvent
milesight/uplink/<devEUI> MilesightSensor

<prefix> is the slug of the customer site. Every update and removal has a key (<kind>/<id>, for example meter/10005); the latest update of a key replaces the earlier ones. The platform's topics are retained, so the current state of every topic arrives right after subscribing; after that, a topic is published when it changes and every refresh interval (60 seconds by default). The Milesight sensors are not retained and publish every few minutes.

parse_data(kind, id, raw) parses a payload that was stored earlier, for example update.raw, into an Update again.

Climate values that are not plausible, such as -1001.1 °C or 0% humidity, are None; some sensors report those instead of an error.

Development

The project uses uv and prek.

uv sync
uv run prek install
uv run pytest

License

MIT, see LICENSE.

Metadata

Release files for innergrid 0.2.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 innergrid 0.2.0
File Size Uploaded Provenance Actions
innergrid-0.2.0.tar.gz 14.0 kB Without provenance Details for innergrid-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for innergrid 0.2.0
File Interpreter ABI Platform Actions
innergrid-0.2.0-py3-none-any.whl Python 3 none any Details for innergrid-0.2.0-py3-none-any.whl

Total release size: 28.8 kB

Release files / innergrid-0.2.0.tar.gz

Download URL innergrid-0.2.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dbb54b1b5698dfd6261bffb89ac0cd20fe8badbcd70dac104b132b9bdeaf9d84
BLAKE2b-256 checksum
How to use checksums
d90ef20fc93fff2c7492ed52ccd97e14783bf015ec2b169e55d3e9174060b500
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / innergrid-0.2.0-py3-none-any.whl

Download URL innergrid-0.2.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6726c47989605d33b8c36c0fe42fd0b63cce9906a0fe6cf066d5c9e927353daa
BLAKE2b-256 checksum
How to use checksums
bb21fd30c837006195083fff9e960edb4c0aef0cd848af934166d1762985289f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for innergrid 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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