Modbus sensor doesn't respond

Hi All!

I am attempting to integrate the Datakom D-500 (a generator controller) into Home Assistant using the Modbus integration.

Here is my code:

modbus:
 - name: "d200"
   type: rtuovertcp
   host: 192.168.1.127
   port: 502
   sensors:
    - name: "datakom_test0123"
      device_class: frequency
      address: 0x2862
      slave: 1

However, I’m encountering the following error:

Pymodbus: d200: Error: device: 0 address: 10338 -> Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 4 bytes (0 receive

I have spent many hours trying various configuration options, but have not yet found a solution. I would greatly appreciate any suggestions you may have. Thank you!

Hi

In short words: Datakom has very specific interpretation Modbus specification and you can’t use default integration w/o fix modbus client

My question to Datakom support:

In short, the device adds one extra byte with a CRC that is not read by any of the libraries

Sample request/response:
Tx: 01 4A 00 00 00 06 01 03 28 00 00 06
Rx: 01 4A 00 00 00 0F 01 03 0C 09 01 00 00 08 5F 00 00 08 33 00 00 1A

Rx contains field Bytes count == 0F (15 in decimal). The next 15 bytes contain the registers values. And after that device add “1A” - this is CRC checksum.
But the problem is that the Modbus TCP protocol specification does not have this field. As a result, all libraries that implement the protocol simply do not read it. And this byte comes first in the subsequent request and, of course, breaks the structure of the response. Example below:
Tx
[21 6B 00 00 00 06 01] 03 28 00 00 06
Rx
[21 6B 00 00 00 0F 01] 03 0C 09 03 00 00 08 32 00 00 08 5B 00 00
2307:2098:2139
Tx
[7A D5 00 00 00 06 01] 03 28 00 00 06
Rx
[1A 7A D5 00 00 00 0F]
MBAP checking error

The example shows that 15 bytes of the response have been read, and the last byte has not been read and comes in the response to the next request.

Of course, I can correct my code so that it reads all the bytes of the response and ignores the last one, but I think that this is not entirely correct. I tried 3 different public ways (one console app, two libraries) and they all don’t work. Can you fix it in the firmware of the device?

Datakom support answer:
It is not checksum at the end of modbus packet. Otherwise, it would be a variable value.
It is line termination byte and it is default 1A. You can discard this value.