De Dietrich Boiler integration - MODBUS

Nice to hear it! how did you get it to work? My friend could help me integrate the values to HA. If you have it on your custom html page, this mean, there should be an easy way to get it shown in HA. Could you describe how do you connect, what hardware/software are you using?

Yes, everithing is detailed here in the link given above.
Thanks to Benoit3 for his work.

Hi,
I am in the same situation here : I am trying to hook up My De Dietrich Diematic 3 Boiler to Home Assistant.
Using a waveshare RS485 to ethernet adapter, I am able to read out the modbus registers correctly, using the “AVReporter Modbus Communication Tester” software tool. So the hardware/cabling is okay.
Now I am trying read the registers via Home assistant.
Can some share their configuration.yaml? Because the sensor values are not appearing in home assistant for me. (What is the best way to check if the sensors are available?). There are no error log entries.

My config :


modbus:
  - name: "Waveshare"
    type: rtuovertcp
    host: 192.168.2.245
    port: 20108

sensor:
  - platform: modbus
    scan_interval: 10 # in seconds
    registers:
    - name: "My_hours" 
      hub: "Waveshare"
      slave: 10
      register: 4
      Count: 1
      register_type: holding
      data_type: int 
    - name: "My_minutes"
      hub: "Waveshare"
      slave: 10
      register: 5
      count: 1
      register_type: holding
      data_type: int

I have made some progress.
With this configuration : 1 temperature value sometimes is captured (I get a value), and a little later it is unavailable again. I don’t understand why. With the “AVReport Modbus Communication tester”, I can read any register always correctly and instantaniously (< 100ms).
If I define multiple sensors, some get read and they switch back and forth to readable and unavailble. Also the values get mixed between the sensors.
I’ve played around with timeouts, lazy_error_counts, scan_interval, retries,… but nothing helps.
I feel like I’m close, but can’t find a good working configuration.

modbus:
  - name: Waveshare
    type: rtuovertcp
    host: 192.168.2.245
    port: 20108
    retry_on_empty: true
    close_comm_on_error: false
    retries: 10
    timeout: 15
    delay: 2
    sensors:
    - name: Temperatuur_badkamer 
      slave: 10
      address: 18
      count: 1
      input_type: holding
      data_type: int16 
      lazy_error_count: 5
      scale: 0.1
      precision: 1
      unit_of_measurement: '°C'
      device_class: "temperature"
      scan_interval: 20
      

Hi,

It would be helpful to share some logs of the modbus module with only 2-3 registers:

logger:
    default: warning
    logs:
      homeassistant.components.modbus: debug
      pymodbus.client: debug
      pymodbus.transaction: debug
 

I think the problem readable/anavailable may come from lazy_error_count: 5 but the logs will help.

Here is a extract of my configuration working in modbus RTU but without any problem since 2 years :

# Modbus definition serial connection RTU
  - name: modb
    type: serial
    method: rtu
    port: /dev/ttyUSB1
    baudrate: 9600
    stopbits: 1
    bytesize: 8
    parity: N
    retry_on_empty: true
    sensors:
      - name: Chaud_Temp_Ext_Brute
        # en négatif, faire 32768-val_lue
        slave: 10
        address: 601
        input_type: input
        data_type: int16
        scan_interval: 30
      - name: Chaud_Temp_Prim_Dép
        slave: 10
        address: 602
        scan_interval: 30
        input_type: input
        unit_of_measurement: °C
        count: 1
        scale: 0.1
        offset: 0
        precision: 1
        data_type: int16
      - name: Chaud_Temp_RDC_Dép
        slave: 10
        address: 605
        scan_interval: 30
        input_type: input
        unit_of_measurement: °C
        count: 1
        scale: 0.1
        offset: 0
        precision: 1
        data_type: int16
      - name: Chaud_Temp_Prim_Ret
        slave: 10
        address: 607
        scan_interval: 30
        input_type: input
        unit_of_measurement: °C
        count: 1
        scale: 0.1
        offset: 0
        precision: 1
        data_type: int16
      - name: Chaud_Pression
        slave: 10
        address: 610
        scan_interval: 30        
        input_type: input
        unit_of_measurement: Bar
        device_class: pressure
        count: 1
        scale: 0.1
        offset: 0
        precision: 1
        data_type: int16

I hope it can help you.

Hi,

thank you very much for your reply.
At this point, the values are being read correctly, but sometimes (every few hours) the readings get scrambled.
This is an extract from the log :

2022-02-02 21:23:23 DEBUG (SyncWorker_3) [pymodbus.transaction] Running transaction 2
2022-02-02 21:23:23 DEBUG (SyncWorker_3) [pymodbus.transaction] SEND: 0xa 0x3 0x0 0x1b 0x0 0x1 0xf5 0x76
2022-02-02 21:23:23 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING'
2022-02-02 21:23:23 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
2022-02-02 21:23:23 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
2022-02-02 21:23:23 DEBUG (SyncWorker_3) [pymodbus.transaction] RECV: 0x0 0x0 0x0 0xa 0x3 0x2 0x0
2022-02-02 21:23:23 DEBUG (SyncWorker_3) [pymodbus.transaction] Getting transaction 10
2022-02-02 21:23:23 DEBUG (SyncWorker_3) [pymodbus.transaction] Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
2022-02-02 21:23:23 ERROR (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: Waveshare: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2022-02-02 21:23:24 DEBUG (SyncWorker_1) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.2.250', 40353)
2022-02-02 21:23:24 DEBUG (SyncWorker_1) [pymodbus.transaction] Current transaction state - TRANSACTION_COMPLETE

I am getting very frequent entries of the error “no response or unable to decode”.

I’ll try adapting my configuration according to yours.

Thx!

I am still getting lots of errors, with a similar configuration to yours.
The only difference with your setup is that I am using an Ethernet to RS485 adapter, and that I am reading different registers.
I also have sometimes have errors trying to read (or write) modbus registers via another debug tool (AVReporter Modbus Communication Tester). At first I thought it was because of the strange modbus implementation of De Dietrich, where it acts 5s as a master and then 5s as a slave.
But now I am thinking it could be of my Rs485 cabling. I am using a Waveshare Ethernet to Rs485 converter, and am using about 2m of RS485 cable. I did not use an termination resistor.
Do you have any advice? Thanks in advance!

1 Like

I found a code for ESPhome. Just wondering if some already use it with Innovens MCA boiler? As soon as I will have some free time I will give it a try

Edit: just try it with my MCA25 and it looks good, it offers just read option, but anyway nice to have ! This is using the PC / RS232 port (4 pin RJ9/10).

Hi, I have tried multiple cables, and a config very similar to yours.
Have you checked the logs that you aren’t getting any modbus errors?
My values are getting read, thanks to the multiple retries. But I am getting a lot of these entries (multiple per minute) : “[Input/Output] No Response received from the remote unit/Unable to decode response”.

Hi,
What worries me is your statement ‘But I am getting a lot of these entries (multiple per minute) : “[Input/Output] No Response received from the remote unit/Unable to decode response”.’ Normally the pooling is in sequence so you should not get this kind of multiple error per minutes.

2 meters cables is normally safe whatever the kind of cable. in your case it worth a try to insure that it is a twisted cable, that the shield -if exists- is connected on only one side of the connection and to add a termination resistors if it is not included your convertor. You can also check the setting of your IP/Modbus converter.

To answer your question : Yes, I sometimes have missed readings but the next attempt is successful so the sensor in HA does not go to unavailable. I am reading 33 registers with a scan_interval of 30 seconds.

Hello,

my MQTT interface for Diematic 3 has now hassio MQTT discovery integrated.

It’s here:

Benoit

Regarding the many errors :

  • the many retries help. I usually, eventually get a value.
  • The logging reveils that the received data gets chopped up. It reads only 7 of the 10 bytes that my device sends back.
    Good example from my 3r party debug application :
    RECV: 0xa 0x3 0x2 0x0 0xb1 0xdd 0xf1 0x0 0x0 0x0
    Good example from HA log :
    RECV: 0xa 0x3 0x2 0x0 0xb1 0xdd 0xf1
    Error example from HA log :
    RECV :0x0 0x0 0x0 0xa 0x3 0x2 0x0

Is there a way to tackle this?
(more detail here)

Your log are intersting : In fact on my side I’ve got these extra 0s but always at the end of the frame so it does not interfere. Just have a entry in the logs that i suppressed by the log level on modbus integration.

I looked a little bit deeper and i would advice you to add some bias resistors to polarize the bus. They can be activated maybe in your modbus convertor or you can add them externally. You can find the definition here https://modbus.org/docs/Modbus_over_serial_line_V1.pdf page 28. I did not try it since for me the problem is not visible and i have a very cheap USB/RS485 module without this capacity.

Thank you for helping me. Interesting that you have the same trailing zero’s but that your sync is always okay.
Some more info : for the reading of Modbus-registers, with some retries, I usually get some good readings. However when trying to write a register, I sometimes have failed writes, and afterwards my wife tells me that the heating is not working anymore, or that there was no hot water for the shower. So apparently the bad writes mess up some other registers. I had to go through all the service parameters and try to find out which was changed. Eventually I got there.
Apparently there is no CRC when doing modbus writes, otherwise this can’t happen.

I was also thinking of improving the cable. I know RS485 has termination and bias resistors. But usually for such short cables (1.5m) this is not necessary. I’ve already tried two cables (one twisted pair and one coax), but I get the same results.
But the fact that my TCP Reader application always reads the bytes correctly, means that the ModbusPy implementation does something wrong. I am running out of ideas/options, and I really want to get this working :frowning: .

I am using this ethernet to rs485 converter :
https://www.waveshare.com/rs485-to-eth.htm

It has the same web interface as presented on this page:

Settings are the same.

About your writing problem, I also have the problem and i solved it by using exclusively the Write Multiple Register function, even to write only one register. It seems to a bug in some controllers. I already assisted someone on this on another forum.
Syntax:

action:
  - service: modbus.write_register
    data:
      unit: 10
      address: 650
      value:
        - 25
      hub: modb

For the 0 read, I checked your documentation and there is no way to polarize the bus from your equipment. The only way is to try with external resistances and an external supply. On my side, I cannot try it for the moment due to other priorities. Sorry.

Thank you for your reply.
I will check your solution with the “write multiple registers” asap. If this would work, it would be great!

I will do some testing with termination and bias resistors. I’ll let you know the result.

Thx for the advice! Thomas.

Tried it (120 ohm between + and -). No change.

Hello,

Finaly works for me for sensors (with some regular unavailabilities…) with my De Dietrich Boiler.
Who finaly did parameters writing?
I try to create a “climate” according to documentation but it did’t works…

Maybe some can share their yaml code?

Winter is comming.
How to have negative value ?

Thank’s!

Hi Ploufe,

The register 601 give the external temperature … but with a specific coding.
Bit 15 give the sign ( 1: for negative value ). Bit 14 to 0 the absolute value of temp.
Therefore I use a template sensor to calculate the real value :

    chaud_t_ext:
        friendly_name: "Chaud Température Extérieure"
        unit_of_measurement: °C
        value_template: >
          {% if states('sensor.chaud_temp_ext_brute')|int  < -10000 %}
            {{ ((-32768-(states('sensor.chaud_temp_ext_brute')|int))*0.1) |round(1)  }}
          {% elif states('sensor.chaud_temp_ext_brute')!=''  %}
            {{ (states('sensor.chaud_temp_ext_brute')|int*0.1) |round(1) }}
          {% else %}
            {{ states('sensor.chaud_t_ext') }}
          {% endif %}       

There are probably other ways to do it like in python:

def _decode_decimal(self, value_int, decimals=0):
        if (value_int == 65535):
            return None
        else:
            output = value_int & 0x7FFF
        if (value_int >> 15 == 1):
            output = -output
        return float(output)/10**decimals
1 Like