On Creating Bindings

I’m thinking about trying to create a binding for this:


However, while I’ve got some coding know-how I’m not a developer and have never created an openhab binding. I don’t even have openhab installed atm!

Anyway, in weighing this up I’ve had a look at the repo for the code that drives this product:

…and see that they have a python library for device management. However, as I understand it, openhab bindings are java only? Does this mean that library would be of no use for this?

Any advice on how I should proceed or whether to even bother at all will be warmly appreciated:)


That is correct. OH is written in Java and can only natively use java libraries or C/C++ libraries specially compiled with
jni support.

But you can call Python scripts from Items and Rules. Or you can run a separate Python server that OH communicates with. I’ve just such a script that lets my OH communicate with my remote arduino and RPi sensors and actuators (recently updated to make adding new capabilities much easier)…

Thanks for your response. So this means that most of the time I would need to write some kind of bridge that talks to the remote device(s) and output values to openhab?

Is the interface between openhab and python scripts and/or server defined anywhere? If I can do my thing completely in python that will be helpful as, while I don’t mind learning, I’ve done no java programming.

It’s sounding like I could write a wrapper to the bluenet library and have openhab call that as and when. Do python versions matter here? I presume not very much?


Pretty much correct. This can be a complete always running server like my sensorReporter, or as simple as a bunch of shell scripts that OH calls.

Depends on how you want to do it. If you have a full up server you will probably want to use the MQTT Binding or set up a REST API that OH calls with the HTTP binding. If you just create some shell scripts then you will want to use the Exec Binding or executeCommandLine actions which allow OH to execute shell commands and use the result to populate Items or within rules.

Depends on the requirements of the bluenet library. All OH will see is the command line to execute or what ever API you set up to communicate with it.