De Dietrich/Diematic (Modbus) to MQTT Interface

Ok,
I’m not an expert on those topics at all but that is how I got it running:

Dockerfile

ARG BUILD_FROM
FROM $BUILD_FROM

ENV LANG C.UTF-8

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install requirements for add-on
RUN \
    apk add --no-cache \
         python3 \
             py3-pip

RUN python3 -m venv .venv
RUN source .venv/bin/activate \
		 && pip install pytz \
		 && pip install paho-mqtt

# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh

COPY src/ /

CMD [ "/run.sh" ]

run.sh

.venv/bin/python3 Diematic32MQTT.py

Hope it works for you!

Sebastian

It’s up and running!!!

Thank you very much, I’ve been messing around with the addon topic for a long time but since I’m not a programmer I didn’t move it, I started Diematic through the console.

Great to hear.

Which RS485 converter do you use?

https://community.home-assistant.io/t/de-dietrich-diematic-modbus-to-mqtt-interface/363086/90

I have successfully tested a EW11a adapter.
All adapters from Elfin should be ok (common firmware)

Elfin-EW11 TCP/IP Telnet Protocole Modbus TCP
https://a.aliexpress.com/_EJLDUdw

Just switch to transparent mode instead of Modbus mode. Default packetization delay 50 ms is OK.

I found the reason for my synchronization problems…

The mini din plugs I ordered at aliexpress were the problem. The housing of the plug did not allow the connector to connect properly.

Without the housing, it works like a dream.

Hi, just wondering if you know how to reset a Elfin EE11A. I am not able to see the Elfin Wifi network and the green LED is flashing. Reset was suggested, but there is no documentation on how to do this for this particular unit. Hopefully you know. :slight_smile: Thanks in advance.

Hello,
I have a DE DIETRICH MIT-IN 22/27 / E ISYSTEM heat pump.
I have an RS232 and a DIN connector port, but should I connect my “PUSR RS232 RS485 to Ethernet Modbus RTU to Modbus TCP Gateway Modbus Serial to Ethernet Converter USR-TCP232-410s” to this port or to the DIN connector?

Many thanks for your help.
Best …

Hi @BenoitS,

it seems i have a communication problem.
My USR-TCP232-306 is only receiving data after restart of the heater and i got these logs:

2025-11-21 01:06:18,017 - __main__ - CRITICAL - Modbus interface address: 10.10.20.177 : 20108
2025-11-21 01:06:18,017 - __main__ - CRITICAL - Modbus regulator address: 0xa
2025-11-21 01:06:18,017 - __main__ - CRITICAL - Broker: 10.10.20.10 : 1883
2025-11-21 01:06:18,017 - __main__ - CRITICAL - Topic Root: home/heater/boiler
2025-11-21 01:06:18,017 - __main__ - CRITICAL - Hassio Discovery Enable: True
2025-11-21 01:06:18,017 - __main__ - CRITICAL - Hassio Discovery Prefix: homeassistant
2025-11-21 01:06:18,017 - __main__ - CRITICAL - Regulator type is Diematic3
2025-11-21 01:06:18,029 - Diematic - INFO - Using tzinfo ('CET') for Boiler time sync
2025-11-21 01:06:18,030 - Diematic - WARNING - Init Link with Regulator
2025-11-21 01:06:18,131 - __main__ - DEBUG - Paho MQTT version 2.XX or more detected, using callback API version2
2025-11-21 01:06:18,142 - __main__ - CRITICAL - Connected to MQTT broker
2025-11-21 01:06:18,142 - __main__ - INFO - Publish :home/heater/boiler/status Offline
2025-11-21 01:06:58,189 - Diematic - WARNING - Synchro timeout
2025-11-21 01:06:58,193 - __main__ - INFO - Publish :home/heater/boiler/date 
2025-11-21 01:06:58,196 - __main__ - INFO - Publish :home/heater/boiler/lastTimeSync 
2025-11-21 01:06:58,200 - __main__ - INFO - Publish :home/heater/boiler/type 
2025-11-21 01:06:58,202 - __main__ - INFO - Publish :home/heater/boiler/ctrl 
2025-11-21 01:06:58,203 - __main__ - INFO - Publish :home/heater/boiler/ext/temp 
2025-11-21 01:06:58,204 - __main__ - INFO - Publish :home/heater/boiler/temp 
2025-11-21 01:06:58,206 - __main__ - INFO - Publish :home/heater/boiler/targetTemp 
2025-11-21 01:06:58,208 - __main__ - INFO - Publish :home/heater/boiler/returnTemp 
2025-11-21 01:06:58,209 - __main__ - INFO - Publish :home/heater/boiler/waterPressure 
2025-11-21 01:06:58,210 - __main__ - INFO - Publish :home/heater/boiler/power 
2025-11-21 01:06:58,211 - __main__ - INFO - Publish :home/heater/boiler/smokeTemp 
2025-11-21 01:06:58,213 - __main__ - INFO - Publish :home/heater/boiler/ionizationCurrent 
2025-11-21 01:06:58,214 - __main__ - INFO - Publish :home/heater/boiler/fanSpeed 
2025-11-21 01:06:58,216 - __main__ - INFO - Publish :home/heater/boiler/burnerStatus 
2025-11-21 01:06:58,216 - __main__ - INFO - Publish :home/heater/boiler/pumpPower 
2025-11-21 01:06:58,217 - __main__ - INFO - Publish :home/heater/boiler/alarm 
2025-11-21 01:06:58,218 - __main__ - INFO - Publish :home/heater/boiler/nbImpuls 
2025-11-21 01:06:58,219 - __main__ - INFO - Publish :home/heater/boiler/fctBrul 
2025-11-21 01:06:58,219 - __main__ - INFO - Publish :home/heater/boiler/hotWater/pump 
2025-11-21 01:06:58,220 - __main__ - INFO - Publish :home/heater/boiler/hotWater/temp 
2025-11-21 01:06:58,220 - __main__ - INFO - Publish :home/heater/boiler/hotWater/mode 
2025-11-21 01:06:58,220 - __main__ - INFO - Publish :home/heater/boiler/hotWater/dayTemp 
2025-11-21 01:06:58,221 - __main__ - INFO - Publish :home/heater/boiler/hotWater/nightTemp 
2025-11-21 01:06:58,223 - __main__ - INFO - Publish :home/heater/boiler/zoneA/temp 
2025-11-21 01:06:58,224 - __main__ - INFO - Publish :home/heater/boiler/zoneA/mode 
2025-11-21 01:06:58,224 - __main__ - INFO - Publish :home/heater/boiler/zoneA/pump 
2025-11-21 01:06:58,224 - __main__ - INFO - Publish :home/heater/boiler/zoneA/dayTemp 
2025-11-21 01:06:58,226 - __main__ - INFO - Publish :home/heater/boiler/zoneA/nightTemp 
2025-11-21 01:06:58,226 - __main__ - INFO - Publish :home/heater/boiler/zoneA/antiiceTemp 
2025-11-21 01:06:58,227 - __main__ - INFO - Publish :home/heater/boiler/zoneB/temp 
2025-11-21 01:06:58,228 - __main__ - INFO - Publish :home/heater/boiler/zoneB/mode 
2025-11-21 01:06:58,229 - __main__ - INFO - Publish :home/heater/boiler/zoneB/pump 
2025-11-21 01:06:58,230 - __main__ - INFO - Publish :home/heater/boiler/zoneB/dayTemp 
2025-11-21 01:06:58,231 - __main__ - INFO - Publish :home/heater/boiler/zoneB/nightTemp 
2025-11-21 01:06:58,232 - __main__ - INFO - Publish :home/heater/boiler/zoneB/antiiceTemp 
2025-11-21 01:06:58,234 - Diematic - WARNING - Init Link with Regulator
2025-11-21 01:07:38,392 - Diematic - WARNING - Synchro timeout
2025-11-21 01:07:38,394 - Diematic - WARNING - Init Link with Regulator
2025-11-21 01:07:47,279 - DDModbus - DEBUG - Frame received: 14030065000196d000
2025-11-21 01:07:47,280 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:47,280 - DDModbus - DEBUG - frame.modbusAddress: 20
2025-11-21 01:07:47,280 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:47,280 - Diematic - DEBUG - Bus status switched to SLAVE
2025-11-21 01:07:47,629 - DDModbus - DEBUG - Frame received: 150300650001970100
2025-11-21 01:07:47,629 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:47,629 - DDModbus - DEBUG - frame.modbusAddress: 21
2025-11-21 01:07:47,629 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:47,905 - DDModbus - DEBUG - Frame received: 160300650001973200
2025-11-21 01:07:47,906 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:47,906 - DDModbus - DEBUG - frame.modbusAddress: 22
2025-11-21 01:07:47,906 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:48,143 - DDModbus - DEBUG - Frame received: 17030065000196e300
2025-11-21 01:07:48,143 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:48,143 - DDModbus - DEBUG - frame.modbusAddress: 23
2025-11-21 01:07:48,143 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:48,407 - DDModbus - DEBUG - Frame received: 180300650001961c00
2025-11-21 01:07:48,407 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:48,407 - DDModbus - DEBUG - frame.modbusAddress: 24
2025-11-21 01:07:48,407 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:48,649 - DDModbus - DEBUG - Frame received: 19030065000197cd00
2025-11-21 01:07:48,649 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:48,649 - DDModbus - DEBUG - frame.modbusAddress: 25
2025-11-21 01:07:48,649 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:48,916 - DDModbus - DEBUG - Frame received: 1a030065000197fe00
2025-11-21 01:07:48,916 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:48,916 - DDModbus - DEBUG - frame.modbusAddress: 26
2025-11-21 01:07:48,916 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:49,158 - DDModbus - DEBUG - Frame received: 1b0300650001962f00
2025-11-21 01:07:49,159 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:49,159 - DDModbus - DEBUG - frame.modbusAddress: 27
2025-11-21 01:07:49,159 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:49,371 - DDModbus - DEBUG - Frame received: 1c0300650001979800
2025-11-21 01:07:49,371 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:49,371 - DDModbus - DEBUG - frame.modbusAddress: 28
2025-11-21 01:07:49,372 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:49,693 - DDModbus - DEBUG - Frame received: 1d0300650001964900
2025-11-21 01:07:49,694 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:49,694 - DDModbus - DEBUG - frame.modbusAddress: 29
2025-11-21 01:07:49,694 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:49,970 - DDModbus - DEBUG - Frame received: 1e0300650001967a00
2025-11-21 01:07:49,970 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:49,970 - DDModbus - DEBUG - frame.modbusAddress: 30
2025-11-21 01:07:49,970 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:50,213 - DDModbus - DEBUG - Frame received: 1f030065000197ab00
2025-11-21 01:07:50,213 - DDModbus - DEBUG - modbusSlaveAddress: 0
2025-11-21 01:07:50,213 - DDModbus - DEBUG - frame.modbusAddress: 31
2025-11-21 01:07:50,213 - DDModbus - DEBUG - slave address is not matching expected list
2025-11-21 01:07:52,716 - Diematic - DEBUG - Bus status switched to MASTER after 5.435857534408569
2025-11-21 01:07:52,716 - Diematic - INFO - ModBus Master Slave Synchro OK
2025-11-21 01:07:52,716 - DDModbus - DEBUG - Send read request: 0a030001003f556100
2025-11-21 01:07:52,901 - DDModbus - DEBUG - Answer received: 0a037e4000b80a0080000200070005800700b9001e000100040001000000d200aa003c006880010003001100000a0f00d200b4003c0068800100030009012c01f40000016c0a0000c800a0003c006880fd
2025-11-21 01:07:52,901 - DDModbus - WARNING - Answer Length Error
2025-11-21 01:07:52,901 - Diematic - WARNING - ModBus Master Slave Synchro Error
2025-11-21 01:08:18,938 - Diematic - WARNING - Synchro timeout
2025-11-21 01:08:18,940 - Diematic - WARNING - Init Link with Regulator
2025-11-21 01:08:59,098 - Diematic - WARNING - Synchro timeout

Do you or anyone has an idea?

Thanks in advance,
Jürgen

Hello,
It should mean the frame is to short regarding the length provided at the beginning (could check as the frame follow the modbus protocol)

As recent rs485 to ethernet converter has settîngs to define max frame length, the solution can be to adjust this setting.
Benoit

@BenoitS I’m using a USR-TCP232-306 which has a fixed maximum frame length of 400 bytes.

Here is my config:

Hi all,
I’am a new user with HA and it is not easy… where can i find a help in order to install this in my HA OS ?
Thanks

Hi,

I’m using Diematic4 with a EW11 converter.
It was working fine for months.

But sometimes, RS485 communication seems to broke: nothing more received from the Diematic4.
Rebooting the EW11 (or unplugging for minutes) does not solve the issue.
Only rebooting Diematic4 (powering off/on the whole boiler) fixes the problem.

Is anyone experiencing the same Diematic4 problem ?

Hi,

Some hints provided here:

My Modbus communication also freezes occasionally, sometimes for a month, other times for a week. In my case, restarting the Diematic add-on is enough. I’ve set up an automation that restarts the add-on after three minutes of no communication, along with a notification.

# Restart dodatku Diematic 3 przy braku aktualizacji stempla czasu przez trzy minuty (błędy komunikacji)
alias: "Restart Diematic 3 addon"
id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
description: "Restarts Diematic 3 addon if sensor stops updating, only when addon is enabled"
triggers:
  - trigger: time_pattern
    minutes: /1
condition:
  - condition: and
    conditions:
      - condition: state
        entity_id: binary_sensor.diematic_status
        state: "on"
      - condition: template
        value_template: >-
          {% set now = as_timestamp(now()) %}
          {% set last_updated_str = states('sensor.heater_datetime') %}
          {% set last_updated = as_timestamp(strptime(last_updated_str, '%d/%m/%Y %H:%M')) %}
          {{ (now - last_updated) > 185 }}
action:
  - action: hassio.addon_restart
    data:
      addon: local_diematic_3
  - action: system_log.write
    data:
      message: >
        Diematic 3 restart
      level: info
  - delay:
      seconds: 5
  - action: notify.mobile_app_xxx
    data:
      message: "Restart dodatku Diematic 3"
mode: single

Monitoring last update from heater time is a really good idea.

In my case, the diematic script is running in a docker container.
When communication broke (for Diematic 4) the script usually stops with an exception. I set a restart policy for the docker container for this precise case.

But sometimes, the script looses sync with the heater with no exception:
This log message is repeated hundreds of time

2026-01-18 21:43:37,720 - DDModbus - WARNING - Received Frame Length Error: 0max is: 258
2026-01-18 21:43:38,221 - DDModbus - WARNING - Received Frame Length Error: 0max is: 258
2026-01-18 21:43:38,722 - DDModbus - WARNING - Received Frame Length Error: 0max is: 258
2026-01-18 21:43:39,223 - DDModbus - WARNING - Received Frame Length Error: 0max is: 258
2026-01-18 21:43:39,724 - DDModbus - WARNING - Received Frame Length Error: 0max is: 258
2026-01-18 21:43:40,225 - DDModbus - WARNING - Received Frame Length Error: 0max is: 258
2026-01-18 21:43:40,726 - DDModbus - WARNING - Received Frame Length Error: 0max is: 258
2026-01-18 21:43:41,227 - DDModbus - WARNING - Received Frame Length Error: 0max is: 258

I will monitor the Diematic last update time with HA and restart the container in this case.
Thank you for the tip.

This is exactly what’s happening for me; I forgot to add a small note.
The fourth line contains a condition that makes the script dependent on the heater being on, so that the script doesn’t execute if the heater is off.
For this purpose, I created binary_sensor:

mqtt:
  - binary_sensor:
      - unique_id: "diematic status"
        name: "Diematic status"
        icon: mdi:checkbox-marked
        state_topic: "home/heater/boiler/status"
        payload_on: "Online"
        payload_off: "Offline"
        qos: 0

Hi,
Trying to post the boiler data into https://emoncms.org/ using emoncms integration with something like :

emoncms_history:
  api_key: xxxxxxxxxxxxxxxxx
  url: https://emoncms.org
  inputnode: 19
  scan_interval: 30
  whitelist:
    - sensor.boiler_temp
    - sensor.ext_temp
    - sensor.hot_water_temp
    - sensor.return_temp
    - sensor.zone_b_temp
    - .....

Therefore I am laking of the correct data for water flow rate (in cuM/hr ?), I only get a fix value 65535 in “sensor.pump_power”. Any clue on why ?

Thanks,

Hello,
Thank you @BenoitS for your work and all members that contributed here.
I integrated the service as an HAOS local add-on.

thank you and regards.

Eric

:+1:
Can you publish a tuto ? Here or propose it in the github Wiki ?
Benoit