SmartHomeShop Docs

DSMR Reader (Docker)

DSMR Reader is an optional, self-hosted application for storing raw P1 telegrams and analysing electricity and gas usage over a longer period. It runs as a separate container service on a server, NAS or Raspberry Pi. With the optional ESPHome package, P1MeterKit can forward a copy of each raw P1 telegram to DSMR Reader through your local network.

DSMR Reader is not a SmartHomeShop or Home Assistant app. It is a separate application that you install and maintain yourself. It is not required for the SmartHomeShop App, Home Assistant or the normal operation of P1MeterKit.

What Is This For?

Use DSMR Reader when you want:

  • a separate, locally hosted archive of raw smart-meter readings;
  • DSMR Reader dashboards, comparisons and tariff calculations;
  • access to the original telegram data outside Home Assistant;
  • to retain this additional history in a database on hardware you manage.

The data follows this route:

  1. The smart meter sends a raw DSMR telegram through its P1 port.
  2. P1MeterKit processes the telegram for its normal ESPHome, Home Assistant and optional SmartHomeShop functions.
  3. The optional package sends an authenticated HTTP copy over the local network.
  4. DSMR Reader stores and visualises the reading in its own database.

The DSMR Reader project is free for non-commercial use. Review its current license before using it in a commercial or business environment.

What Is and Is Not Forwarded?

The package forwards the complete raw P1 telegram. DSMR Reader can therefore process values present in the telegram, including:

  • electricity import per tariff;
  • electricity feed-in per tariff;
  • current power and meter status information;
  • gas or another supported M-Bus reading when supplied by the smart meter.

P1MeterKit measurements that are not part of the raw telegram are not forwarded:

  • temperature and humidity;
  • WiFi and diagnostic information;
  • calculated SmartHomeShop or Home Assistant entities.

The normal P1MeterKit entities remain available. This package adds forwarding; it does not replace the existing integrations.

Requirements

Before starting, you need:

  • a working P1MeterKit using WiFi firmware;
  • the device adopted in ESPHome Device Builder, so you can edit and install custom YAML;
  • a DSMR Reader container reachable from P1MeterKit on the local network;
  • the DSMR Reader REST API enabled and its API key;
  • access to the secrets.yaml file in ESPHome Device Builder.

DSMR Reader forwarding is not supported by the Thread firmware. HTTP forwarding adds memory, firmware size and network load on every supported hardware model. The current WiFi configurations compile successfully, but some models retain little firmware partition headroom after this package is added. Always validate the complete YAML before installing it and monitor the device logs and stability afterwards.

1. Install DSMR Reader

Install DSMR Reader on a separate Docker- or Podman-capable host. Follow the official DSMR Reader container installation guide.

For an API-fed setup:

  1. Complete the container and database installation.
  2. Expose the DSMR Reader web interface only to your local network. For example: http://192.168.1.10:7777.
  3. Remove or disable the direct /dev/ttyUSB0 device mapping in the Compose file when DSMR Reader does not use its own P1 cable.
  4. Confirm that you can open the web interface and sign in.

The official guide uses Podman, but also states that Docker and compatible Compose implementations can be used.

2. Enable the REST API

The DSMR Reader REST API is disabled by default.

  1. Sign in to DSMR Reader.
  2. Open Configuration.
  3. Enable the REST API.
  4. Copy the generated API key.

P1MeterKit sends readings to:

http://<docker-host>:7777/api/v1/datalogger/dsmrreading

The request uses an Authorization: Token ... header and sends the URL-encoded raw telegram in the telegram form field.

3. Store the API Key in ESPHome

Open secrets.yaml in ESPHome Device Builder and add:

dsmr_reader_api_key: "your_dsmr_reader_api_token"

Do not publish this file or paste the real key into a public support request. The key is compiled into the device firmware.

4. Add the Forwarding Package

Open the YAML of your adopted P1MeterKit. Keep its existing P1MeterKit package and add the host, API key and DSMR Reader package:

substitutions:
  dsmr_reader_host: "http://192.168.1.10:7777"
  dsmr_reader_api_key: !secret dsmr_reader_api_key

packages:
  smarthomeshop.dsmr_reader:
    github://smarthomeshop/p1meterkit/packages/dsmr-reader.yaml@main

Replace 192.168.1.10 with the fixed local IP address or resolvable hostname of your DSMR Reader host. Do not remove the existing smarthomeshop.p1meterkit entry from your adopted configuration.

The forwarding package:

  • reads the complete, unparsed telegram from ESPHome's DSMR component;
  • URL-encodes the telegram;
  • sends it as an authenticated HTTP POST;
  • accepts only an HTTP 2xx response as successful;
  • logs transport failures and rejected HTTP responses separately.

5. Validate and Install

  1. Select Validate in ESPHome Device Builder.
  2. Resolve any duplicate packages, substitutions or http_request configuration errors.
  3. Install the configuration wirelessly or over USB.
  4. Open Logs for P1MeterKit.
  5. Wait for a new P1 telegram.
  6. Check DSMR Reader for a recent reading.

A successful request logs:

DSMR Reader accepted telegram

An HTTP error logs the returned status code. A network or connection failure logs:

DSMR Reader upload failed

Failed telegrams are not queued for later delivery. An unreachable server can delay processing while the HTTP request waits for its timeout, so remove the optional package or restore the server when failures continue.

Security and Reliability

  • Keep DSMR Reader and port 7777 on your trusted local network. Do not expose it directly to the internet.
  • The package disables TLS certificate verification for compatibility across the supported hardware. Use the documented local HTTP endpoint on a trusted network; do not treat this connection as secure internet transport.
  • Give the container host a fixed DHCP reservation so its configured address does not change.
  • Store the API key only in secrets.yaml.
  • Back up the DSMR Reader database according to its documentation.
  • Prefer reliable storage over an SD card for long-term database use.
  • Use one input route per smart meter to prevent duplicate readings.

Troubleshooting

No readings appear

  • Confirm that P1MeterKit itself receives current P1 values.
  • Open the configured DSMR Reader address from another device on the same network.
  • Check that the REST API is enabled.
  • Verify the API key and dsmr_reader_host.
  • Check firewall, VLAN and container port-mapping rules.

DSMR Reader returns 401 or 403

The API key is missing or invalid. Copy the active key from DSMR Reader, update secrets.yaml and reinstall the ESPHome configuration.

DSMR Reader returns 404

Confirm that the host points to DSMR Reader and that the configured URL is not followed by another path. The package appends /api/v1/datalogger/dsmrreading itself.

The device logs DSMR Reader upload failed

P1MeterKit cannot complete the connection. Check the host address, port, DNS resolution, firewall and whether the container is running.

Readings are duplicated

Disable DSMR Reader's serial or network datalogger when the same smart meter already supplies telegrams through this REST API package.

P1MeterKit becomes less responsive

The additional HTTP request consumes memory and processing time for every telegram. Check for repeated connection timeouts, keep DSMR Reader on the same local network and remove the optional package if the hardware does not remain stable.

Official Resources