Hi, I’m using a raspberry with Ubuntu 22.04.4 LTS.
I have configured the input plugin [inputs.modbus] in the telegraf.conf file and I would like to use [inputs.modbus.requests].
However, when I try to start telegraf, the startup fails.
Entering the command journalctl -eu telegraf.service generates this error: “E! error loading config file /etc/telegraf/telegraf.conf: error parsing modbus, line 555: (modbus.requestFieldDefinition.Address) cannot unmarshal TOML array into uint16 (need slice)”.
Does anyone know why this happens or has had a similar problem?
Okay, and what is line 555? Maybe paste the whole [inputs.modbus.requests]
into a code block for readability.
[[inputs.modbus]]
name = "CCI"
timeout = "3s"
controller = "file:///dev/serial/by-path/platform-3f980000.usb-usb-0:1:1.0-port0"
baud_rate = 19200
data_bits = 8
parity = "N"
stop_bits = 1
transmission_mode = "RTU"
debug_connection = true
configuration_type = "request"
[[inputs.modbus.request]]
slave_id = 1
byte_order = “ABCD”
register = “holding”
fields = [
{ address = [2608,2609], name = “Potenza Attiva 1”, type = “FLOAT32-IEEE”},
{ address = [2610,2611], name = “Potenza Attiva 2”, type = “FLOAT32-IEEE”},
{ address = [2612,2613], name = “Potenza Attiva 3”, type = “FLOAT32-IEEE”},
{ address = [2616,2617], name = “Potenza Reattiva 1”, type = “FLOAT32-IEEE”}
]
[inputs.modbus.request.tags]
slave_id = “2”
location = “df”
Line 555 is this " { address = [2608,2609], name = “Active Power 1”, type = “FLOAT32-IEEE”}, "
I asked this for a reason:
But anyway, according to the documentation, address
should be a plain number and not an array of numbers. This is also exactly what the error is saying.
Sorry, I couldn’t insert it as a line of code.
Anyway, that’s the mistake, I’ll edit my configuration file. Thank you very much for your patience and time.
Here you go
Wow! Thank you so much @Hipska