**PLEASE don’t use this without also updating the device database! As a community, we make the most progress when everyone contributes!**
I’ve seen several posts where people have made changes to the device database and they were eager to try out their new shiny gizmo, or wanted to test a change/fix an issue, before it was included in a build. Here is a method to update the zwave jar with a modified device Thing definition, without having to use an IDE to modify and compile the jar. This method could also be used to modify other bindings. The tutorial is written for OH systems running on Linux, but most/all may be applicable for Windows. Please use at your own risk!
If you installed the zwave binding through PaperUI or Karaf, then uninstall it and restart OH.
Download the jar that you want to modify, and save into a working directory outside of any OH directory. Typically, you will download a snapshot version of the jar from https://ci.openhab.org/view/Integration%20Builds%20(2.5.x)/job/openHAB2.5.x-ZWave/lastSuccessfulBuild/artifact/target/org.openhab.binding.zwave-2.5.4-SNAPSHOT.jar
In the same directory where you have the jar, create the following directory structure (case sensitive). You’re basically recreating the directory structure inside the jar. Jar files are archives, which can be extracted and viewed, just like a zip file. You can browse into the jar to compare it to the directory structure you’ve made. Step 5 will show you how to find the [vendor].
|_ [working directory where jar was downloaded to] |_ ESH-INF |_ thing |_ [vendor]
Go to the device database, follow the instructions for requesting an account (if you haven’t already), login, and create or modify the device.
Export the XML from the database (from the top of the device’s page, Export> OpenHAB 2). Copy the contents of the XML and paste it into a new text file. In the XML, you will find a thing-type id, which is in the format of [vendor]_[XML file name with some extra zeros]. Don’t worry about the extra zeros… they won’t be an issue. Save the XML file into the [vendor] directory that you created, using the file name from the XML file with an xml file extension.
If you currenty have the zwave binding manually installed (copied a jar into /addons), it is easiest to name this new jar the same as the current jar that you are using so that the older one is overwritten by the new one. Otherwise, OH will cache the older file after it has been deleted, and you will need to restart OH to get rid of it.In a terminal, go to the parent working directory and execute…
jar -uf org.openhab.binding.zwave-2.4.0-SNAPSHOT.jar ./ESH-INF/thing/[vendor]/[XML file name].xml
- Copy the jar from your working directory into the /addons folder.
- The binding will now start. If you were modifying the XML for a device that you have already included, then delete the Thing (Configuration> Things> Delete in Habmin or PaperUI), and then run discovery for the binding. This is needed to pickup the new Thing definition in the XML. If you have a static Thing file for a device that you have already included, then move the file out of OH and then move it back to delete the Thing.
- When a new build is available with the changes that you made to the device database, delete the jar, restart OH, install the updated binding, and delete/rediscover the Thing like in step 8.