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??
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.
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?
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.
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!
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
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.