Modbus TCP using more that one connection problem

611 views
Skip to first unread message

m...@uromikobanya.hu

unread,
Jul 5, 2014, 5:37:23 AM7/5/14
to ope...@googlegroups.com
Hi,

If I use more that one connection after some switching connection lose with the following failure:

o.o.b.m.internal.ModbusSlave[:285] - ModbusSlave error getting responce from slave

net.wimpi.modbus.ModbusIOException: Premature end of stream (Header truncated).
at net.wimpi.modbus.io.ModbusTCPTransport.readResponse(ModbusTCPTransport.java:172)
at net.wimpi.modbus.io.ModbusTCPTransaction.execute(ModbusTCPTransaction.java:193)
at org.openhab.binding.modbus.internal.ModbusSlave.getModbusData(ModbusSlave.java:315)
at org.openhab.binding.modbus.internal.ModbusSlave.update(ModbusSlave.java:257)
at org.openhab.binding.modbus.internal.ModbusBinding.execute(ModbusBinding.java:175)
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156)
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173)

my config is:

modbus:poll=200
modbus:tcp.slave1.connection=192.168.1.41:5000
modbus:tcp.slave1.id=1
modbus:tcp.slave1.start=1536
modbus:tcp.slave1.length=128
modbus:tcp.slave1.type=coil

modbus:tcp.slave2.connection=192.168.1.42:5000
modbus:tcp.slave2.id=1
modbus:tcp.slave2.start=1536
modbus:tcp.slave2.length=128
modbus:tcp.slave2.type=coil

Any help thank you!

Thank You
Ferenc

Manolis N

unread,
Jul 6, 2014, 6:05:33 AM7/6/14
to ope...@googlegroups.com, m...@uromikobanya.hu
Hello,
I was recently playing with the binder and had similar problems with two connections on the same IP.
Also I need float values (4 bytes), and it seems this binder can read max "short" (2 bytes). 
I am planning to fork & enrich the binder, if anyone else is interested, we can discuss how to tacle it.

e.g. I was thinking of having the "start" and the "length" as item parameters, cause I want to read multiple values from the same device and the configuration approach is not efficient.
will also attempt to handle float values, and see what's wrong with multiple connections.

Any feedback more than welcome.

Regards,
Manolis

m...@uromikobanya.hu

unread,
Jul 6, 2014, 9:20:50 AM7/6/14
to ope...@googlegroups.com, m...@uromikobanya.hu
Hi,

First I have also problem setting value because I also need 0-9, 10-17 ... 1536-1664 coil addresses. Because the 2 or more connection not working on same ip my idea was also using one connection 0-1664 coil but it is not working same reason as you wrote.

Whare can I find the source of the binding? How to debug it?

I have some experience in JAVA. I try to playing with it but first I have to learn more about modbus and openhab coz this is my first project.
Basicly I need drive 8-10 small master plc from openhab using different ip connection.
BTW I have to more understand modbus master and slave connection also. Normaly as I think the openhab server sould be the modbus master and all other PLCs sould be slaves (1 2 3...10), but it is not working for me.

Thank You
Ferenc

Manolis N

unread,
Jul 7, 2014, 3:41:51 AM7/7/14
to ope...@googlegroups.com, m...@uromikobanya.hu
"Coil" are a "bit" values as far as I understand. "Holding" is were the float values could be found.

Development instructions in general:

and the source for current modbus driver:

Regards,
Manolis


--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/oHwIZjr3T98/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages