Modbus - Connection OK, but unable to receive data from the device

Hi, I have an e-term device, connected using Modbus TCP/IP.

In configuration.yaml

modbus:
  name: caldaia
  type: rtuovertcp
  host: 192.168.1.199
  port: 502
  delay: 3
  timeout: 5
  sensors:
      - name: pressione_caldaia
        scan_interval: 10
        address: 0002 
        unit_of_measurement: bar
        count: 1 
        scale: 0.1 
        precision: 1
        data_type: uint

Hassio can to connect the device, but not to receive data:

2021-06-29 09:20:45 ERROR (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 2 bytes (0 received)
2021-06-29 09:20:48 DEBUG (SyncWorker_6) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.192', 39693)
2021-06-29 09:20:48 DEBUG (SyncWorker_6) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 09:20:53 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response

Now, I verified the connection to the device using Modscan. It work without problem:

Anyone can suggest some solution? I tried also with another Hassio instance on another pc, but same problem. I tried to change connection type (rtuovertcp and tcp), tried other registers… No luck.

Use decimal registers 0x0002 > 2 ?!

Thank you for reply. I tried with 0x0002, but same problem :pensive: Same problem with 2, 400002, 300002 and similar…

       address: 2

Enable debug

# configuration.yaml
logger:
  logs:
    homeassistant.components.modbus: debug
    pymodbus.client: debug

1 Like

That is input_type: holding/input

input_type string (optional)

Modbus register type (holding, input), default holding.

1 Like
logger:
  default: info
  logs:
    homeassistant.components.modbus: debug
    pymodbus.client: debug

modbus:
  name: caldaia
  type: rtuovertcp
  host: 192.168.1.199
  port: 502
  delay: 3
  timeout: 5
  sensors:
      - name: pressione_caldaia
        scan_interval: 10
        address: 2 
        unit_of_measurement: bar
        input_type: holding
        count: 1 
        scale: 0.1 
        precision: 1
        data_type: uint

Same error:

2021-06-29 15:32:29 DEBUG (SyncWorker_2) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:32:34 ERROR (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 2 bytes (0 received)
2021-06-29 15:32:39 DEBUG (SyncWorker_4) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 37137)
2021-06-29 15:32:39 DEBUG (SyncWorker_4) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:32:44 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:32:49 DEBUG (SyncWorker_0) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 34393)
2021-06-29 15:32:49 DEBUG (SyncWorker_0) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:32:54 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:32:59 DEBUG (SyncWorker_3) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 43055)
2021-06-29 15:32:59 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:33:04 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:33:09 DEBUG (SyncWorker_5) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 41139)
2021-06-29 15:33:09 DEBUG (SyncWorker_5) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:33:14 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:33:19 DEBUG (SyncWorker_1) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 47439)
2021-06-29 15:33:19 DEBUG (SyncWorker_1) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:33:24 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:33:29 DEBUG (SyncWorker_2) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 56267)
2021-06-29 15:33:29 DEBUG (SyncWorker_2) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:33:34 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:33:39 DEBUG (SyncWorker_4) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 36459)
2021-06-29 15:33:39 DEBUG (SyncWorker_4) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:33:44 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:33:49 DEBUG (SyncWorker_0) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 47155)
2021-06-29 15:33:49 DEBUG (SyncWorker_0) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:33:54 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:33:59 DEBUG (SyncWorker_3) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 40595)
2021-06-29 15:33:59 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:34:04 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:34:09 DEBUG (SyncWorker_5) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 52607)
2021-06-29 15:34:09 DEBUG (SyncWorker_5) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:34:14 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:34:19 DEBUG (SyncWorker_1) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 43417)
2021-06-29 15:34:19 DEBUG (SyncWorker_1) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:34:24 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:34:29 DEBUG (SyncWorker_2) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 57429)
2021-06-29 15:34:29 DEBUG (SyncWorker_2) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-06-29 15:34:34 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-06-29 15:34:39 DEBUG (SyncWorker_4) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.233', 32769)
2021-06-29 15:34:39 DEBUG (SyncWorker_4) [pymodbus.client.sync] New Transaction state 'SENDING'

Are you sure that the connection should be “rtuovertcp” and not “tcp”?

Also the addresses in ModScan64 looks like 40001 - so shoudl not the address also be “40001”?

I tried with both rtuovertcp and tcp. Tried also with 40001. No luck.
I tried also with nodered, but I receive another error (“Error: Data length error, expected 7 got 8”). Tried also to install some old library in nodered, but when start polling, the first poll is ok (it gets the correct value), the other polls are errors.

At the moment I found a not so elegant solution: I use a PC with a command line (modpoll.exe), get the values from the command line and send them to nodered using an endpoint

Do you know if there is such modbus script in python to use on Hassio by command line and how to install it?

Any updates? After updating my server to 2021.7 MODBUS stopped working.

I have got a similar problem. The strange thing is that some values return a value and some return just zero. I had no errors for the modbus. Now i reverted to 2021.6.1 and everything is back to normal. Could it be some number relate problem? int or uint for example?

I also ran into the same issues after updating before everything was fine.

I own 2 different modbus devices:

  1. Modbus TCP Server with SDM630 Power meter is working perfectly.
  2. Modbus TCP in Stiebel Eltron Heatpump is giving this error:
    [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response

Did someone already created a bug report?

I think yes!

After the lastest updates of Hassio, finally I can get some data from modbus device, BUT there is now another problem.
This is the code:

modbus:
  name: caldaia
  type: tcp
  host: 192.168.1.199
  port: 502
  sensors:
      - name: caldaia_mb_pressione
        scan_interval: 10
        address: 11 
        unit_of_measurement: bar
        input_type: holding
        count: 1 
        scale: 0.1 
        precision: 1
        data_type: uint
      - name: caldaia_mb_conducibilita
        scan_interval: 10
        address: 13
        unit_of_measurement: uS
        input_type: holding
        count: 1 
        scale: 1
        precision: 1
        data_type: uint

I can get the first and the second sensor data, randomly. Sometimes I can get the data of the first, sometimes of the second. The other one become unavailable. I continue to receive the following errors:

2021-08-12 12:39:25 DEBUG (SyncWorker_1) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.192', 52251)
2021-08-12 12:39:25 DEBUG (SyncWorker_1) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-08-12 12:39:37 DEBUG (SyncWorker_6) [pymodbus.client.sync] New Transaction state 'SENDING'
2021-08-12 12:39:37 ERROR (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2021-08-12 12:39:49 DEBUG (SyncWorker_4) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.1.192', 54251)
2021-08-12 12:39:49 DEBUG (SyncWorker_4) [pymodbus.client.sync] New Transaction state 'SENDING'

Tried to us retry_on_empty and retries with also timeout and delay. Nothing to do

Some help?

1 Like

Anyone found a solution yet? Mine is similar

    delay: 1
    timeout: 5
    retries: 5
    retry_on_empty: true
    message_wait_milliseconds: 200

Spróbujcie sprawdzić porty czy są otwarte.

At the moment, seems to be an update, but not a perfect working.

modbus:
  name: caldaia
  type: tcp
  host: 192.168.1.199
  port: 502
  delay: 2
  timeout: 3
  retries: 3
  retry_on_empty: true
  close_comm_on_error: false
  sensors:
      - name: caldaia_mb_pressione
        scan_interval: 12
        address: 11 
        unit_of_measurement: bar
        input_type: holding
        count: 1 
        scale: 0.1 
        precision: 1
        data_type: uint
      - name: caldaia_mb_conducibilita
        scan_interval: 10
        address: 13
        unit_of_measurement: uS
        input_type: holding
        count: 1 
        scale: 1
        precision: 1
        data_type: uint 

I set an interval of 10/12 seconds. Hassio get the value of one sensor at time. But sometimes get the right value, sometimes get “unknown”. Futher, Hassio don’t get
the two sensor values simultaneously.

Cattura
Cattura2

1 Like