Stores P1 port data in a InfluxDB database, to visualize with Grafana.
Inspired by psy0rz/p1_dsmr_to_influxdb. Uses ndokter/dsmr_parser to read the P1 port data.
NOTE: I switched to PostgreSQL with TimescaleDB for performance, stability and flexibility reasons. This repo is not maintained. See mhvis/p1postgres.
With Docker Compose:
- Copy or download
compose.yaml
to a desired location:wget https://github.com/mhvis/dsmr2influx/raw/master/compose.yaml
. - Modify the configuration as required.
- Run
docker compose up -d
. - To see if the containers have started correctly, use
docker compose logs -f
.
Steps after deployment:
- Open Grafana and add a data source for InfluxDB.
- Create a new dashboard or import the sample at ... .
The Docker image is only for amd64 platforms. To run this image on an arm platform, build it yourself. (TODO: add arm image.)
This command imports data from DSMR-reader into your InfluxDB instance. It requires that the DSMR-reader API is enabled and accessible via the container.
docker compose run app python dsmrreaderimport.py <api-url> <api-key>
Note: when using localhost
as url, because the command runs in a Docker
container, localhost does not refer to the Docker host. Instead use 172.17.0.1
.
When the InfluxDB instance already contains measurements, existing measurements with the same timestamp get overridden. So it is safe to import multiple times.
Each telegram is stored as a telegram
measurement in InfluxDB, and each field
in the telegram is a field on the measurement.
Field keys are the same
as OBIS names,
but in lowercase, for instance electricity_used_tariff_1
and instantaneous_voltage_l1
.
Gas meter readings are stored in a separate measurement named gas_meter
,
because they update less frequent, often every 5 minutes or every hour.
The measurement time is taken from the telegram.
The field reading
contains the value.