How to get Homewizard P1 meter telegrams into DSMR Reader using automations

This post describes how you can get Homewizard P1 meter telegrams from your DSMR smart meter into DSMR Reader using Home Assistant automations and scripts.
Until now I have been using a Raspberry Pi and a P1 USB cable to retrieve the smart meter telegrams.
In 2025 I hope to install a Homewizard plug-in battery. A Homewizard P1 meter is then necessary.

(I have also instructions how to send Homewizard P1 telegrams to xirixiz/dsmr-reader-docker using DSMR Reader plugins. Let me know if you are interested)

Introduction

Homewizard P1 telegrams can be sent to DSMR Reader as follows:

We will use only Home Assistant REST commands to do the integration.

What you need

  • working instances of
    • Home Assistant
    • DSMR Reader
  • a Homewizard P1 meter
    • plugged into your smart meter
    • already configured and visible in the Homewizard Energy app
    • local API enabled
  • IP address Homewizard P1 meter
  • IP address DSMR reader
  • API key DSMR Reader

REST commands

In your Home Assistant configuration.yaml file create the following REST commands

rest_command:
  get_hw_p1_telegram:
    url: "http://{{ip}}/api/v1/telegram"
    method: get

  dsmr_push_telegram:
    url: "http://{{ip}}/api/v1/datalogger/dsmrreading"
    method: post
    payload: "telegram={{telegram}}"
    headers:
      "Authorization": "Token {{ api_key }}"
      "Content-Type": "application/x-www-form-urlencoded"

Script to get a Homewizard raw P1 telegram

Create the following script

alias: Get Homewizard P1 telegram
sequence:
  - service: rest_command.get_hw_p1_telegram
    data:
      ip: "{{ip}}"
    response_variable: response
  - stop: rest command executed
    response_variable: response
fields:
  ip:
    selector:
      text: null
    name: ip
    description: IP address Homewizard P1 meter
    required: true

You can use this script in Developer Tools / Services to check if you can get a telegram successfully.

Script to poll and process a P1 telegram

Create a Home Asssistant script
In the code below:

  • replace 1.2.3.4 with the IP address of your Homewizard P1 meter
  • replace 6.7.8.9:7777 with the correct IP and port of your DSMR Reader
  • replace your_api_key with the DSMR Reader API key
alias: Process P1 telegram
sequence:
  - service: script.get_homewizard_p1_telegram
    data:
      ip: 1.2.3.4
    response_variable: result
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ result.status == 200 }}"
        sequence:
          - service: rest_command.dsmr_push_telegram
            data:
              ip: 6.7.8.9:7777
              telegram: "{{ result.content }}"
              api_key: your_api_key
            response_variable: ret
            enabled: true
  - stop: end of script
    response_variable: result

Automate the process

Create an automation to fetch a telegram.
DSMR v4 meters publish a new telegram (with electricity information) every 10 seconds (use a trigger of /10).
DSMR v5 meter update every second (use a trigger of /1).

alias: Process Homewizard P1 Telegrams
description: ""
trigger:
  - platform: time_pattern
    seconds: /10
condition: []
action:
  - service: script.process_p1_telegram
    response_variable: response
mode: single

1 Like

Would this work without HA? I would prefer a standalone solution.

@elRadix the Docker solution uses a Python script which is called inside DSMR Reader. The solution is scattered around various pages. I will try to write a post next week which summarizes everything

Here is the page that helped me. Part of the instructions is in Dutch HomeWizard P1 As Remote for DSRM-Reader · Issue #301 · xirixiz/dsmr-reader-docker · GitHub