Json 3rd Party Add-on Service: Generate kar/json file for addon

Dear all,

I create a new Openhab 3 bundle/addon/binding to connect to an external device and successfully generated the corresponding .jar file e.g. org.openhab.binding.BINDINGNAME-3.3.0-SNAPSHOT.jar.

In Openhab 3, I appreciate to contribute alternative addons via Json 3rd Party Add-on Service providing a json file via web server that delivers a .kar file to the openhab installation.

Although, smarthomej provides such an external bundle (https://download.smarthomej.org/addons.json), I was not able to successfully generate

  • KAR file from the binding.jar
  • Json to be promoted via webserver.

Could you please provide a small tutorial how to build a KAR file and corresponding json file to deliver an alternative binding to an openhab installation.

Thanks in advance. Best ruebox

There is no mechanism to create the JSON automatically. You need to write it by hand (or create a script for that).

Regarding the kar: there are different ways. You can change the type in the Pom from jar to kar, or call the appropriate goal for the karaf-maven-plugin. It depends on your setup what is better.

In general: if you have no dependencies that need to be bundled or features that need to be installed, I recommend distributing the jar. It’s easier than creating a proper kar.

Hi @J-N-K

thanks for your fast response. I tried to write a corresponding json file. It is recognized by openhab, but the reponse of openhab ui is … installation failed.

My json looks alike:
[
{
“id”: “org-smarthome-binding-ofsomething”,
“type”: “binding”,
“version”: “3.3.0”,
“author”: “ruebox”,
“maturity”: “stable”,
“content_type”: “application/vnd.openhab.feature;type=karfile”,
“link”: “Amazon Echo Control Binding”,
“url”: “http://localhost:8888/bundles/org.openhab.binding.BINDINGNAME-SNAPSHOT.jar”,
“title”: “binding title”,
“description”: "This binding can control Something. "
}
]

I also checked content_type: jarfile.

unfortunately, no success. Could you give me a sample of a json that deploys a simple jar without any dependencies?

Thanks a lot.

The correct content_type for a jar file is application/vnd.openhab.bundle, otherwise looks good. But please use an id-prefix (before binding) that is related to a domain that you control (or that is otherwise guaranteed to be unique).

You made my day :+1:

Works ad-hoc …THANK YOU!

@Confectrician Where would be a good place to add documentation for that?

Good point, I searched at the following place:

I could imaging to add a section
Distribute your new binding

  1. Json 3rd Party Add-on Service
    How to deliver a new e.g. JAR binding in a lightweight way e.g. for testing
  2. Community Marketplace
    How to deliver a new binding via community marketplace.

What do you think? I could write a small section for the first part.
I am not aware how to distribute via community marketplace.

Clearly somewhere in the developer section, but probably this is too specific to include it into one of the existing pages.

Maybe a new page should be added for it.