DSMR Reader Docker and Homewizard P1 meter integration

This post is for people running DSMR Reader in Docker. It describes how to install and configure a DSMR Reader plugin to read Homewizard P1 telegrams and inject these into DSMR Reader. For an alternative solution using Home Assistant automations see How to get Homewizard P1 meter telegrams into DSMR Reader using automations

Prerequisites

Configuration

plugin preparation

Assumption:

  • your docker-compose.yaml file is in the folder “/home/pi/dsmr”

On your Docker host:

  1. create a folder “/home/pi/dsmr/plugins”
  2. inside folder folder “/home/pi/dsmr/plugins” create a file “homewizard_p1.py” with the following contents (replace “1.2.3.4” with the Homewizard P1 meter IP address):
import requests

from django.dispatch import receiver

from dsmr_backend.signals import backend_called
import dsmr_datalogger.services.datalogger


# Preverve a low timeout to prevent the entire backend process from hanging too long.
HOMEWIZARD_ENDPOINT = 'http://1.2.3.4:80/api/v1/telegram'
HOMEWIZARD_TIMEOUT = 5


@receiver(backend_called)
def handle_backend_called(**kwargs):
    response = requests.get(HOMEWIZARD_ENDPOINT,
                            timeout=HOMEWIZARD_TIMEOUT)

    if response.status_code != 200:
        print(' [!] HomeWizard plugin: v1 telegram endpoint failed (HTTP {}): {}'.format(
            response.status_code,
            response.text
        ))
        return

    dsmr_datalogger.services.datalogger.telegram_to_reading(data=response.text)

Docker setup

  1. go to folder “/home/pi/dsmr”
  2. edit your docker-compose.yaml file
  3. add the following definition to the “volumes”: section
- ./plugins/homewizard_p1.py:/app/dsmr_plugins/modules/homewizard_p1.py
  1. add the following definitions to the" environment:" section
- DSMRREADER_OPERATION_MODE=api_server
- DSMRREADER_PLUGINS=dsmr_plugins.modules.homewizard_p1
  1. save the docker-compose.yaml file
  2. to stop DSMR Reader do a
docker-compose down
  1. to start DSMR Reader do a
docker-compose up -d

Original post

The original instructions are (partly in Dutch) on HomeWizard P1 As Remote for DSRM-Reader · Issue #301 · xirixiz/dsmr-reader-docker · GitHub
The Python source code in the original post was missing an import statement. And I grouped all instructions together and translated it into English.