- Platform information:
-
Hardware: Synology NAS, DS214+
-
OS: DSM 6.2
-
Java Runtime Environment: v8 (SYnology)
-
openHAB version: 2.4
-
- Issue of the topic: Trying to setup ModBus communication with my STP5000TL20 inverter.
It seems I get stuck at reading the registers. Just for testing sake I am now trying to read the device type register.
I am very sure about the IP address, the port 502 and the device ID 3 as I have written a service in c# before to monitor my inverter. Unfortunately I seem to be unable to get it to work on OH2.4
I have seen quite some messages on this forum regarding ths problem, using configuration files. I don’t know where to find/edit these as I have configured everything using the PaperUI and/or HABMin.
The settings for the ModBus Slave are:
Name: STP5000TL20
IP: 192.168.178.15 / Port: 502 / ID: 3
Time between transactions: 6000
Time between reconnections: 0
Max connection tries: 1
Disconnect and establish connection after: 1000
Timeout for establishing connection: 1000
The ModBus Slave is displayed as ONLINE
Also I have a “regular poll” thing setup like this:
Name: Poll_SMA_DeviceType
linked to modbus slave STP5000TL20
Poll Interval: 10000
STart: 30053
Length:2
type: input register
Max tries when reading: 3
And a Modbus Data object like this:
Name: SMADeviceTypeData
linked to modbus poll Poll_SMA_DeviceType
Read Address: 30053
Read transform: default
Read value type: uint32
- no write fields/settings configured
Only the number item channel is linked to item InverterDeviceTypeData as an dimensionless number
When examining the result in the paperui items UI, the number is displayed as NAN. (the same happens for other registers that I have tried!)
Here’s a part of the log regarding this issue:
2019-12-05 22:40:09.583 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@183778b[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30053,length=2,maxTries=3]). Will try again soon. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 0 [operation ID 6ea92fe0-e9d5-42c5-9b0a-a7889051369d]
2019-12-05 22:40:15.648 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 1/1 error: I/O exception: IndexOutOfBoundsException null. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@122e91a (unit id 3 & transaction 36468). Address: /192.168.178.15:502
2019-12-05 22:40:15.650 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 1, throwing last error: I/O exception: IndexOutOfBoundsException null. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@122e91a (unit id 3 & transaction 36468). Address: /192.168.178.15:502
2019-12-05 22:40:15.651 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@183778b[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30053,length=2,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IndexOutOfBoundsException null [operation ID 6ea92fe0-e9d5-42c5-9b0a-a7889051369d]
2019-12-05 22:40:43.640 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@183778b[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30053,length=2,maxTries=3]). Will try again soon. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 0 [operation ID a988f031-cf77-4dda-a47e-ade68db1b419]
2019-12-05 22:40:49.656 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 1/1 error: I/O exception: IndexOutOfBoundsException null. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@1d45ab8 (unit id 3 & transaction 36472). Address: /192.168.178.15:502
2019-12-05 22:40:49.657 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 1, throwing last error: I/O exception: IndexOutOfBoundsException null. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@1d45ab8 (unit id 3 & transaction 36472). Address: /192.168.178.15:502
2019-12-05 22:40:49.681 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@183778b[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30053,length=2,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IndexOutOfBoundsException null [operation ID a988f031-cf77-4dda-a47e-ade68db1b419]
2019-12-05 22:41:16.038 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@183778b[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30053,length=2,maxTries=3]). Will try again soon. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 0 [operation ID b56ea506-46c7-4e8e-9fa8-344bbc5dd10d]
2019-12-05 22:41:22.049 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 1/1 error: I/O exception: IndexOutOfBoundsException null. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@41d74b (unit id 3 & transaction 36476). Address: /192.168.178.15:502
2019-12-05 22:41:22.050 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 1, throwing last error: I/O exception: IndexOutOfBoundsException null. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@41d74b (unit id 3 & transaction 36476). Address: /192.168.178.15:502
2019-12-05 22:41:22.051 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@183778b[slaveId=3,functionCode=READ_INPUT_REGISTERS,start=30053,length=2,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IndexOutOfBoundsException null [operation ID b56ea506-46c7-4e8e-9fa8-344bbc5dd10d]
I am unure if the IndexOutOfBounds exception is caused by a wrong parameter, or if it is a programming error. I am an experienced programmer myself, but before dive into debugging this java code myself I wanted to query the forum first. Maybe its just a little thing I have overseen.
Thanks -
Hans