mygrid-voltbridge
A small typed async Python client for the local HTTP API of the MyGrid VoltBridge P1 meter adapter. Requires Python 3.12+ and aiohttp. Version 0.1.0 has not been published to PyPI.
The API is not documented by the manufacturer. It was reverse-engineered from the device's own status page and verified against one device (firmware voltbridge build 15.6); see docs/api.md. It may change between firmware versions.
Query a meter
The helper is read-only:
uv sync
uv run mygrid-voltbridge 192.168.0.45
uv run mygrid-voltbridge 192.168.0.45 --power
Library
import asyncio
import aiohttp
from mygrid_voltbridge import VoltBridgeClient
async def main() -> None:
async with aiohttp.ClientSession() as session:
client = VoltBridgeClient("192.168.0.45", session)
power = await client.async_get_power() # W, positive = import
print(power.net_power, power.tariff)
data = await client.async_get_p1_data() # full snapshot
print(data.energy_import_t1, data.phases[1].voltage)
asyncio.run(main())
| API | Contract |
|---|---|
async_get_power() |
PowerReading from /api/power; cheap, suitable for ~1 s polling |
async_get_p1_data() |
P1Data from /api/p1data; poll every few seconds at most |
async_listen(callback, host=...) |
Push updates: UDP broadcasts on 49491, about once a second; see below |
parse_datagram(bytes) |
Decode one UDP datagram into a P1Broadcast |
VoltBridgeInfo.from_properties(txt) |
Identify a device from its _mygrid._tcp mDNS TXT record (device_id is the MAC) |
async_get_telegram() |
Telegram from /api/telegram: M-Bus devices (gas, water), breaker, limiter, monthly peak history, CRC check |
async_get_telegram_text() |
The raw telegram string |
async_reboot() |
POST /reboot; never retried |
Push updates
The device also broadcasts its telegram over UDP roughly once per second, so you do not have to poll:
from mygrid_voltbridge import async_listen
transport = await async_listen(lambda b: print(b.data.net_power), host="192.168.0.45")
# ...
transport.close()
host filters by the device's IP; invalid datagrams are dropped. Use port=49492 for the one-minute average stream. uv run mygrid-voltbridge 192.168.0.45 --watch prints the live stream as JSON lines. The broadcast carries no gas reading; use async_get_p1_data() for that. Broadcasts must reach the host, so a container or VLAN may need host networking or a broadcast relay. See docs/api.md for the format.
Power is in W, energy in Wh, voltage in V, current in A; the device reports kW/kWh and the library converts. Fields the meter does not report are None. Errors derive from VoltBridgeError: VoltBridgeConnectionError, VoltBridgeResponseError and VoltBridgeNoDataError (no P1 telegram received yet).
Pass your own aiohttp session, or omit it: the client then creates one limited to a single connection (the device has very little memory) and closes it in close() or when leaving async with VoltBridgeClient(host) as client. Reads are retried twice with exponential backoff; the reboot is never retried. VoltBridgeUnsupportedError means the firmware lacks an endpoint (HTTP 404). There is no authentication or TLS on the device; keep it on the trusted LAN. Per-phase fields other than L1, and export power/energy on the UDP stream, are unverified.
Metadata
Release files for mygrid-voltbridge 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mygrid_voltbridge-0.3.0.tar.gz | 14.2 kB | With provenance | Details for mygrid_voltbridge-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mygrid_voltbridge-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for mygrid_voltbridge-0.3.0-py3-none-any.whl |
Total release size: 32.1 kB
Release files / mygrid_voltbridge-0.3.0.tar.gz
| Download URL | mygrid_voltbridge-0.3.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
921c71a4b18ae17ccfd47f892fe17f6fea0f13f2d327d6335e1d34ec0eda7a3a
|
|
BLAKE2b-256 checksum How to use checksums |
7ba9ac33e2c5048a695bd7ad77099d4a8d13fd776bdbf8b5501b48b299286b2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Oct 23, 2026.
Transparency logRelease files / mygrid_voltbridge-0.3.0-py3-none-any.whl
| Download URL | mygrid_voltbridge-0.3.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
504d6b643d6c23783273dc850d025afd0a413b815e4398a1443fd9bff5b722f2
|
|
BLAKE2b-256 checksum How to use checksums |
db1a2500e3ece251512d6947f2e3755348007d1690fd70e0473b1e6bb80a4562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Oct 23, 2026.
Transparency logSecurity for mygrid-voltbridge 0.3.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mygrid_voltbridge-0.3.0.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 Oct 23, 2026.
Transparency logA 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.