Modbus RTU requests read more slaves

Hi all,
I have a bus that communicates in Modbus RTU with many slaves and I intend to read these slaves via Telegraf to store the data on InfluxDB.
So to communicate I tried configuration_type = request in a configuration like this

[[inputs.modbus]]
  alias = "modbus RTU"
  name = "modbus RTU"

  
  timeout = "1s"
  busy_retries = 1
  busy_retries_wait = "100ms"
  
  ## Serial (RS485; RS232)
  controller = "file:///COM1"
  baud_rate = 9600
  data_bits = 8
  parity = "E"
  stop_bits = 1

  transmission_mode = "RTU"
  debug_connection = true

  configuration_type = "request"


  [[inputs.modbus.request]]
    slave_id = 5
    byte_order = "ABCD"
    register = "holding"
    fields = [
    { address = 1, name = "power_factor1",   type = "INT16"},
    { address = 2, name = "power_factor2",   type = "INT16"},
    { address = 3, name = "power_factor3",   type = "INT16"},
    { address = 4, name = "power_factor4",   type = "INT16"},
    { address = 5, name = "power_factor5",   type = "INT16"},
    ]

    [inputs.modbus.request.tags]
      slave_id = "5"


  [[inputs.modbus.request]]
    slave_id = 6
    byte_order = "ABCD"
    register = "holding"
    fields = [
    { address = 1, name = "power_factr1",   type = "INT16"},
    { address = 2, name = "power_factr2",   type = "INT16"},
    { address = 3, name = "power_factr3",   type = "INT16"},
    { address = 4, name = "power_factr4",   type = "INT16"},
    { address = 5, name = "power_factr5",   type = "INT16"},
    ]

    [inputs.modbus.request.tags]
      slave_id = "6"

The problem is that sometimes one or more slaves could be turned off and therefore disconnected.
When a slave inside the bus is disconnected, the plugin gives me a timeout error inherent to the disconnected slave.
In this case, however, also the data of the other connected slaves are not written on influxDB.
is there a configuration that allows me to ignore the devices that are switched off and to continue to acquire the data of the connected slaves?

I’m sure there is an easy way to do this but it escapes me at the moment.

InfluxDB V 2.2.0
Telegraf 1.23.4

@srebhan I believe this was worked on with Telegraf Modbus RTU - Do not throw all the data if a slave on the bus is not reachable · Issue #11782 · influxdata/telegraf · GitHub?

Exactly. There is a patch in fix(inputs.modbus): Do not fail if a single slave reports errors by srebhan · Pull Request #11785 · influxdata/telegraf · GitHub which is ready to be tested. Feedback if it solves your problem is appreciated!

2 Likes

I tried the patch today, sorry for the delay.
Thanks srebhan, it works correctly.

Can you please also add this comment to the issue (and the PR)? It helps reviewers to better judge the PR.