Modbus openHAB2 binding available for alpha testing

Tags: #<Tag:0x00007f1837e70828> #<Tag:0x00007f1837e706e8> #<Tag:0x00007f1837e705a8>

(Rossko57) #515

The Modbus protocol itself has the inherent limitation that the count of bytes in the frame must itself be held in a single byte i.e max 255 bytes = 127 registers

(Rolf) #516

Dear all

I get following error in my log file:

16:39:54.447 [ERROR] [] - execute try 1/1 error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@6b002a (unit id 1 & transaction 3646). Address: /
16:39:54.461 [ERROR] [] - execute reached max tries 1, throwing last error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@6b002a (unit id 1 & transaction 3646). Address: /
16:39:54.474 [WARN ] [ort.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@ae906a[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=0,length=24,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID f0f19dce-9e8c-424f-b414-d39c81be6cd9]

Does anybody has an idea what is wrong? Any help would be highly appreciated.

Best regards

(Miika Jukka) #517

It’s a timeout error as you propably can see. Check all your connection parameters and make sure you server is up and running. You can use some 3rd party modbus tool to do this test.

After all that if you still got problems I would suggest you to open a new thread with much more detailed info about your configuration. This binding is now considered stable and this thread was more about testing and developing.

(Rolf) #518

dear Miika

Thanks a lot for your hint. I still get the error and have opended a new thread (as you proposed). Any further help would be highly appreciated.

best regards

(Old House) #519

Hope this is the right place to ask but having minor problem using OH2 PaperUI to configure ModBus Serial Slave (market:binding-3528471 - 1.0) . It will only allow me to select ttyUSB0 but I have two serial devices and both are listed in /dev ttyUSB0 and ttyUSB1. The same problem arises in the RegoHeatPump binding that is currently running on ttyUSB0.
Tried editing line in PaperUI but it was having none of that. Tried editing the json file but the PaperUI kept over writing it. Tried editing the 99-com.rules as suggested in the serial binding documentation but no luck with that appearing as an option either.
Any hints would be much appreciated.

(Miika Jukka) #520

I think this problem has almost nothing to do with modbus binding. Why don’t you open a new thread with detailed info what you have done so far? I can almost guarantee that you will get much more help that way.

(Arndt Braun) #521

Hi, i have actually also a problem with my Wago 750-881 plc.

im using since years a program on my plc that controls the lights in my house.

for example the program uses the following modbus variable to switch the light using a signal from Modbus (actually IP-Symcon)
fbLichtWohnzimmerLinks AT %MX0.3 :BOOL; ( *ModBus 12291* )
no i want to switch this variable by using openhab2 version 2.3 (the new modbus binding)

Bridge modbus:tcp:hv1 [ host=“”, port=502 ] {

Bridge poller coil [ start=12291, length=2, refresh=1000, type="holding" ] {
    Thing data do4 [ readStart="12291", readValueType="bit", writeStart="12291", writeValueType="bit", writeType="coil" ]
    Thing data do5 [ readStart="12292", readValueType="bit", writeStart="12292", writeValueType="bit", writeType="coil" ]


Switch DO4 “Digital Output index 4 [%d]” { channel=“modbus:data:hv1:coil:do4:switch” }
Switch DO5 “Digital Output index 5 [%d]” { channel=“modbus:data:hv1:coil:do5:switch” }

I can do what i want but i dont get any reaction or response by the PLC.

Please help me, actually ißm going crazy

PS: i activated the modbus binding by adding modbus to the addons.cfg is that right

(Rossko57) #522

Nope, this long thread contains how to install it; but that is best dealt with in the new thread you have started instead of appending here.

(Ssalonen) #523

Hi all,

I will disable the Eclipse Marketplace download links as now one should use the official snapshot version. When openHAB 2.4 is out, the new modbus binding will be included as part of that as well. See documentation (“Installation guide”) for more information.

Please open new threads for modbus binding related issues.

Please note that documentation is also merged to the official place:

(Łukasz Dywicki) #524

I’m not sure if its right moment to do such thing. I updated myself to OpenHab 2.3.0 (yes, I’m behind schedule) and I can’t install modbus binding. It is non existent in marketplace and not yet available in features.

(Ssalonen) #525


Did you try to install the snapshot addons by following the installation instructions in

There is no need to have marketplace for this binding, since the openhab project builds snapshot versions as well.


(Ssalonen) #527

This post was flagged by the community and is temporarily hidden.

(Nanna Agesen) #528


I have an issue were i need to write the value to a slave device as a holding register, and read the status from an input.

Normal it would look like this

Bridge poller Smartlight [ start=4538, length=4, refresh=5000, type="holding" ] {
	         Thing data Smartlight [ readStart="4538", readValueType="uint32_swap", writeStart="4538", writeValueType="uint32_swap", writeType="holding" ]


But in this case I need the feedback from another address that is an Input register.

(Rossko57) #529

Set up separate Things for your read and write paths, the Input register(s) are by definition read-only, but you will have to configure this/these holding regs as write-only (no polling)
Combine them in your Item bindings by simply assigning two channels.

(Nanna Agesen) #530

Sounds like the solution, can you please explain how to combine two channels for one Item?

(Ssalonen) #531

Since you want to read input registers, the poller should have input registers as the type, not holding as you have now.

The data thing is already configured correctly, it’s writing holding registers.

Essentially, the poller defines the read path, while data thing defines the write path.

Then just bind your item to the data thing. I don’t think you need to bind to two channels.

(Nanna Agesen) #532

I have already tried what you suggest

// #Smartlight Function
Bridge poller Smartlight [ start=4298, length=300, refresh=1000, type="input" ] {
	         Thing data Smartlight [ readStart="4298", readValueType="uint16", writeStart="4538", writeValueType="uint32_swap", writeType="holding" ]


But it gives me this error

11:59:43.940 [WARN ] [ort.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@5c07769f[slaveId=1,functionCode=READ_INPUT_REGISTERS,start=4298,length=300,maxTries=3]). Will try again soon. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 3 [operation ID 880e0e65-ce7e-4e52-a2d2-4e1a026c9b19]
11:59:44.003 [ERROR] [ort.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@5c07769f[slaveId=1,functionCode=READ_INPUT_REGISTERS,start=4298,length=300,maxTries=3]). Aborting. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 3 [operation ID 880e0e65-ce7e-4e52-a2d2-4e1a026c9b19]

(Nanna Agesen) #533

If I set up two Things and two items I get the correct reading and writing:

// #Smartlight Function
Bridge poller Smartlight [ start=4538, length=300, refresh=1000, type="holding" ] {
	         Thing data Smartlight [ writeValueType="uint32_swap", writeType="holding" ]


// #Smartlight Function
Bridge poller Smartlight1 [ start=4298, length=21, refresh=1000, type="input" ] {
	         Thing data Smartlight1 [ readStart="4305", readValueType="uint16" ]


(Rossko57) #534

As an aside, I’m curious about length=300 … does that work, exceeding Modbus transfer size?

(Nanna Agesen) #535

I’ll change the memory map of the Slave device so I will not exceed the Modbus transfer size and see if that changes anything.