[solved] How to add binding source to working project in eclipse

You probably need to add ZWave to the debug set. Right click on the debug button and select configure. Then you need to add the ZWave binding to the list of running bundles.

In which tab? (see img1)
I was able to add the habmin jar in the “Plug-ins” tab, but now I want to add the zwave binding as source project
I tried adding in the zwave source project via the Plug-in (see img2), but it didn’t make any impact.

img1

img2

Plug-ins tab.

I tried adding in the zwave source project via the Plug-in (see img2), but it didn’t make any impact (see img2).
I think this is because the zwave binding is in a different section (“Worspace”) than bindings that do appear in habmin, e.g. yahooweahther in section “Target Platform” (see img3)

img2
https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/3/346291ef5bbba82dc7e9e23585dff67f535f78f3.png

img3
http://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/0/0f5fc33697a109bff2f3f1c113dc590b2300bbd8.png

I doubt it - if it’s part of the workspace (ie it’s in the list of projects somewhere) then it should appear. If you’ve imported it into a completely separate workspace, then sure it won’t work. The section though doesn’t matter (the working sets I think it’s called?)

Ok, I reinstalled eclipse using only the “openHAB Development”, without all the oh1, oh2 (to make it lightwight).
I then added habmin as a jar. (I still needed to activate the habmin selection, after adding it, by selecting and right-clicking the openhab.target -> Debug -> Debug Configurations -> (tab) Plug-ins
and ticking the habmin (under “Target Platform”)

I then added the zwave binding (similar to doing steps 1-7 mentioned above), using the following steps:

  • step1 - add zwave binding
    step1.a - link zwave binding to the target platform
    Windows -> Prefernce -> Target Platform -> selected “openHAB Target Platform” -> Edit -> (in tab “Locations”) Add -> Directory
    pointed to zwave binding directory from previous eclipse installation (/home/avnerm/openhab2-master/git/openhab/bundles/binding/)
    In tab “Content”, enabled (ticked the box) org.openhab.binding.zwave
    step1.b - add the zwave binding to eclipse
    "Package Explorer" -> right-click on “Other Projects” -> Import -> Projects from Folder or Archive

  • step2 - build zwave binding
    Arbitrarily edited a file (ZWaveBindingProvider.java) within zwave source project.
    Added an erronous code line just to see that the project fails to build then removed the error, and verified that the project builds ok (errors are gone from e “Problems” pane)

  • step3
    Directed the eclipse console output into file

  • step4
    Invoked the openhab program
    Right-click openHAB_runtime.launch -> Debug As -> openHAB_Runtime

In the console log file, I do see the following log messages indicating that the zwave binding is engaged, but I still do not see it in the list of available bindings in habmin???

/tmp/eclipseOutput.txt

2016-11-25 14:29:08.634 [DEBUG] [.core.common.ThreadPoolManager:145  ] - Created thread pool 'safeCall' with size 5
2016-11-25 14:29:08.637 [DEBUG] [.zwave.internal.ZWaveActivator:37   ] - Z-Wave binding started. Version 1.9.0.qualifier
2016-11-25 14:29:08.657 [DEBUG] [c.x.o.XmlDocumentBundleTracker:126  ] - Reading the XML document '/ESH-INF/thing/ColorTemperatureLight.xml' in module 'org.eclipse.smarthome.binding.hue'.....
Service, policy = dynamic, cardinality = 0..n, target = null, bind = addActionService, unbind = removeActionService]
2016-11-25 14:29:09.457 [DEBUG] [.z.internal.ZWaveActiveBinding:177  ] - ConverterHandler not initialised. Polling disabled.
2016-11-25 14:29:09.458 [INFO ] [.z.internal.ZWaveActiveBinding:330  ] - ZWave 'updated' with null config
2016-11-25 14:29:09.461 [DEBUG] [c.x.o.XmlDocumentBundleTracker:126  ] - Reading the XML document '/ESH-INF/binding/binding.xml' in module 'org.eclipse.smarthome.binding.ntp'...
...

You don’t say that you added the ZWAve JAR to the running config.

I thought that in case of adding the source project, the jar file does not have to be added (unlike the habmin which is added as closed jar file without code). Do you know where the zwave jar file is stored in the org.openhab.binding.zwave1 project?
The only zwave related jar file that I can find is

find  /home/avnerm/openhab2-master -name "*.jar" | grep zwave
/home/avnerm/openhab2-master/git/openhab/bundles/binding/org.openhab.binding.zwave/lib/xstream-1.4.6.jar```
Is this the one?

You always have to update the debug plugins - always.

I thought you’d installed the source - so you should be running from the source - right?

The source is installed in

ll /home/avnerm/openhab2-master/git/openhab/bundles/binding/org.openhab.binding.zwave/
total 56
drwxrwxr-x   8 avnerm avnerm  4096 Nov 21 14:31 ./
drwxrwxr-x 168 avnerm avnerm 12288 Nov 25 14:07 ../
-rw-rw-r--   1 avnerm avnerm   223 Nov 21 14:23 build.properties
-rw-rw-r--   1 avnerm avnerm   499 Nov 21 14:23 .classpath
drwxrwxr-x  62 avnerm avnerm  4096 Nov 21 14:23 database/
drwxrwxr-x   2 avnerm avnerm  4096 Nov 21 14:23 lib/
drwxrwxr-x   2 avnerm avnerm  4096 Nov 21 14:23 META-INF/
drwxrwxr-x   2 avnerm avnerm  4096 Nov 21 14:23 OSGI-INF/
-rw-rw-r--   1 avnerm avnerm  1001 Nov 21 14:23 pom.xml
-rw-rw-r--   1 avnerm avnerm   840 Nov 21 14:23 .project
drwxrwxr-x   3 avnerm avnerm  4096 Nov 21 14:23 src/
drwxrwxr-x   3 avnerm avnerm  4096 Nov 21 14:31 target/

The only zwave related jar file that I can find is

find /home/avnerm/openhab2-master -name "*.jar" | grep zwave
/home/avnerm/openhab2-master/git/openhab/bundles/binding/org.openhab.binding.zwave/lib/xstream-1.4.6.jar

Is this the one (I expected it to have a name like org.openhab.binding…zwave…jar) ?

But you’re running the source project, so there’s no point in looking for a JAR. The JAR is created when you run the project.

I’m running the openhab source project (by doing right-click openHAB_runtime.launch → Debug As → openHAB_Runtime ) that should be linked to the zwave source project.

Isn’t step1 doing that? (see img1) and isn’t the log messages indicating that zwave is engaged?

img1

Yes, from the image, it looks ok - I’m not sure I understand what you wrote, but the image looks ok.

Should work fine I think.

I wanted to see if the debugger gets to execute the zwave code by setting a breakpoint in a central point, so I placed a breakpoint in ZWaveActivator.java, and the program gets there. I changed the log message:

from 
Z-Wave binding started. Version 1.9.0.qualifier
to
Z-Wave binding started111. Version 1.9.0.qualifier

stopped the program, re-invoked the debug and the change shows up in the log file

cat /tmp/eclipseOutput.txt
...
2016-11-25 15:31:35.113 [DEBUG] [.zwave.internal.ZWaveActivator:37   ] - Z-Wave binding started111. Version 1.9.0.qualifier

This indicates that the zwave binding is linked to the program.
Shouldn’t I see it in the list of bindings in habmin?

I’m working with org.openhab.ui.habmin_0.1.6.jar. According to the documentation this is Habmin2, right?

If this is Habmin2, then according to these comments, should I even expect that zwave binding will show up in habmin?

Also, the name of the binding in /home/avnerm/openhab2-master/git/openhab/bundles/binding/org.openhab.binding.zwave
is advertised as: org.openhab.binding.zwave1. Is there a reason for the “1” in the name “zwave1”?

I compared 2 use cases:
use case1
openhab2 + habmin + zwave binding within eclipse

  • does NOT show the zwave binding (img1)
  • not sure if the zwave version is 2.0.0.b3, or 1.9.0.b3 (snippet1)?

use case2
openhab2 from regular user install (using this tutorial)

  • does show the zwave binding (img2)
    zwave version 2.0.0.b3? (snippet 2)

snippet1

find  /opt/openhab2/ -name "*zwave*"
/opt/openhab2/runtime/karaf/system/org/openhab/addons/openhab-addons-external/1.9.0.b3/openhab-addons-external-1.9.0.b3-mios-zwavestatusin.map
/opt/openhab2/runtime/karaf/system/org/openhab/binding/org.openhab.binding.zwave
/opt/openhab2/runtime/karaf/system/org/openhab/binding/org.openhab.binding.zwave/2.0.0.b3/org.openhab.binding.zwave-2.0.0.b3.jar

snippet2

cat ~/openhab2-master2/git/openhab/bundles/binding/org.openhab.binding.zwave/pom.xml
...
		<version>1.9.0-SNAPSHOT</version>
...

img1


img2

Thanks

Sorry - I didn’t pick up on the fact that you were using the OH1 ZWave binding. It’s worth noting that you’re using the OH2 HABmin and the two are not compatible.

Yes - it’s for OH1.

Where can I find the source code for the openhab2 zwave binding?
I am currently using the zwave binding from
openhab2-master/git/openhabbundles/binding/org.openhab.binding.zwave/
(the installed binding for the user install (use case2), in
/opt/openhab2/runtime/karaf/system/org/openhab/binding/org.openhab.binding.zwave/2.0.0.b3
has only the JAR file)

That should be the OH2 version - it’s in the OH2 repo so it should link to the OH2 binding. The OH1 binding is in the OH1 repo…

Earlier you said you were using the zwave1 version - it’s quite confusing really what you’re up to…

I want to use the oh2 zwave binding but I couldn’t find it.

find /home/avner/openhab2-master2/git/openhab2-addons/ -iname "*zwave*"
avner@i7Machine:~$ 

It’s here -:

but it should be linked as a subproject into the OH2 repo.

1 Like