De Dietrich Boiler integration - MODBUS

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