Skip to content

Sends DSMR P1 readings to a PostgreSQL database.

Notifications You must be signed in to change notification settings

mhvis/p1postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P1 to PostgreSQL

Insert DSMR P1 readings in a PostgreSQL database with TimescaleDB.

Docker configuration

See the Docker Compose example for possible environment variables. NOTE: the image is only for amd64, not for Raspberry Pi (arm). Build the image yourself for these platforms.

name: p1postgres

services:
  app:
    image: mhvis/p1postgres
    environment:
      # See https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
      P1_POSTGRES_DSN: postgresql://user:secret@localhost
      # DSMR version. Possible values: V2_2, V4, V5.
      P1_SERIAL_SETTINGS: V5
      # Usually the same as serial settings.
      P1_TELEGRAM_SPECIFICATION: V5
      P1_DEVICE: /dev/ttyUSB0
      # The meter ID in the database. The meter row should exist.
      P1_METER_ID: 1
      # Uncomment to see what's happening
      #P1_DEBUG: 1
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
    restart: unless-stopped

Schema

The required schema can be found in schema/create.sql. Use these SQL scripts to create the tables and insert rows for your meters and energy contracts (to calculate cost information).

TODO: add interesting queries or views.

About

Sends DSMR P1 readings to a PostgreSQL database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published