Develop a new addon outside of "openhab2-addons" repository

I’ve created a very simple addon by following the development instructions, but it’s based around editing a private fork of the openhab2-addons repository.

I guess I’m confused by this being the process for a number of reasons. What I really want to do is have my own repository in which I can develop my own add-on that I can then just “install” into a standard openhab2 installation.

Is there any guidance or example of that anywhere?

More generally, if add-ons were then published into a repository, some kind of “marketplace”, then these would then be easily installable by anyone wouldn’t they?

Thanks.

If you compile an addon into a jar file you can then place it into the addons folder in your openhab directory to install it.

You can upload a jar file to the Eclipse IoT marketplace to make it easily installable by anyone.

Yes, but what I want to do is set up a git repository that contains just my add-on. I was looking for instructions or an example repository containing a “hello world” add-on, complete with build script that I can use for the basis of my repository.

And that’s integrated with openHAB is it? I have yet to understand how the “addons” list was built. I was hoping that there was some easy way I can add an additional repository to the openHAB configuration so that I could “publish” my add-on and then easily install it into openHAB. Since this is all done through Karaf, is the list actually populated by listing all of the bundles available in the configured repositories, and using some kind of naming convention? How does that actually work?

Thanks

The only example I can think of is https://github.com/openhab/org.openhab.binding.zwave. You will probably need to look at what the pom.xml in that repo does to see how it gets built (i.e. resolving dependencies etc).

Unfortunately I’m not a karaf expert so I don’t know how exactly that is all configured. That, IMHO, would not make it easily installable on the base openhab2 installation as a user would have to amend the source list.

What I naively assumed was that there was a central repository in which all “published” add-ons were pulled from. Kind of like “maven central”. This is how “Jenkins” works. For most people, for most purposes, that’s fine.

If I’m developing a new add-on, I am doing advanced stuff. So a bit of configuration is required, but in the same way that I can configure local maven repositories to hold my private artefacts, I could configure a local “repository” from which I could install a private add-on while I’m developing it, or if it’s just not general purpose enough to warrant “publishing”.

Having all the add-ons in a single large repository doesn’t seem ideal, but there’s probably good reasons for it. As you can tell, I’m new here.

In that case - welcome! :slight_smile:

As I said, there are exceptions to this - please see the zwave binding which has its own repo (linked in previous post). I would imagine that would give you a start as to what a repo containing a single binding / addon may look like.

Given that you can already use the Eclipse IDE to test a WIP add on, or compile and drop the jar into an existing OH2 install I’m not sure what your use case is - but equally the technical details (regarding repos etc) to get you there are probably over my head.

I’d suggest a search for iot marketplace. As mentioned earlier, you can publish your addons there, and these are then listed in the UI so anyone can install them. The list of addons comes directly from the list published in the marketplace, so is in effect similar to the central repository that you are looking for.

Ah, useful link, thank you.
I’m on openHAB 2.0 at the moment, but I’ll look into it.

This has to be the way forward, rather than using one single git repository for all add-ons. Surely each add-on would have its own set of knowledgeable people who would be the ones to approve PRs anyway.

So all I have to do now is work out how to build just my add-on, and not the entire openHAB, and I’ll be happy.

Thanks.

1 Like