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.
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.
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.
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?
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).