OH 2.4, SMA inverter modbus trouble

Tags: #<Tag:0x00007fc1fdbd5d78> #<Tag:0x00007fc1fdbd5c60> #<Tag:0x00007fc1fdbd5af8>
  • 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

Which binding version?

I use SMA as well, and modbus works just fine. I´m using config files, never tried PaperUI.
This is my config for my STP6000TL20 inverter:

Bridge modbus:tcp:inverter1 [ host="10.4.28.248", port=502, id=3, connectMaxTries=3] {

// SMA Inverter Device Type
	Bridge poller DevType [ start=30053, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data DevType [ readStart="30053", readValueType="int32" ]
	   	 
  	 }

Only thing I notice is, that I use length 4, and you use length 2…

Is your Poller and Data online?

EDIT: I use modbus2 binding and openhab 2.5M2

Thx
Changed length to 4: no joy.
Using OpenHab 2.4.0.002 whioch is the “official” package for synology:

Not sure if I can easily “update” to 2.5 M2, there seems to be no ready package for it…

No need to update… I´m sure 2.4 will do fine… There has to be something missing.
Is your Data and Poller online?

EDIT - You could try rise the max connetion tries to 3 in your slave setup. I have 3 in mine, although it hardly ever fails in first try.

It doesn’t matter much here, it will retry anyway at next scheduled poll.

Is your openHAB host in the same IP subnet?

Remember this is a polling binding; once it has initialized its scheduled polls it’s a bit late to change parameters. If you have been editing Things, be sure to reboot openHAB or at least stop/start the binding.

There are many tips in this thread

Yes, I have been through all of the linked thread, but no joy :frowning:

Yes: My NAS and inverter are in the same subnet 192.168.178.xxx
All “things” are displayed as online:

But in the controls page my inverterdevicetype data is displayed as -NaN

Maybe related: I have a MQTT service addressing some SonOff switches. Detecing poweron as wel as switching works fine.However reading the voltage is something that I am pretty sure configured as found in many threads, but also displayed as -NaN.

Could this be an indicator of a missing converter/translator or may something else that is trivial (not to me)

BTW: Rebooting OpenHAB did also not change results.

TIA

SOLVED!
When I created the link, I selected “Folow” as profile, which obviously was not what I needed.
Dropping the link and re-create it as Default (system:default) fixed my problem. Everything else was OK.

afbeelding

BTW: The same fix applied for the Voltage (and power) of my MQTT link.

afbeelding

Thanks for bearing with me :slight_smile:

Hans

1 Like

Great you got it sorted

Nasty little trap there, difficult to guess that one :crazy_face: