How to install a SNAPSHOT version of a binding in a OH2b4 installation

I have a installatoin of OH2 beta4 which I installed via apt-get. It’s the openhab-online distribution. Now I would like to test a SNAPSHOT version of a binding. How can I update the already installed binding to a snapshot version. I tried:

Karaf

bundle:install https://openhab.ci.cloudbees.com/view/All/job/PR-org.openhab.binding.zwave/ws/target/org.openhab.binding.zwave-2.0.0-SNAPSHOT.jar
bunde:stop 188 (old/ beta4 zwave binding)
bundle:start 192 (new zwave binding id)

The error I get

error executing command: Error executing command on bundles:
    Error starting bundle192: Could not resolve module: org.openhab.binding.zwave [192]
  Another singleton bundle selected: osgi.identity; osgi.identity="org.openhab.binding.zwave"; type="osgi.bundle"; version:Version="2.0.0.b4"; singleton:="true"

Restart did not help. I tried uninstall the original binding via paper ui and install the newer binding via addons folder. Also did not work…

So what is the recommended way to test a SNAPSHOT binding on a beta installation?

Thank you

Hopefully someone can help. If you figure this out this sounds like an excellent Tutorial and I’d encourage you or whom ever helps you to create a tutorial explaining how to do it.

Obviously I’m not help myself.

It sounds like you might be looking for a variant of this?

It doesn’t appear to be a priority.

Yes, thank you for the link. Unfortunately it looks like you are right and this does not have priority. Still, it needs to be possible already somehow. But I probably have to dig deeper in OSGI Karaf and the runtime to understand it properly. With OH1 that was pretty simple… Once I find out, I will post here, although I just spend little time on the topic right now.

Even if you are successful in getting this to work, at some point there may be changes to the framework and/or binding that cause the combination of beta framework and binding snapshot to stop functioning correctly.

It is possible to install any bundle - it just takes more effort and is error prone which is why I raised the issue on this.

To install a different bundle, probably the easiest way is to install the bundle from the UI (eg ZWave). Then to log on to the console and uninstall the bundle, and then to drop the updated bundle into the addons folder.

The reason to do it this way is it resolves any dependancies (eg for ZWave it resolves the serial library).

(I think this should work ;)).

For those who struggle with the description. I did the following

  1. Install z-wave binding via paper ui
  2. go to karaf console and uninstall the binding via console
ssh openhab@localhost -p 8081   

password is 'habopen’
list the installed bundles:

bundle:list

...
184 | Active   |  80 | 2.0.0.b4              | openHAB Dashboard UI
185 | Resolved |  80 | 2.0.0.b4              | openHAB Paper UI Theme Fragment, Hosts: 180
186 | Active   |  80 | 0.9.10.v20160429-1435 | reflections (wrap)
187 | Active   |  80 | 1.5.8.v20160511-1038  | swagger-jersey2-jaxrs (wrap)
190 | Active   |  80 | 0.9.0.b4              | HABmin User Interface
191 | Active   |  80 | 2.0.0.b4              | HomeKit Integration
198 | Active   |  80 | 2.0.0.b4              | ZWave Binding
199 | Active   |  80 | 2.0.0.b4              | openHAB Serial Transport Bundle
...
   

search for the zwave binding. In my case it had id 198
uninstall the binding using this id

bundle:uninstall 198

exit the karat console with

Ctrl+D
  1. Install newest snapshot
    got to ‘/usr/share/openhab2/addons’ (if you installed with apt-get)

Download the bundle here. e.g.

cd /usr/share/openhab2/addons
sudo wget https://openhab.ci.cloudbees.com/job/openHAB2-Bundles/lastSuccessfulBuild/artifact/bindings/org.openhab.binding.zwave/target/org.openhab.binding.zwave-2.0.0-SNAPSHOT.jar

Hope this helps someone.

11 Likes

Under Add-ons, Bindings, it still shows the originally installed zwave version for me after performing this style of update.

Also note that I had to use port 8101 instead of this port:

Hey. Can you elaborate as it’s not working for me? I’m very inexperienced with using the console. I’ve typed this in and receive the following error:

openhab> ssh openhab@localhost -p 8101
Error executing command: Error executing command ssh: too many arguments specified

All I’m looking for is a way to install the latest development version to see if it fixes issues with changing associations in 2.2.0.

the openhab> prefix on you console looks like you are already logged into the karaf console… just type

bundle:list

If the bundles are listed you are indeed already logged in and can try to achieve whatever your goal was.

wiht help you get the sub shells and commands listed.

Doh! It was about 1am when I sent that, so took the guidance very literally! Thanks for pointing out my error. My goal is to install the latest development build of the z-wave binding to resolve an error with setting up associations.

Presumably, I need a .jar file to add this through Karaf but I can’t find a .jar of the latest development version. Sorry if I’m still being dense here! Any help would be appreciated.

The latest snapshot of zwave add-on you always find on cloudbees.

currently this is:

https://openhab.ci.cloudbees.com/job/openHAB2-Bundles/lastSuccessfulBuild/artifact/bindings/org.openhab.binding.zwave/target/org.openhab.binding.zwave-2.3.0-SNAPSHOT.jar

Once 2.3.0 is released the version will change accordingly…

By the way, I still haven’t found the time to try this, but thanks for the assist. Will report back once I get this updated.

(I’m Java developer with eclipse plugin, ServiceMix and OSGi experience)

Thanks for the info Chris. What is PaperUI doing to the runtime when you install the zwave binding that enables the addon folder to work for bundles?

Is there a ZWave binding wiki/FAQ somewhere? Looking for answers in discord - across years - is a wee bit exhausting and uncertain.

Thanks for all your efforts,

  • Chris

It simply installs the OSGi bundles and then tries to activate them (resolving dependencies etc). The system uses the Karaf container, so a search for this and OSGi principals should fill you in.

Find the bundle ID you’d like to update using
list
Then

bundle:update -r [bundleId] https://openhab.ci.cloudbees.com/view/All/job/PR-org.openhab.binding.zwave/ws/target/org.openhab.binding.zwave-2.0.0-SNAPSHOT.jar

Make sure the location matches the bundle you want to update.

See also

bundle:update --help

I’m reviving this topic since it’s ranks high on search engines on how to update bundles in karaf.