I have a problem with the telegraf “modbus-plugin” running on windows with an serial connection (com2)… when running the configuration I always will get the error “serial: timeout”.
I’m in contact with the support of the manufacturer of the modbus-device and I got the manual for the modbus connection - so the settings should be correct (slave-ID and the adresses for the holding register). I also checked the serial connection with a ping 127.0.0.1 successfully. but still I got the following errors
[agent] Starting service inputs
[inputs.modbus] trying to read holding@110[1]…
[inputs.modbus] Error in plugin: serial: timeout
[agent] Stopping service inputs
what confuse me a little bit, is in the manual from the manufacturer the example for a request from the master to read a register. He added a table for that (see below). I don’t know if that could help me in telegraf or if telegraf in the background will make it in that way.
Below there is the config I’m using for the modbus-plugin
[[inputs.modbus]]
## Connection Configuration
## Device name
name = "heatgenerator"
## Slave ID - addresses a MODBUS device on the bus
## Range: 0 - 255 [0 = broadcast; 248 - 255 = reserved]
slave_id = 110
## Timeout for each request
timeout = "2s"
## Maximum number of retries and the time to wait between retries when a slave-device is busy.
busy_retries = 2
busy_retries_wait = "100ms"
## Serial (RS485; RS232)
controller = 'file:///COM2'
baud_rate = 9600
data_bits = 8
parity = "N"
stop_bits = 1
transmission_mode = "RTU"
holding_registers = [
{ name = "Temperature", byte_order = "AB", data_type = "FLOAT32", scale= 0.1, address = [110]},
]
[inputs.modbus.tags]
influxdb_database="heat"
would be great if someone from the community could support me on that topic
This is not what I would have expected for the controller path. I would have expected something like file:///dev/ttyS2 or similar for COM2 serial port.
Can you run ls -l /dev/tty* and see what tty devices show up.
thank you very much for your reply… but I work with Windows and not with Linux operating system. I followed a description I saw in a other topic in the community… may you have other idea?!
I tried… but there is a failure message called "Error running agent: could not initialize input inputs.modbus: initializing client failed: invalid controller “COM2”
Had a couple other suggestions come in from folks more familiar with Windows. In addition to popey’s suggestion above can you try first enabling debug_connection = true to get some additional data. Then try some combination of the following controller settings?
I’m sure that its the com2 (verified also with the mainboard manual). I’m very happy for your ideas what I can test!!
About your last suggestion, I tested both variants and all will bring me the failure message “Error in plugin: The system can’t find the Path” and after that the input is stopped.
Hey,
I also checked the “debug_connection = true” and I received the following information
comparing the send message with the table above in my first post, telegraf send exactly what is listed there for each single byte.
When I asked the support from the manufacturer of the device, they told me I should ping the device. I wondered if that will work also for a serial connection, but they confirmed me that. Do you have knowledge about that and can you confirm this?
I do not know your device or any information about it. Their comment about needing to ping is not something I understand. You may want to ask for clarification about the ping, if that is required before the device shows up?
Let’s see if it even shows up as a serial connection. In powershell, can you run the following:
[System.IO.Ports.SerialPort]::GetPortNames()
That should print something like: COM1 or some additional devices.
I tried to increase the timeout value to 15 sec… but the problem is still there.
I connected with Putty to the device, but see only the empty screen. I tried to type the bytes “6e 03 00 6e 00 01 ec 88” but nothing was visualized in the putty view.
no I was not able to get it run… my modbus device is an old control and I’m not sure if the failure is on this side. From the telegraf skript I tried everything