Modbus openHAB2 binding available for alpha testing

Tags: #<Tag:0x00007f1833856950> #<Tag:0x00007f18338565b8> #<Tag:0x00007f1833856298>

(Nanna Agesen) #142

Hi Again

I’m seeing this error, and only able to read/write the first Data Thing from the poller

08:49:25.036 [ERROR] [ort.modbus.internal.ModbusManagerImpl] - Unhandled exception in callback: java.lang.IllegalArgumentException Index=16 with type=uint16 is out-of-bounds given registers of size 8
java.lang.IllegalArgumentException: Index=16 with type=uint16 is out-of-bounds given registers of size 8
	at ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusDataThingHandler.onRegisters( ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator.lambda$2( ~[?:?]
	at$ForEachOp$OfRef.accept( ~[?:?]
	at$3$1.accept( ~[?:?]
	at$2$1.accept( ~[?:?]
	at java.util.Iterator.forEachRemaining( ~[?:?]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining( ~[?:?]
	at ~[?:?]
	at ~[?:?]
	at$ForEachOp.evaluateSequential( ~[?:?]
	at$ForEachOp$OfRef.evaluateSequential( ~[?:?]
	at ~[?:?]
	at ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator.forEachAllChildCallbacks( ~[?:?]
	at org.openhab.binding.modbus.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator.onRegisters( ~[?:?]
	at ~[?:?]
	at$18( ~[?:?]
	at java.util.Optional.ifPresent( ~[?:?]
	at$9( ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:?]
	at java.util.concurrent.ThreadPoolExecutor$ [?:?]
	at [?:?]

(Nanna Agesen) #143

SORRY - updated with your latest version and all is fine now :slight_smile:

(Frederic Mariën) #144

Hi @ssalonen,

I can confirm that the latest version with date of today fixes the issue.
@Nanna_Agesen I think you are seeing the same error I had. Have you tried the version that was published today?


(Nanna Agesen) #145

@FredericMa Yes I updated it and works like a charm now :slight_smile:

(Nanna Agesen) #146


I have now converted my complete setup with approx 500 Data Things on 6 different slave devices.

I haven’t found any bugs since your update this morning.

I believe the setup covers most of the read/write types supported by your binding, I haven’t got the chance to test Coils, and hopefully the future will bring Uint64 support :slight_smile:


(Didier) #147

Hi ssalonen ,

I’m using a plc to control my house and i want to use Openhab2 to managed it.
Do you have a idea when you will release your Modbus binding ?

Thnaks a lot and once again good job i want to test this:wink:.


(Ssalonen) #148

Thanks for the interest!

It’s quite hard to estimate when it will be “released”. We are still in testing phase, and would like to keep it like that for a while. After that I fear that the pull request to be accepted might take some months (there was already some copyright related discussion ongoing)

The good news is that there is the Eclipse IOT marketplace which allows you to accept the binding even before it is “official”. If you feel bold I welcome you try the binding as it is now!

As an alternative, you can always use the old but more stable modbus binding, it works as before with openHAB2.

(Nanna Agesen) #149

I’m experience some slow response from one of my slave devices, do you have an idea if this response could have something to do with that?

05:33:00.546 [INFO ] [ort.modbus.internal.ModbusManagerImpl] - Unregistering regular poll task PollTaskImpl@76bdd456[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@470aa079[slaveId=30,functionCode=READ_INPUT_REGISTERS,start=100,length=14],endpoint=ModbusTCPSlaveEndpoint@13bb9a66[address=,port=502],callback=java.lang.ref.WeakReference@2840e986] (interrupting if necessary)
05:33:00.547 [INFO ] [ort.modbus.internal.ModbusManagerImpl] - Poll task PollTaskImpl@76bdd456[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@470aa079[slaveId=30,functionCode=READ_INPUT_REGISTERS,start=100,length=14],endpoint=ModbusTCPSlaveEndpoint@13bb9a66[address=,port=502],callback=java.lang.ref.WeakReference@2840e986] canceled

Best Nanna

(Miika Jukka) #150

Hello again, @ssalonen

As a background info I renewed my system changing RPi3+openHABian to an dedicated desktop/server running Debian 8+ latest openHAB 2.2.0 snapshot. Updated your binding also to the latest version and changed all thing types to data.

Not a single error and everything works like a charm. I really like the the new .things file and how the config is simplified.

Keep up the good work and thank you! :+1:


(Didier) #151


I will test your binding and keep you inform.



(Ssalonen) #152

@Nanna_Agesen that should happen only when things are changed, I believe.

Do you get that message constantly?

Verbose logs probably reveal more where the time goes…

(Nanna Agesen) #153

@ssalonen I get them if my polling interval is too low, I have tested the troubled device and if I have it under 5000 I get those warnings - and also every other devices are delayed for 4-8 seconds.

Ill try logging in verbose later today, to se if that reveal more.

(Ssalonen) #154

Everyone, please switch to data things. I will remove the read, write and readwrite in the coming days.

Let me know if you find any issues!

Progress update: have been working on the README mostly, it’s progressing pretty well.

The next step after README will be code cleanup, commenting the code etc. in preparation of polishing it for merging as official addon for openHAB2. There is also some discussions how the code is organized, but I’m sure some solution is found there.

Move to Modbus 2.X binding
(Miika Jukka) #155


I remember having to install serial transport feature manually from karaf console following these steps in post #24. Does the binding install it automatically now?

(Jon Sands) #156

I’ve been using a PLC to control my house with OH2 and the 1.11 stable modbus binding for like, a year now? 100 or so registers/items, zero problems

(Ssalonen) #157

I don’t think it installs the serial feature automatically. Not sure I can fix that before the binding is official and the feature installable from karaf console.

(Ssalonen) #158

@Nanna_Agesen did you manage to see the problem again, or get verbose logs?

(Nanna Agesen) #159

@ssalonen After some more tests I found that these errors only shows up after a restart/initializing - been on vacation, and will do a few more test this week.

(Mbs38) #160

@ssalonen First off: thx for writing the extensive Readme file - it has been hugely helpful.

However, there is one question left: Is it possible to change thing parameters (in my case the refresh parameter of the poller bridge) using rules?
I have a device which after it has been given the command to perform a measurement is not reachable via modbus for a certain amount of time. It would be very handy to have coils and registers of the device polled as often as possible and to switch off polling for the amount of time it takes the device to perform the measurement. Using the otherwise useful refresh command is not really an option because I would have to send the refresh command multiple times per second to achieve the same speed I can get when the data is polled constantly…

Best regards,

(Ssalonen) #161

Yeah good question! I am not sure if this is possible, I am bit too unfamiliar with the new base still. I did find this thread from eclipse smarthome forums regarding the same thing:

Would it make sense to comment there?