Modbus-Binding Transaction ID does not match

Hello, I’m facing following Problem: Modbus with ModbusBinding 1.9.0 RC1 from openhab1 on OH2. Writing coils and registers is working, reading coils or registers is not working. There is following Error in openhab.log:

ModbusSlave (slave2): Transaction id of the response does not match request net.wimpi.modbus.msg.ReadMultipleRegistersRequest@189b.  Endpoint ModbusTCPSlaveEndpoint@fd6d67[address=192.168.178.201,port=502]. Connection: TCPMasterConnection@1d1b0d8[socket=Socket[addr=/192.168.178.201,port=502,localport=32900]]. Ignoring response.    

My Test-setup is just the modbus-binding with a modbus-Test-Slave (Software Simulation on PC) Can anyone help me??

Can you write your question in english please so we have a mutual language? :wink:

Why are you using

the actual version is 1.10.0

May be that you have an offset in your register.

So you want to read for example Register 40101 to 40108 an your device has an offset off 1 because your device may start the adress counting with 0 instead with 1
so you could check if you can read on adress 40100 to 40107 instead.

A even better check is just read an adress in the middle and see if it works.

If this is not working, than you should give some more information about what you have done.

Your config file, item file, …

hi peaeater,
can you tell me where I can find the binding?
even a simple configuration of modbus and an item does not work …

modbus:tcp.slave1.connection=192.168.178.20:502
modbus:tcp.slave1.length=2
modbus:tcp.slave1.type=coil
Switch Test_EG		"Switch Test"			(EG_Test)	{modbus="slave1:1"}

You can find the binding through PaperUI. After installing Eclipse IoT Market search for modbus binding. It gives you three results and one to install is binding-modbus1 - 1.10.0.

You said that you have set up a test slave. What have you configured in this? Coils, holding registers, what exactly?

Edit:

Your modbus.cfg should look like this:

tcp.slave1.connection=192.168.178.20:502
tcp.slave1.length=2
tcp.slave1.type=coil

Don’t put “modbus:” in the beginning.

Please read:
http://docs.openhab.org/addons/bindings/modbus1/readme.html

I would suggest to make allways a full definition of the slave.
I’am missing a few entries. A config file per slave should look like

tcp.slave1.connection=192.168.178.20:502
tcp.slave1.id=1       # the name of the modbus slave you want to speak with. What id has your selfconfigured slave?
tcp.slave1.start=0    # Here sometimes exists definition offset. You want to read 2 coil. In your slave description they may be numbered with 1 and 2 (human counting) You can reach them under 0 and 1 (developer counting) in this case your start=0, but sometimes the developer counts like a human, then the start=1. 
tcp.slave1.length=2
tcp.slave1.type=coil

In this way you can reflect the documentation of your modbus slave.

Your error log shows

ModbusSlave (slave2)

Have you configured more slaves?

Hi,
I have now renewed my installation and now use the new modbus binding 1.10.0.
Sadly it still does not work…

tcp.slave1.connection=192.168.178.20:502
tcp.slave1.type=coil
tcp.slave1.id=1
tcp.slave1.start=0
tcp.slave1.length=0

With Error:

2017-09-23 17:31:58.488 [WARN ] [inding.modbus.internal.ModbusBinding] - Item ‘MySwitch’ read index ‘1’ is out-of-bounds. Slave ‘slave1’ has been configured to read only ‘0’ bits. Check your configuration!

when I change the configuration to:

tcp.slave1.connection=192.168.178.20:502
tcp.slave1.type=coil
tcp.slave1.id=1
tcp.slave1.start=0
tcp.slave1.length=2

I get the following log:

2017-09-23 17:34:32.221 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 1/3 error: I/O exception - failed to read… Request: net.wimpi.modbus.msg.ReadCoilsRequest@7c5fa3 (unit id 1 & transaction 19665). Address: /192.168.178.20:502
2017-09-23 17:34:32.286 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 2/3 error: I/O exception - failed to read… Request: net.wimpi.modbus.msg.ReadCoilsRequest@7c5fa3 (unit id 1 & transaction 19666). Address: /192.168.178.20:502
2017-09-23 17:34:32.351 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 3/3 error: I/O exception - failed to write: Broken pipe. Request: net.wimpi.modbus.msg.ReadCoilsRequest@7c5fa3 (unit id 1 & transaction 19667). Address: /192.1 68.178.20:502
2017-09-23 17:34:32.361 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 3, throwing last error: I/O exception - failed to write: Broken pipe. Request: net.wimpi.modbus.msg.ReadCoilsRequest@7c5fa3 (unit id 1 & transact ion 19667). Address: /192.168.178.20:502
2017-09-23 17:34:32.364 [ERROR] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (slave1): Error getting modbus data f or request net.wimpi.modbus.msg.ReadCoilsRequest@7c5fa3. Error: Executing transaction failed (tried 3 times). Endpoint Mod busTCPSlaveEndpoint@1c2d0a7[address=192.168.178.20,port=502]. Connection: TCPMasterConnection@453853[socket=Socket[addr=/1 92.168.178.20,port=502,localport=55244]]

I have renewed the complete installation to eliminate other errors.
Modbus is very important for my home control since there are no other communication protocols for my sps. MQTT unfortunately does not work with my control :frowning:

Thank you for your competent help :pray:

tcp.slave1.length=0

Try changing this from 0 to 1. Reading zero coils gives out of bounds error because you haven’t read anything. And reading only 1 coil/byte is the simplest config i can imagine.

2017-09-23 17:34:32.361 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 3, throwing last error: I/O exception - failed to write: Broken pipe.

This shows that you have something wrong with your physical connection e.g broken pipe. If you are sure that everything should work with your config try putting looser timings. Look in this section of readme:
http://docs.openhab.org/addons/bindings/modbus1/readme.html#advanced-connection-parameters