Core: Modbus: RTU frames sending to bus without delay

Created on 17 Dec 2018  路  18Comments  路  Source: home-assistant/core

Home Assistant release with the issue:
0.84.2

Operating environment (Hass.io/Docker/Windows/etc.):
Docker

Component/platform:
https://www.home-assistant.io/components/modbus/

Description of problem:
RTU frames sending to bus without delay. And devices miss their frames.

Documentation says:
In RTU mode, message frames are separated by a silent interval of at least 3.5 character times. In the following sections, this time
interval is called t3,5.

Additional information:
See details in 2.5.1.1 MODBUS Message RTU Framing - http://www.modbus.org/docs/Modbus_over_serial_line_V1_02.pdf

modbus

Most helpful comment

This issue is still present.

All 18 comments

Maybe related to issue #18128.

Is this still an issue you are experiencing? Can you please try upgrading to the latest version of Home Assistant (0.90) and report back if this is still a problem? Thanks!

Hi, for me yes the issue is still there. I workarounded it by modifiing the latest modbus component and using it as custom. Modification consists of adding time.sleep(0.04) before each bus operation. It works without any issue for many weeks now.
It would be great if @ziotibia81 can finish what he started in PR #10967.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

This bug still exist

Is there an upstream issue on this? This clearly should be handled by upstream library.

Implementation of modbus library demands this to the application. See discussion on PR #10967

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

This issue is still present.

This issue is still present.

I am also experiencing issues with modbus rtu. Any updates?

No updates? Still have this problem...

Same issue here.

Same issue, slave device cannot reply in time
Log Details (ERROR)
Logger: homeassistant.components.modbus.sensor
Source: components/modbus/sensor.py:237
Integration: modbus (documentation, issues)
First occurred: 3:18:18 PM (73 occurrences)
Last logged: 3:31:48 PM
No response from hub com0, slave 1, address 70
No response from hub com0, slave 1, address 12
No response from hub com0, slave 1, address 0
No response from hub com0, slave 1, address 6

@adamchengtkc , could give a hand on this, please?

I can confirm that without delay read randomly fail in the modbus/serial with PZEM energy meter.
I have 3 such devices on the modbus and I configured to read 3 registers from each of them:

modbus:
  - type: serial
    name: modbus_1  
    method: rtu
    port: /dev/ttyUSB0
    baudrate: 9600
    stopbits: 1
    bytesize: 8
    parity: N
    timeout: 1

- platform: modbus
  scan_interval: 1
  registers:
    - name: ac_input_phase_1_voltage
      hub: modbus_1
      unit_of_measurement: V
      slave: 10
      register: 0x0000
      register_type: input
      scale: 0.1
      precision: 2

    - name: ac_input_phase_1_current
      hub: modbus_1
      unit_of_measurement: A
      slave: 10
      register: 0x0001
      register_type: input
      count: 2
      reverse_order: true
      scale: 0.001
      precision: 2

    - name: ac_input_phase_1_energy
      hub: modbus_1
      unit_of_measurement: KWh
      slave: 10
      register: 0x0005
      register_type: input
      count: 2
      reverse_order: true
      scale: 0.001
      precision: 2   

    # here same registers for slaves 11 and 12

I have tries to read register directly with pymodbus and I found that after adding sleep(0.05) before each read all works fine,

It may be so that the speed of your transmission 9600 is not enough to transmit all data for devices withing the timeframe. Try setting higher speed for your devices.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kirichkov picture kirichkov  路  3Comments

i-am-shodan picture i-am-shodan  路  3Comments

TheZoker picture TheZoker  路  3Comments

arangates picture arangates  路  3Comments

MartinHjelmare picture MartinHjelmare  路  3Comments