A reader and prometheus exporter for smart meters
Project description
P1 Reader and Prometheus Exporter
A simple reader and Prometheus exporter to expose metric from Belgian/Dutch digital smart meters over the P1 port.
Usage
$ pip install p1exporter
$ p1exporter
ts=2022-03-08T19:08:26 level=INFO caller=__main__ msg=Got telegram with 22 keys
ts=2022-03-08T19:08:27 level=INFO caller=__main__ msg=Got telegram with 22 keys
...
$ curl localhost:8080
...
# HELP p1_electricity_power_in_kw Instantaneous electricity power delivered to client (+P) in kW
# TYPE p1_electricity_power_in_kw gauge
p1_electricity_power_in_kw 0.511
# HELP p1_electricity_power_out_kw Instantaneous electricity power delivered by client (-P) in kW
# TYPE p1_electricity_power_out_kw gauge
p1_electricity_power_out_kw 0.0
...
>>> from p1exporter import P1Reader
>>> with P1Reader() as p1_reader:
... p1_reader.read()
...
{'0-0:96.1.4': '50216', '0-0:96.1.1': '3153414731313030323932303039', '0-0:1.0.0': '220308191245W', '1-0:1.8.1': '000877.698', '1-0:1.8.2': '000841.449', '1-0:2.8.1': '000000.000', '1-0:2.8.2': '000000.021', '0-0:96.14.0': '0001', '1-0:1.7.0': '00.492', '1-0:2.7.0': '00.000', '1-0:21.7.0': '00.492', '1-0:22.7.0': '00.000', '1-0:32.7.0': '240.4', '1-0:31.7.0': '002.85', '0-0:96.3.10': '1', '0-0:17.0.0': '999.9', '1-0:31.4.0': '999', '0-0:96.13.0': '', '0-1:24.1.0': '003', '0-1:96.1.1': '37464C4F32313231303236323333', '0-1:24.4.0': '1', '0-1:24.2.3': '01225.316'}
Todo
- Run tests in CI
- Configurable serial device
- Configurable listen address:port
References:
- https://www.netbeheernederland.nl/_upload/Files/Slimme_meter_15_a727fce1f1.pdf
- https://maakjemeterslim.be/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBclFDIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--6287e20f84bfe127b2c7687ff4e82e3f32394293/e-MUCS%20-%20P1%20v%201.4.pdf?disposition=attachment
- https://jensd.be/1183/linux/read-data-from-the-belgian-digital-meter-through-the-p1-port
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file p1exporter-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: p1exporter-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9db8137900abf0e4a10631d424f70b7f761b97318f5e497923d9d24f0c0e35ee |
|
MD5 | 51405f90e497090b0c690fb68fcfe85c |
|
BLAKE2b-256 | db77557729d39870ef232159c7f1acd76780c92de64002f17ceef9dbbf0ab191 |