[modbus-binding] Errors when trying to access a SMA inverter #4927
Comments
sorry, I'm using OH2 Build #660! |
You must read two registers, not one to parse single int32: So this
Should be changed to 2 Please consult wiki for more details. |
Thanks. Changed to 2. |
Ok, I have I've got it now. This is a documentation bug, because it works when I provide the full register number: tcp.sma1.start=30785 |
Hi, great to hear you got it working! So which documentation was faulty? The binding passes the start parameter as is on the protocol level. |
Many tanks for your quick response as anytime :-) Look at this statement in the documentation: "...For example, modbus slave definition with start=3, length=2 and type=holding will read modbus entities with the following numbers 40004 and 40005..." In my case the register I'm reading is 30785 and I MUST enter "start=30785", otherwise it doesn't work. But the documentation is trying to tell me, a definition like start=784, length=2 and type=input will read 30785... which is not true.... |
However, I'm very happy that it works now. It's like a Christmas gift. I'm closing this is issue and wishing you all the best! |
I think this might be related to the documentation of this particular device? Really, the start is passed as is to the protocol, see e.g. http://www.simplymodbus.ca/FC04.htm Please note that 30785 is perfectly valid address assuming the de facto addressing extension, see https://en.m.wikipedia.org/wiki/Modbus
So 30785 on the wire would correspond to input register 330785 Best |
no Sami, it has been a quote from https://github.com/openhab/openhab/wiki/Modbus-Binding Best |
Yeah I understood that but I'm just wondering if you are actually now reading "entity" with number 330785? But to my understanding the real address number that goes on the wire would be the given start number: 30785. You should be able to verify this with other tools such as pollmb.py or diagslave, for example. Would it make it clearer if the documentation would use 400004 instead of 40004 (extra zero)? Best |
Your first question is fair, but now I'm confused. I was thinking if one device documentation is referring to a holding register "4", then they mean the register 40004 (or sometimes 40005) which equals to entity number. Hence: "holding" and "4" make up the long-version "40004" ... I know, this is now a conversation and should be moved elsewhere :-) |
I'm using OH2 to read 2 different Modbus TCP devices.
First one, a heater is answering my requests without any problems. The Second, a SMA inverter cannot be read. When using the RMMS tool both devices are accessible. My conclusion is that the issue relies in the modbus binding.
Expected Behavior
the binding should return a value when I read a register. I expect to read the same values as RMMS can do (see the screenshot below)
Current Behavior
13:46:01.296 [ERROR] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (sma1) error getting response from slave
java.lang.ArrayIndexOutOfBoundsException
SMA definition in modbus.cfg
tcp.sma1.connection=192.168.178.3:502
tcp.sma1.type=input
tcp.sma1.id=3
tcp.sma1.start=785
tcp.sma1.length=1
tcp.sma1.valuetype=uint32
#item definition
Number SMA_DC1_ "AC-Spannung Phase 1 [%.1f V]" { modbus="sma1:0" }
#sitemap
Text item=SMA_DC1_
Possible Solution
My suspicion is that die Binding is struggling to resolve the Device ID, which must be "3" in this case
Steps to Reproduce (for bugs)
this will be hard to realize, as one would need a SMA inverter....
Context
Your Environment
OH2 Build 600,
Modbus binding 1.9.0
I'm attaching a screenshot from the tests done with RMMS. You can see the successfully read voltage values at +4 (239,76 V) +6 and +8 which correspond to the registers 30775, 30777 and 30779
The text was updated successfully, but these errors were encountered: