Hello developers! One of my bindings has reached a state where i would like to submit it officially to OpenHab source tree. The binding in question is iRobot, discussed here: https://community.openhab.org/t/irobot-9xx-on-openhab
How do i do it? Do i just fork openhab-addons repo and make a pull request ? Or something different? Will there be a preliminary code review? If so, the binding repository is here: https://github.com/Sonic-Amiga/openhab2.roomba
Yes, this is about all you need to do.
Your URL appears to be openHAB2.
I believe they need it for openHAB3 (too?) before they will consider it.
Sorry am i out of date? Has OpenHAB 3 been released? I know about the development though. Are there any guidelines on how to port bindings to OH 3? I could do both versions.
All core development is on openHAB3.
Snapshots are being released and a Milestone build is expected soon.
I’ve tried to switch the codebase to 3.0.0-SNAPSHOT and failed miserably.
So first of all i’ve changed pom.xml of my binding:
<parent>
<groupId>org.openhab.addons</groupId>
<artifactId>org.openhab.addons.reactor</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
And got an error:
Non-resolvable parent POM for org.openhab.addons:org.openhab.binding.irobot:3.0.0-SNAPSHOT: Could not find artifact org.openhab.addons:org.openhab.addons.reactor:pom:3.0.0-SNAPSHOT
What am i doing wrong ?
Have you moved your code to the main
branch of the addons repo?
Have you followed these steps described here to migrate your code?
It might just be easier to start over by creating a skeleton project in the main branch and copy over your code afterwards. The documentation at Developer Guide | openHAB should mostly apply, the biggest difference is that OH3 requires Java 11.
I know about Java 11, i’ve installed it and i am even able to recompile the new 3.0.0 Daikin binding. Now i am playing “find the differences” game.
Perhaps i am going to end up recreating .project file from scratch. I see that the project does not even list “Maven dependencies” for some mysterious reason.
I preferred to do the migration by hands in order to understand the process.
What is said above. Yes use the skeleton script route. And some additional tips. Make sure it compiles and fix as much warnings as possible. Run mvn spotless:apply
to format the code. Use mvn license:format
to fix your headers. Make sure your readme is complete, that is, add a table with channels and examples of file configuration.
The .project files are no longer in the repo. (see Remove all .project and .classpath files after migration of add-ons to OH3 · Issue #8451 · openhab/openhab-addons · GitHub). When you import the project into eclipse, it will create the .project and .classpath for you.
Yes, i see you’ve removed them. So i also completely cleaned my binding repo and erased all traces of previous builds. No result. The error still is:
Project build error: Non-resolvable parent POM for org.openhab.addons.bundles:org.openhab.binding.irobot:3.0.0-SNAPSHOT: Could not find artifact org.openhab.addons.bundles:org.openhab.addons.reactor.bundles:pom:3.0.0-SNAPSHOT and ‘parent.relativePath’ points at wrong local POM
I have no idea what parent.relativePath is and where it’s stored. Looks like Maven tries to be veeery smart.
Meanwhile i’ll try to recreate the skeleton from scratch and copy the code over.
It6 no magic. If you only change the version of your binding the pom in the bundle directory stil has the old version and that causes the problem. You need to have all poms the same version. Hence better first follow the steps described above.
I’ve moved 4 or 5 bindings so far from 2.5.x to 3.0.0. It was a snap. All I do is this.
-
run
mvn clean
in the 2.5.x branch -
tar up the binding from my 2.5.x branch, then untar it into a branch I created from the
main
branch of the addons repo -
change the version number in the pom to 3.0.0
-
change the namespace of the core classes as described in @Hilbrand’s post
-
rename the ESH-INF directory as described in @Hilbrand’s post
-
run
mvn spotless:apply
to make sure the formatting is correct -
import into Eclipse as a maven project
Worked every time.
What’s the bundle directory and where is it ?
Meanwhile i solved the problem by recreating the skeleton. It does a lot of stuff under the hood with Maven, downloads lots of something, may be there are some hidden settings somewhere deep inside.
I hope i’ll be able to build also for 2.5 in parallel after this.
It’s the directory called bundle
When you first run maven, it will update everything, also the tools and dependencies that is a large list. I don’t know what you mean by hidden settings,
The binding itself won’t be compatible with 2.5.due to the namespace and OH-INF changes. If you want to have a 2.5 version you need to reverse the rename changes and place the binding on the 2.5.x branch.
Sorry for being so terribly stupid Where is it located ?
I decided that since for the time being i host the binding in a dedicated repo, i keep sources in a separate directory. Here is its structure (2.5 tree, so there’s still ESH-INF there, don’t pay attention):
└───org.openhab.binding.vacuum
└───src
├───main
│ ├───feature
│ ├───java
│ │ └───org
│ │ └───openhab
│ │ └───binding
│ │ └───irobot
│ │ ├───discovery
│ │ ├───handler
│ │ ├───internal
│ │ └───roomba
│ └───resources
│ └───ESH-INF
│ ├───binding
│ └───thing
└───test
└───java
And this is (partial) tree of openhab-addons repo:
├───.github
│ └───ISSUE_TEMPLATE
├───bom
│ ├───openhab-addons
│ ├───openhab-core-index
│ ├───runtime-index
│ └───test-index
├───bundles
│ ├───org.openhab.binding.adorne
│ │ └───src
│ │ ├───main
│ │ │ ├───feature
│ │ │ ├───java
│ │ │ │ └───org
│ │ │ │ └───openhab
│ │ │ │ └───binding
│ │ │ │ └───adorne
│ │ │ │ └───internal
│ │ │ │ ├───configuration
│ │ │ │ ├───discovery
│ │ │ │ ├───handler
│ │ │ │ └───hub
│ │ │ └───resources
│ │ │ └───OH-INF
│ │ │ ├───binding
│ │ │ └───thing
│ │ └───test
│ │ └───resources
│ │ ├───items
│ │ ├───sitemaps
│ │ └───things
│ ├───org.openhab.binding.airquality
--- cut ---
So there’s a directory called bundles, where sources of all the bindings are placed, and there’s no directory called bundle At least in places i know. Does Maven secretly store somewhere else (this is what i mean under “hidden settings” ) ?
Ah sorry for the confusion. I did mean the bundles
directory. (That what I get when not behind a computer and not checking…)
Hm, i didn’t know there is some magic connection between the binding and something else in that directory. I thought the binding source code can be placed anywhere, and i don’t even have to mention it in bundles/pom.xml and bom/openhab-addons/pom.xml , unless i am including it into the official package. And everything worked fine for 2.5.
And of course i checked out 3.0 version of the whole openhab-addons repo.
Ok, nevertheless, things are now (almost) fine and here is pull request: https://github.com/openhab/openhab-addons/pull/8723 . Fighting with beloved format checks at the moment (i thought Eclipse does it all because it perfectly autoformats my java code on the fly)
You can format with spotless. Run mvn spotless:apply