Any working tutorial for binding development?

Tags: #<Tag:0x00007f616d8d26f8>

Hi All,
I wanted to try out some binding debugging/development. After some hours of frustration I’m writing to you.

https://www.youtube.com/watch?v=o2QjCGdZl7s
Outdated, there is no eclipse run configuration

https://www.openhab.org/docs/developer/ide/eclipse.html
Without additional bindings I can start app.bndrun, but an empty page asks for HTTP credentials. I tried with and without addons enabled at eclipse setup.

https://www.openhab.org/docs/developer/ide/eclipse.html
With additional binding (e.g. Astro) I can’t start app.bndrun because ‘org.eclipse.smarthome.core’ is missing (adding it as dependency does not help)

https://www.openhab.org/docs/developer/ide/intellij.html
Can’t install any UIs, dashboard dies after first access

https://community.openhab.org/t/howto-setup-intellij-for-binding-development/87135
404 on root path

There are some topics in the community about development, but the ideas there did not help (or I misunderstood the solutions). My last Eclipse usage was two years ago and it feels like I’ve never seen it before :sweat_smile:

Additional information:

  • OS X 10.15.2
  • openjdk version “1.8.0_232” (Amazon Coretto)
  • Apache Maven 3.6.3

Is there any working tutorial out there?

Hey @darkspirit510, I wrote the IntelliJ tutorial (so I can only speak for IntelliJ) only a couple of weeks ago when I was in the same situation like you (actually without any tutoriol for IntelliJ) - so I’m really interested in getting this to work!
Can you be a little bit more precise on what the problem is?

Actually this step is just installing the official openhab distribution on your machine (no development specific steps about it) - so this really should work, otherwise there would be tons of complaints.

I’d suggest you pick a IDE you’re familiar with and open a thread for any specific problems if you have trouble getting it to run - this collective thread here will be confusing.

The second IntelliJ link you posted was just the first version I posted in the forum before creating a PR for the official docs (the first link). The forum version included steps for building the openhab distribution locally in the IDE, which is not necessary anymore since version 2.5 was released officially.

Hi @pravussum

I know that this should be a simple “download two files, extract one, place the other in the correct directory”-task. I can see the typical selection overview of which mode to setup your openhab (expect, basic, etc).

I’m familar with intellij, but don’t have problems using Eclipse. I just can’t get it running and would like to understand why - no matter which IDE. Maybe it’s my mac (just switched from ubuntu a month ago).

Edit: I’ll start over from scratch this evening and post my results. I’ll try things on a windows machine, too. Maybe I just misconfigured my device.

The documentation for Eclipse correct. However due to the start of version 3.0 you need to do 2 things:

  1. in openhab-distro: git checkout 2.5.x and in the openhab-addons you need to do the same.
  2. It has PaperUI installed in the demo, but you need to go to http://localhost:8080/paperui/index.html Opening the root will give you the login dialog.
1 Like

Wow, thank you! I could checkout the branches, start the backend and found the bindings. I can start the backend now - but I can’t add bindings. I started with an existing one (in this case Tankerkoenig). Another hint for me? :relaxed:

PS: Did I just attend with bad timing or should this be added to the tutorial?


Edit: Problem solved. Had to manually copy the compiled binding to addons directory. Working now. Thank you!

It’s both unfortunate timing and it should be added to the documentation (I’m working on that). However you should be able to add bindings to the demo app as described in the openHAB eclipse ide documentation, (See also animation) without having to add the binding to the addons folder. If you only want to run the binding it’s not necessary to first import the binding to eclipse before following the steps to add the binding to the demo app.

1 Like

Hi, I’m running into the same issue. Following the Eclipse IDE tutorial (from https://www.openhab.org/docs/developer/ide/eclipse.html ), the result is that the binding does not show up in paper UI. Any ideas on how to resolve it? Could it have to do with the version being used in the POM dependency?

It can be anything. Without specific details it;s hard to tell what the problem is… If you tried an existing binding and followed all the steps it should work.

I have found the reason, or at least part of it. I’m not using the Oracle JDK 8, but OpenJDK 11. It seems the reflection / injection needed for the add-ons is dependent on the runtime execution environment. Changing in the Core Runtime section of the app.bndrun the Execution Env from JavaSE-1.8 to JavaSE-11 makes it work. You still need to add the source to the source path of Eclipse, in order for the debugger to find the appropriate source. It seems that by default the workspace is not added in the source path.