Modbus openHAB2 binding available for alpha testing

Tags: #<Tag:0x00007f1825ddeb10> #<Tag:0x00007f1825dde9a8> #<Tag:0x00007f1825dde818>

(Gabriel Klein) #222

Hi, thank you very much for the question. I can collect data from the SMA inverter. Thank you really much for the work, that’s amazing!

I was working on integrating my energy meter using the infrared interface that send information to MQTT. My “week-end” work is on I have a small raspberry that collect this information. I share this information because other people may be interested by this ~50€ project that give information concerning your power consumption, voltage, power factor and it’s not far from this project…

I’ll come back to the SMA part as soon as I can process the information I receive from my energy meter using MQTT.

What would be funny is to provide a modbus interface on my “energy meter raspberry” as I saw a few server in java… but it’s another project.

(Gabriel Klein) #223

I was in “simple mode” on Paper UI :slight_smile: Where you don’t see items :slight_smile:

I’m starting to use “configuration files” instead of the PaperUI because it seams more flexible (once you have understood how it works).

(Davide) #224

Excuse my naive question: is there a way to download the binary version to be installed on Openhab2 or it’s necessary to build it?


(Ssalonen) #225

It’s certainly recommended to use the prebuilt binary. See the first post with links. You can download the jar from eclipse marketplace or install it directly using marketplace addon.

(Davide) #226

Dear Sami,

from the first post links I cannot find the jars. I can just go to
github package source or Eclipse Smarthome.
Can you please provide me an explicit link or instructions about to get
the jars?

Many thanks,


(Miika Jukka) #227

I’m not Sami but I’ll answer anyway :slight_smile:

Easiest for you is to install IoT Marketplace extension in PaperUI. After that you can find both modbus and modbus transport bundles under addons -> bindings.


(Andreas Viborg) #228

Finally got this stuff working after spending too many hours trying to use the obsolete readwrite keywords as I only read post 24. @ssalonen you should edit that post 24 (and some other too) as obsolete!

Anyway looking forward to be able to poll at different rates which is the reason I want to try this new binding, so far I have only connected one item.

@ddozza you can find the jars for OH2.2.0 here: they are downloaded from the eclipse marketplace. I wanted to be able to pull the files to my raspberry and I couldn’t figure out how to pull them to my rpi from eclipse marketplace thats why I made copies.

Again, good work with this binding @ssalonen!

(Ssalonen) #229

Hi all

You can find the download url by clicking the download icon in marketplace. (Icon on the right)

Direct download links


(Ssalonen) #230

The download links have been updated in marketplace and above, version bumped to 2.3.0-SNAPSHOT. There were also some smaller fixes implemented (Thanks @gabriel.klein)

(Peter) #231

Here i am (coming from here: Modbus RTU Drexel & Weiss <> openHAB)
i installed (meaning: i put the 2 *jar files in addon folder) the 2.2 snapshot (as i’m on OH 2.2?) and i’d like to communicate with my heating system (read AND write).

with these settings i was able to read on 1.x addon:




Number Raum_MB "Raumtemperatur raw" (Modbus) {modbus="slave1:0"}

with new binding i tired to setup a thing:

log says:

2017-12-27 11:03:33.492 [WARN ] [ore.thing.internal.ThingRegistryImpl] - Cannot create thing. No binding found that supports creating a thing of type 'modbus:serial'.

what’s wrong here?

(Ssalonen) #232


Please use the versions linked on the opening post, or use the direct download links above. 2.2-SNAPSHOT is older version than 2.3-SNAPSHOT. Please note that generally speaking binding versions can differ from openHAB versions – for example, quite many bindings are 1.x still.

Let me know how it goes with the new version.


(Peter) #233

okay, deleted 2.2*jar and added 2.3 snapshot files.
still the same problem. here’s a longer log:

openhab.log shows ~4200 rows with this output (it comes again, and again, and again)
last row is where i try to add the thing

edit: ok, after doing all these things here: i was able to add a thing.

this is my serial slave:

next step, modbus data:

 Status: OFFLINE - CONFIGURATION_ERROR readStart=202, and readValueType=int32 were specified even though the data thing is child of endpoint (that is, write-only)! 

(Ssalonen) #234

Great to hear!

For the record, I have seen the following ERROR if you update the binding on-the-go, and not restart the binding afterwards (it has been discussed in this thread as well):

2017-12-27 13:51:44.536 [ERROR] [     ] - [MODBUS Connection Service(247)] The activate method has thrown an exception
java.lang.IllegalArgumentException: [org.apache.commons.pool2.impl.DefaultEvictionPolicy] does not implement EvictionPolicy
    at org.apache.commons.pool2.impl.BaseGenericObjectPool.setEvictionPolicyClassName( 

I highly recommend you to use jar files from the “official” sources I mentioned. This ensures you have the latest version (the instructions refer to which has the old version, containing some now-known, now-fixed, bugs). It’s also good to be safe and refer standard sources for the jar files.


(Peter) #235

i’m on 2.3 from here:
please take a look at my previous post. i was editing my post when you answered!

(Antanas) #236

to confirm I use the latest snapshot and it’s working as intended. One additional (sorry if again the same) question: what data type should be used for temperature readings?

Bridge modbus:tcp:HVAC [ host=“”, port=502, id=2 ] {

//902 Supply temperature RO signed short -500 - 1200 x10 C
//903 Extract temperature RO signed short -500 - 1200 x10 C

Bridge poller holding [ start=902, length=2, refresh=2000, type=“holding” ] {
Thing data holding1 [ readStart=“902”, readValueType=“float32” ]
Thing data holding2 [ readStart=“903”, readValueType=“uint16” ]

I get this: (events.log)
2017-12-27 15:25:17.320 [vent.ItemStateChangedEvent] - holding1 changed from 0.000000000000000000000000000000000000019469202256909675 to 0.00000000000000000000000000000000000001946920085561121
2017-12-27 15:25:17.356 [vent.ItemStateChangedEvent] - holding2 changed from 55 to 54

if I change “Thing data holding1” to readValueType=“uint16”:
I get this: (events.log)
2017-12-27 15:23:52.784 [vent.ItemStateChangedEvent] - holding1 changed from 212 to 211
2017-12-27 15:23:54.999 [vent.ItemStateChangedEvent] - holding2 changed from 54 to 55

so as far as I can check on my vent unit, its 19.4 degrees of celsius :slight_smile:

thanks a lot for pointing if I miss something.

(Ssalonen) #237

It’s indeed invalid configuration, in order to read data, you need to define poller. See “Supported things” in README:

[data thing] is responsible of converting openHAB commands to Modbus write requests. Is child of poller (read-only or read-write things) or tcp/serial (write-only things).

So set-up a Poller, and make it parent of data.


P.s. It’s still unclear to me what jar you are using. You talk about 2.3.0 but link 2.2.0 snapshot bindings

(Ssalonen) #238

@ArC thanks for the question!

These things are highly dependent on device manufacturera and the conventions differ. The good news is that the binding is pretty flexible, and should cover the known cases pretty well. You just have to refer to the manual for details.

How do you interpret this equation (?) yourself? The formatting is a bit off? Does it describe some sort of equation?

In order to apply equations to read number, you can use transformation. The readme has an example of scaling the number read, for example, 123 in register would be interpreted as 12.3. Now the question is what kind of equation to use…


(Rossko57) #239

I’ll take a guess it means to expect a register value between -500 and +1200, representing -50C to +120C.
We’ve no way to tell what format the value comes in, but you could try out as signed integer and see what you get

In your log, 212 looks like reasonable indoor temperature needing a divide-by-ten, see the scaling already pointed to.

(Peter) #240

ok, next try:
serial slave (no idea why serial port is listed / displayed twice?):

regular poller:


i get values, but i’m sure the values are wrong (temperatures - i have them on a display). shouldn’t i get the values for register 202?

(Antanas) #242

thanks @ssalonen ! played a little bit more and found that I was needed to adjust the registers in order to read the “right one” :slight_smile:

Adjusted to:
Bridge modbus:tcp:HVAC [ host=“”, port=502, id=1 ] {

//Register-902 Supply temperature RO signed short -500 - 1200 x10 C
//Register-903 Extract temperature RO signed short -500 - 1200 x10 C

Bridge poller holdingP1 [ start=901, length=1, refresh=2000, type=“holding” ] {
Thing data holding1 [ readStart=“901”, readValueType=“int16”, readTransform=“JS(divide10.js)” ]
Bridge poller holdingP2 [ start=902, length=1, refresh=2000, type=“holding” ] {
Thing data holding2 [ readStart=“902”, readValueType=“int16”, readTransform=“JS(divide10.js)” ]

and get nice readings:
2017-12-27 20:22:29.925 [vent.ItemStateChangedEvent] - holding1 changed from 19.1 to 19.2
2017-12-27 20:23:17.126 [vent.ItemStateChangedEvent] - holding2 changed from 21.5 to 21.4

And the last question related to Register readings: say I have below named in the manual:
Registers 906-907 “Current supply flow” RO unsigned int 0 - 200000 m3/h, l/s

how I should make my Number item to store this data read from 2 registers (906 and 907)? should I combine it somehow? sorry, I’m new - that’s why asking.