I’m currrently resuming work on an Daikin/Altherma binding for older heatpumps. While doing so I’m wondering what is the recommended of coding changes, building and deploying.
Coding and building is straightforward to the point of running mvn install which produces deployable JAR file.
Then it get’s a bit more tricky wrt. to deployment. My steps so far are:
copy via SSH to server
move to addons folders
wait for Openhab to pick up the addon either install or update (not fully sure how Openhab behaves in different scenarios wrt. to the JAR file under addons being create/updated/deleted).
Question how you guys do this typically?
Also is it possible to feed a JAR file into web UI and or the openhab-cli (maybe even via the ssh version of it)?
Post it to the marketplace, then it can be installed via UI.
Ther are a lot of bindings already posted, so you can check, how the post should look lige.
Well I thought now I could make use of the REST API /rest/addons/url/{url}/install
Started to draft a simple script with Node.js to create a local (temporary) web server and then hitting that REST API above. After not getting it to work, i did some code research and it turns out that above REST endpoint is by far not as universal as it looks. It seems to only accept URLs of the form https://community.openhab.org/… as per code of org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.
At least what works is to go via Karaf console and then issue a command of the form bundle:install http://…
I may also go the route of community marketplace. But the addon is still in an early stage.
I usually have an OH instance on my dev computer for initial testing that runs in debug mode so I can debug directly from the IDE (IntelliJ IDEA). But the process is basically the same as yours except I just copy the jar to the local addons folder instead of to a remote machine. When I feel it’s reasonably stable I copy it to my production instance for more long term testing just the way you do.
I made another attempt with the Karaf maven plugin:
org.apache.karaf.tooling
karaf-maven-plugin
using its deploy goal.
This will create an SSH connection to the Openhab instance which works but then the issues bundle:install command fails. Also it does not seem to be able to create a remote upload of the JAR itself. But it also fails even if i point it to the URL of the local temp HTTP server using the parameter. So that also does not seem to be a viable path.
Next ideas:
use ssh/plink command to trigger bundle:install
create Openhab rule with script to trigger bundle:install
Does anyone here have an idea how/if this can be done?
create custom addon code to launch bundle:install somehow
So one more attempt. Now using a script inside of Openhab. I tried it with Groovy as attached below. The script executes fine and also bundle becomes available in bundle list and it is also active but I now ended up in a situation where the bundle is in that state but no addon is visible in Addon-Store → Bindings also the Thing type is not offered in list of new things. According to:
there should not be much more to it. Could it be that with the new Addon marketplace an extar step is necessary to register a bundle as an addon?