p1-influx-db
Python package for reading DSMR/P1 telegrams from a smart meter and publishing the parsed values either to InfluxDB 2 over HTTP or to an MQTT broker.
What it does
The package exposes a module named p1_influx_db that reads telegrams from the configured serial device, parses the selected DSMR values, and forwards them using one of these output modes:
influx2: write parsed measurements to InfluxDB 2 using the HTTP APImqtt: publish parsed measurements as JSON messages over MQTT
The active behavior is driven by a TOML configuration file. A packaged example is available at p1_influx_db/example_config.toml.
Requirements
- Python 3.11 or newer
- Access to the P1 serial device exposed by your meter
- One configured output target: InfluxDB 2 or MQTT
Installation
Install from PyPI:
pip install p1-influx-db
Install from source with Poetry:
python -m poetry install
The project metadata currently defines mqtt, influxdb, and publishmethods extras, but the base install already includes both transport dependencies.
Running
Run the module with an explicit config file:
python -m p1_influx_db --config /path/to/config.toml
If --config is omitted, the module falls back to ./p1_influx_db/example_config.toml.
Configuration
The config file must contain:
- a
[p1]section with the serial device settings - either an
[influx2]section or an[mqtt]section
If both [mqtt] and [influx2] are present, the current entrypoint selects MQTT first.
All keys entries under [p1.*] should match DSMR field names exposed by dsmr-parser, such as ELECTRICITY_USED_TARIFF_1 or INSTANTANEOUS_VOLTAGE_L1.
Example configuration:
# TOML-based config
[influx2]
url = "http://localhost:8086"
org = "my-org"
token = "my-token"
[mqtt]
broker = "localhost"
port = 433
client_id = "client_id"
ca_certs = "/etc/certificate/abc"
certfile = "/etc/certificate/abc"
key = "etc/certificate/key"
max_times = 60
[p1]
device = "/dev/serial0"
[p1.electricity]
keys = ["ELECTRICITY_USED_TARIFF_1",
"ELECTRICITY_USED_TARIFF_2",
"ELECTRICITY_DELIVERED_TARIFF_1",
"ELECTRICITY_DELIVERED_TARIFF_2"]
[p1.electricity_current]
keys = ["CURRENT_ELECTRICITY_USAGE",
"CURRENT_ELECTRICITY_DELIVERY",
"INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE",
"INSTANTANEOUS_ACTIVE_POWER_L2_POSITIVE",
"INSTANTANEOUS_ACTIVE_POWER_L3_POSITIVE",
"INSTANTANEOUS_ACTIVE_POWER_L1_NEGATIVE",
"INSTANTANEOUS_ACTIVE_POWER_L2_NEGATIVE",
"INSTANTANEOUS_ACTIVE_POWER_L3_NEGATIVE"]
[p1.voltage]
keys = ["INSTANTANEOUS_VOLTAGE_L1",
"INSTANTANEOUS_VOLTAGE_L2",
"INSTANTANEOUS_VOLTAGE_L3"]
[p1.current]
keys = ["INSTANTANEOUS_CURRENT_L1",
"INSTANTANEOUS_CURRENT_L2",
"INSTANTANEOUS_CURRENT_L3"]
[p1.gas]
keys = ["HOURLY_GAS_METER_READING"]
Output behavior
- InfluxDB mode reads the
influx2configuration from the same TOML file and writes parsed measurements asynchronously. - MQTT mode publishes JSON payloads under topics prefixed with
p1/. - MQTT TLS certificates are required by the current client implementation because TLS is always enabled.
Metadata
Release files for p1-influx-db 3.0.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 |
|---|---|---|---|---|
| p1_influx_db-3.0.0.tar.gz | 19.8 kB | With provenance | Details for p1_influx_db-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| p1_influx_db-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for p1_influx_db-3.0.0-py3-none-any.whl |
Total release size: 42.1 kB
Release files / p1_influx_db-3.0.0.tar.gz
| Download URL | p1_influx_db-3.0.0.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ef94470ae7dc285f6c5c5672a509a3e0f810ee44b1daa47caa4cf1a04fdf31a
|
|
BLAKE2b-256 checksum How to use checksums |
1e472afecf60db85b9d15c167f8f18c8026f7c1f1ecc5f721f68b6baa66620b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 May 11, 2026.
Transparency logRelease files / p1_influx_db-3.0.0-py3-none-any.whl
| Download URL | p1_influx_db-3.0.0-py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
638056292ce59a0606117762a5c2c54c3231cde3f17c2e9da35ce7301dd468ab
|
|
BLAKE2b-256 checksum How to use checksums |
a7140516735197ff8ca10f1f4eebd8b4f2449716185188154ae01ffd85f411df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 May 11, 2026.
Transparency logSecurity for p1-influx-db 3.0.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for p1_influx_db-3.0.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 May 11, 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.