How to install a 2.X binding manually? (In this case KNX)

@nibblerrick Karel dot Goderis at me dot com

@kgoderis i did try to establish a IDE with your repo in it -but got stuck in tons of dependencies and resulting errors.
Is there a good howto for setup the IDE and everything around openhab2?

Because i do like openhab a lot. But 2.0 is not usable for me as long as knx integration is that fuzzy in terms of usage and documentation.

I can also support test and documentation - i only have 100 ga in use.

@JoeRu In fact there is : https://github.com/eclipse/smarthome/blob/master/docs/documentation/development/ide.md
and here http://docs.openhab.org/developers/development/ide.html

@kgoderis, please would you be so kind and send me the compiled 2.0 binding. The 1.9 which is in OH2 produces loops for switched devices. My mail add is martin dot knopf at gmail dot com
Thanks!

At the moment there isn’t one, the old one @kgoderis sent isn’t usable anymore and a new one you have to build yourself at the moment if you want it (I haven’t built one…) so let’s hope it won’t take to long till it will be integrated. The problem with the loops I have, too, and it disconnects but however with the setting “autoReconnectPeriod=10” it runs so far OK for me.
Maybe that helps at the moment until the new binding gets ready for testing.

HI,

I am recently also trying out OPENHAB2 but I am having difficulties getting KNX2.0 installed. Could someone send me the latest JAR file?

mail= bert.strouwen@pandora.be

Regards,

Bert

Thanks for this hint but this settings works only for a few moments in my case. Switching over openhab works now but when I press a usual knx sensor for this light, openhab loops again.

HI @kgoderis,

Could you send me the latest jar as well? I am having the same difficulties as described above. Tried importing the source into Eclipse and export as jar file, but does not show up in karaf console.

mail=bert.strouwen@pandora.be

Thx,

Bert

Hello @kgoderis,

could you please send me the jar file too?

mail=oh2.amai@wp45.de

Thx,
A. Mai

I’m using openHAB 2 with KNX Binding 1.9 and I’ve got loops on my KNX bus: see Loops on KNX bus

I was hoping that this is fixed when I use the current build of KNX Binding 2.0. So I tried to build the JAR that everybody here is talking about. Without success.

What I did:

  1. I installed Eclipse as detailed in “Setting up an IDE for openHAB
  • I checked “openHAB Development” and “openHAB 2 Addons”
  1. Then I checkout your repo from https://github.com/kgoderis/openhab2 into a separate folder
  2. Then I switched to your knx-refactor branch
  3. Then I copied your org.openhab.binding.knx folder besides all the other OH2 addons I got with the IDE setup (git/…/addons/binding)
  4. Then I imported org.openhab.binding.knx as an existing project into eclipse --> no errors
  5. Then I changed the two “version” flags in your pom.xml from 2.0.0-SNAPSHOT to 2.1.0-SNAPSHOT (otherwise parent won’t be found)
  6. Then I added org.openhab.binding.knx to the pom.xml of the parent binding directory
  7. Then I called “mvn install” from “openhab-distro”
  • The resulting KAR file in “openhab-distro/distributions/openhab-addons/target” only contains the 1.10 version of the knx binding - no idea why. I was hoping to find your 2.0/2.1 binding here somewhere
  1. Then I called “mvn package” from the org.openhab.binding.knx folder --> a jar got build

  2. I copied the JAR to /usr/share/openhab2/addons (owner and group openhab)

  3. I set “binding = knx” instead of “binding = knx1” in my addons.cfg

  4. I restarted openhab

  5. Then I got this log output:

    21:46:40.304 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
    21:46:41.024 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
    21:46:41.907 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
    21:46:42.264 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
    21:46:42.403 [ERROR] [org.openhab.binding.knx ] - FrameworkEvent ERROR - org.openhab.binding.knx
    org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.knx [190]
    Unresolved requirement: Import-Package: gnu.io
    at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]

Okay, enough trial and error!

@kgoderis:
Could you please tell me what I REALLY have to do to build your KNX Binding 2.0 ???
Or could you set up a small git repo etc. which always contains the latest JAR you built (would be helpful for anybody here) ?
If none of the two, could you please send me your latest jar to stephanschuster at web de

Thank you.

@stephanschuster The build is ok, you need to install openhab-transport-serial in karaf

@kgoderis: Thank you for your quick response.

I’m new to all this, so please be patient with me. I installed openhab-transport-serial via feature:install openhab-transport-serial. Worked. Then it complained about “Unresolved requirement: Import-Package org.openhab.core.items”. So I did feature:install openhab-runtime-compat1x. Right? At least it worked. No errors on startup. However, I cannot switch my light anymore via HABpanel. Seems like the KNX binding is not installed. I was expecting PaperUI to list it under Addons/Bindings. It does not.

And in karaf it should probably also be listed. Right? It is not.

openhab> feature:list | grep knx
openhab-binding-knx1                      | 1.9.0            |          | Uninstalled | addons-2.0.0            | KNX Binding

Maybe a problem with the JAR name or its 2.1.0 version instead of 2.0.0?

[23:42:17] pi@pi:~$ ll /usr/share/openhab2/addons
total 816K
drwxr-xr-x 2 openhab openhab 4.0K Feb  6 23:14 ./
drwxr-xr-x 5 root    root    4.0K Jan 27 21:02 ../
-rw-r--r-- 1 openhab openhab 803K Feb  6 23:14 org.openhab.binding.knx-2.1.0-SNAPSHOT.jar
-rw-r--r-- 1 openhab openhab   70 Jan 22 21:40 README

My addons.cfg:

package = minimal
remote = true
binding = knx
ui = basic,paper,habpanel

Sorry for bothering you.

Strange. What does

bundle:list -s | grep knx

yield? It could very well be that both the 1.9 and 2.0 bindings are installed in your runtime, but what you show above it not pointing into that direction. In that case, you should

bundle:uninstall <wrong-binding>

it. You are sure that the /usr/share/openhab2/addons is the folder that is defined the .cfg holding the pointer to the add-ons folder?

Does this look right for you?

openhab> bundle:list -s | grep knx
193 | Active | 80 | 2.1.0.201702062042 | KNX Binding | org.openhab.binding.knx
openhab> feature:list -s | grep knx
openhab-binding-knx1 | 1.9.0 | | Uninstalled | addons-2.0.0 | KNX Binding

If yes, is it intentional that 2.0 does not show up in PauperUI? And do I need another configuration for KNX Binding 2.0 compared to 1.9? Probably yes. As mentioned in Loops on KNX bus I currently only have this one knx.items file with

Switch WZ_Deckenleuchte {knx="1/0/20"}
Switch WZ_Downlights {knx="1/0/24"}

Nothing else. My log shows me:

19:30:52.822 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'WZ_Deckenleuchte' received command ON
19:30:52.827 [INFO ] [marthome.event.ItemStateChangedEvent] - WZ_Deckenleuchte changed from OFF to ON
19:30:53.794 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'WZ_Deckenleuchte' received command OFF
19:30:53.798 [INFO ] [marthome.event.ItemStateChangedEvent] - WZ_Deckenleuchte changed from ON to OFF

Compared to my logs in 1.9 (Loops on KNX bus) the calimero stuff is missing. That’s probably why nothing happens.

Can you quickly give me the most simple KNX Binding 2.0 config which accomplishes what I had for 1.9? The stuff in ReadMe looks rather complicated. I’ll go through it.

Thanks again for your help and your work on 2.0.

Hi everyone,
I have managed to install the following KNX2.0 Binding https://github.com/openhab/openhab2-addons/files/784970/org.openhab.binding.knx_2.0.0.201702181144.jar.zip
and got it to work so far, as it is showing telegrams on the bus.

22:45:37.509 [TRACE] [nx.handler.KNXBridgeBaseThingHandler] - Received a Group Write telegram from ‘1.1.12’ for destination ‘2/4/1’
22:45:37.509 [DEBUG] [tuwien.auto.calimero ] - calimero.link.224.0.23.12:3671: indication from 1.1.12
2

Next step: I wanted to use the knx.knxproj file of my ETS5 to get all the things and items automatically created.
I am using a Raspberry 3 with Openhabian. With standard-settings while importing the file after about 5 minutes I am getting this:

22:21:49.892 [ERROR] [org.apache.felix.fileinstall ] - In main loop, we have serious trouble
java.lang.OutOfMemoryError: Java heap space

Last lines in the log before the OOM were (leaving out the telegram-listening-lines):

[TRACE] [x.internal.parser.KNXProject13Parser] - Found KNX manufacturer data for a device by ‘GIRA Giersiepen’
[TRACE] [x.internal.parser.KNXProject13Parser] - Found KNX manufacturer data for a device by ‘ABB’
[INFO ] [x.internal.parser.KNXProject13Parser] - Found KNX project data for project ‘Fl29’

So I changed the runtime/bin/karaf to

if [ “x${JAVA_MAX_MEM}” = “x” ]; then
JAVA_MAX_MEM=768M
export JAVA_MAX_MEM
fi

unfortunatelly the problem is still there, it just takes a lot longer and top looks like this all the time (the 100.2 is %CPU):

915 openhab 20 0 440364 338708 13260 S 100.2 34.0 15:49.49 java
413 openhab 20 0 6452 2840 2472 S 0.0 0.3 0:00.05 karaf

and it dies like this:

[WARN ] [he.sshd.server.session.ServerSession] - Exception caught
java.lang.OutOfMemoryError: Java heap space

Anyone else having problems importing the ETS5-File? Mine has a size of about 15MB - the project contains about 40 physical adresses.

My normal payload without importing the knx-file after about 5mins is like this:

918 openhab 20 0 428540 153000 13424 S 0.7 15.4 0:59.07 java
411 openhab 20 0 6452 2848 2480 S 0.0 0.3 0:00.05 karaf

is a new knx 2.x version available?

Hello @kgoderis

I am a new use for openhab2
Develop a new binding problem
Can you talk to you?
mail=z12385200@gmail.com

Thx,
tony

Hallo @kgoderis,
could you make the knx2.x version to me also available?
THANKS!!

mail=michael@familie-martens.de

Thank you
Michael

Hi all,

I meanwhile tried my luck by using the above:
org.openhab.binding.knx_2.0.0.201702181144.jar

I read carefully:

but log is telling:
[org.openhab.binding.knx ] - FrameworkEvent ERROR - org.openhab.binding.knx

and
201 | Installed | 80 | 2.0.0.201702181144 | KNX Binding | org.openhab.binding.knx

I created the things file and knx.cfg to name the proj

ANY IDEA ??? …
ANY help would be appreciated.

Michael

Hey there,

sorry for warming this up again: After dropping the jar into the addons folder, /var/log/openhab2/events.log gives me a bunch of error messages, starting with

2018-02-11 07:29:10.134 [ERROR] [org.eclipse.osgi                    ] - FrameworkEvent ERROR - org.eclipse.osgi
java.lang.NullPointerException: null
	at org.apache.karaf.features.extension.BundleWires.<init>(BundleWires.java:50) [?:?]
	at org.apache.karaf.features.extension.StoredWiringResolver.update(StoredWiringResolver.java:105) [?:?]
	at org.apache.karaf.features.extension.Activator.bundleChanged(Activator.java:51) [?:?]
[...]

2018-02-11 07:29:10.275 [ERROR] [org.openhab.binding.knx             ] - [org.opnhab.binding.knx.folderobserver(235)] Error during instantiation of the implementation object

java.lang.NoClassDefFoundError: org/eclipse/smarthome/core/service/AbstractWatchQueueReader
	at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?]
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[?:?]
	at java.lang.Class.getConstructor0(Class.java:3075) ~[?:?]
	at java.lang.Class.newInstance(Class.java:412) ~[?:?]
[...]

2018-02-11 07:29:10.288 [WARN ] [org.openhab.binding.knx             ] - FrameworkEvent WARNING - org.openhab.binding.knx

org.osgi.framework.ServiceException: org.apache.felix.scr.impl.manager.SingleComponentManager.getService() returned a null service object
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:232) [?:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111) [?:?]
	at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45) [?:?]
[...]

The binding somewhat shows up and I can properly configure the bridge (KNX IP Router). All KNX devices are discovered and shown as Things. They however do not have any channels associated with them. From the above I would assume the automatic parsing of the ETS5 file does not work. But why and what can I do about it?

Thanks,
Klayman