New openHab2 EnOcean binding

Hi @fruggy83

I tried to install the openocean binding from the karaf console of my clean install of openhab 2.3.0 (raspbian-stretch) and got the same error message:

openhab> bundle:install org.openhab.binding.openocean
Bundle IDs:
Error executing command: Error installing bundles:
Unable to install bundle org.openhab.binding.openocean: org.osgi.framework.BundleException: Error reading bundle content.

Is there any misstake from my side? Thx in advance for your help.

Best regards
Christian

Hi Christian (@c214),

did you installed the serial feature before you tried to install the openocean bundle? My bundle has a dependency against gnu.io, therefore this feature has to be installed. I am currently not aware how to automatically install this feature during the installation of my bundle.

You can install this feature manually with the following command in the karaf console

feature:install openhab-transport-serial

Afterwards you should hopefully be able to install the openocean bundle.

Best regards
Daniel

Hi Daniel (@fruggy83),

unfortunately I installed the openhab-transport-serial feature before your bundle. The feature is listed as installed and started in the karaf feature list.

And other suggestions?

Kind regards

Christian

Hi @c214,

how did you install / copy the binding ? I think the read-write permissions of the file are not set properly.

If you are using filezilla you can change this via right-click on the file.

Best regards,
Alex

Hi

First of all thanks to Daniel to implement this binding.

I just started with OH and the fist actuator I try to control is the in wall module SIN-2-2-0x from nodon. I added a light to the in wall module channel 1 and a physical switch to the input 1 of the module. OH is running on a PI3.

I was able to add a USB310 as OpenOcean bridge and the in wall module as a D2-01 - Energy measurement switch. To control the in wall module I added the following items.

Switch Switch_Test1_A "Test1_A" <switch> (gSwitch) {channel="openocean:measurementSwitch:0c42edb0:0509D103:generalSwitchA"}
Switch Switch_Test1_B "Test1_B" <switch> (gSwitch) {channel="openocean:measurementSwitch:0c42edb0:0509D103:generalSwitchB"}
String Switch_Test1_Status "Test1 Status [%s]" (gSwitch) {channel="openocean:measurementSwitch:0c42edb0:0509D103:receivingState"}

I am able to control the light from OH. I am also able to toggle the light by pressing the physical switch connected to the in wall module. But there is no feedback to OH if a change the state by the physical switch.

So my questions how do I setup the bidirectional communication?

Best regards Raphael

Hi @Casshern,

I did the following steps according the readme:

Download precompiled binding into your openhab2-addons folder and adjust permissions

Open karaf shell (ssh -p 8101 openhab@localhost, std psw habopen)

  • install gnu.io (feature:install openhab-transport-serial)
  • install openocean (bundle:install org.openhab.binding.openocean)

I think permissions are set properly:
-rw-r–r-- 1 openhab openhab 197140 Jul 2 20:36 org.openhab.binding.openocean-2.4.0-SNAPSHOT.jar

In my karaf console I can see that openhab-transport-serial is started:

*      openhab-transport-serial                    | 2.3.0            | x        | Started     | distro-2.3.0            | Serial Transport*

In the logs I found the following error messages:

*20:37:55.932 [ERROR] [org.openhab.binding.openocean        ] - FrameworkEvent ERROR - org.openhab.binding.openocean* *      org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.openocean [222]* *Unresolved requirement: Import-Package: gnu.io*  *      at org.eclipse.osgi.container.Module.start(Module.java:444) [?:?]* *      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634) [?:?]* *      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613) [?:?]* *      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585) [?:?]* *      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528) [?:?]* *      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) [?:?]* *      at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]* *      at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]*  *      20:38:13.652 [WARN ] [org.apache.felix.fileinstall         ] - Error while starting bundle:*  *      org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.openocean [222]* *Unresolved requirement: Import-Package: gnu.io*  *      at org.eclipse.osgi.container.Module.start(Module.java:444) [?:?]* *      at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) [?:?]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [9:org.apache.felix.fileinstall:3.6.4]* *      20:38:23.669 [WARN ] [org.apache.felix.fileinstall         ] - Error while starting bundle:*  *      org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.openocean [222]* *Unresolved requirement: Import-Package: gnu.io*  *      at org.eclipse.osgi.container.Module.start(Module.java:444) [?:?]* *      at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) [?:?]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [9:org.apache.felix.fileinstall:3.6.4]* *      at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [9:org.apache.felix.fileinstall:3.6.4]*

Looks like gnu.io isn’t installed properly?

Thx for your help.

Best regards,
Christian

Hi Raphael (@raphael),

welcome to the openhab community. I am glad that this binding works for your (at least in most cases).

Openhab gets inform in two ways about the current state of your in wall module. First of all, your module should send a message when you toggle the light by pressing the physical switch. As I do not own such a module, I cannot confirm that this message is really send by your module. I will check this with my Nodon smart plug, it uses nearly the same EEP. Meanwhile you could look into you openhab log viewer when you press your switch (set log level of my binding to debug). If your module sends a message you should find it here.

Second I implemented a polling mechanism. You can set the polling interval in your thing. A value of zero deactivates the polling. After the polling interval the binding queries the current state of your module and upodates the item states. Could you check if you enabled the polling?

@Matt77
As you also own such a in wall module, can you confirm this behaviour?

Best regards
Daniel

Hi Christian (@c214),

thanks a lot for this information. Your setup seems to be correct. Maybe they updated the gnu.io lib in openhab and my binding tries to use a specific (older) version of this lib :thinking:? My last update of openhab is two weeks ago. I will check this.

Best regards
Daniel

Hi Daniel (@fruggy83)

Thanks for the feedback. I activated trace for the gateway as described here https://community.openhab.org/t/new-openhab2-enocean-binding/39917/12?u=raphael.

The logger entries of activate channel 1 of the in wall module by its physical switch is:

==> /var/log/openhab2/events.log <==

2018-07-03 18:34:28.257 [vent.ItemStateChangedEvent] - Switch_Test1_Status changed from Rssi 48, repeated 0 to Rssi 49, repeated 0

==> /var/log/openhab2/openhab.log <==

2018-07-03 18:34:33.239 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received Sync Byte

2018-07-03 18:34:33.342 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received header, data length 9 optional length 7 packet type 1

2018-07-03 18:34:33.691 [TRACE] [nal.transceiver.OpenOceanTransceiver] - publish event for: 0509D103

2018-07-03 18:34:33.697 [TRACE] [nal.transceiver.OpenOceanTransceiver] - D20460E40509D1030001FFFFFFFF3000

2018-07-03 18:34:33.707 [DEBUG] [an.handler.OpenOceanBaseThingHandler] - ESP Packet D20460E40509D10300 for 0509D103 received

==> /var/log/openhab2/events.log <==

2018-07-03 18:34:33.729 [vent.ItemStateChangedEvent] - Switch_Test1_Status changed from Rssi 49, repeated 0 to Rssi 48, repeated 0

==> /var/log/openhab2/openhab.log <==

2018-07-03 18:34:33.737 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received Sync Byte

2018-07-03 18:34:33.840 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received header, data length 7 optional length 7 packet type 1

2018-07-03 18:34:34.148 [TRACE] [nal.transceiver.OpenOceanTransceiver] - publish event for: 0509D103

2018-07-03 18:34:34.151 [TRACE] [nal.transceiver.OpenOceanTransceiver] - F6100509D1033001FFFFFFFF3100

2018-07-03 18:34:34.155 [DEBUG] [an.handler.OpenOceanBaseThingHandler] - ESP Packet F6100509D10330 for 0509D103 received

2018-07-03 18:34:34.169 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received Sync Byte

==> /var/log/openhab2/events.log <==

2018-07-03 18:34:34.171 [vent.ItemStateChangedEvent] - Switch_Test1_Status changed from Rssi 48, repeated 0 to Rssi 49, repeated 0

==> /var/log/openhab2/openhab.log <==

2018-07-03 18:34:34.272 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received header, data length 7 optional length 7 packet type 1

2018-07-03 18:34:34.580 [TRACE] [nal.transceiver.OpenOceanTransceiver] - publish event for: 0509D103

2018-07-03 18:34:34.585 [TRACE] [nal.transceiver.OpenOceanTransceiver] - F6000509D1032001FFFFFFFF3000

2018-07-03 18:34:34.590 [DEBUG] [an.handler.OpenOceanBaseThingHandler] - ESP Packet F6000509D10320 for 0509D103 received

And deactivating by OH:

2018-07-03 18:39:18.952 [ome.event.ItemCommandEvent] - Item 'Switch_Test1_A' received command OFF

2018-07-03 18:39:18.960 [vent.ItemStateChangedEvent] - Switch_Test1_A changed from ON to OFF

2018-07-03 18:39:18.965 [GroupItemStateChangedEvent] - gSwitch changed from ON to OFF through Switch_Test1_A

==> /var/log/openhab2/openhab.log <==

2018-07-03 18:39:18.968 [TRACE] [nal.transceiver.OpenOceanTransceiver] - sending request

2018-07-03 18:39:18.976 [DEBUG] [nal.transceiver.OpenOceanTransceiver] - 550009070156D2010000FF97A9810001FFFFFFFFFF00F1

2018-07-03 18:39:18.997 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received Sync Byte

2018-07-03 18:39:19.108 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received header, data length 1 optional length 0 packet type 2

2018-07-03 18:39:19.143 [TRACE] [nal.transceiver.OpenOceanTransceiver] - publish response

2018-07-03 18:39:19.148 [TRACE] [nal.transceiver.OpenOceanTransceiver] - request without listener

2018-07-03 18:39:19.164 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received Sync Byte

2018-07-03 18:39:19.267 [TRACE] [nal.transceiver.OpenOceanTransceiver] - Received header, data length 9 optional length 7 packet type 1

2018-07-03 18:39:19.616 [TRACE] [nal.transceiver.OpenOceanTransceiver] - publish event for: 0509D103

2018-07-03 18:39:19.618 [TRACE] [nal.transceiver.OpenOceanTransceiver] - D20460800509D1030001FFFFFFFF3000

2018-07-03 18:39:19.622 [DEBUG] [an.handler.OpenOceanBaseThingHandler] - ESP Packet D20460800509D10300 for 0509D103 received

For me it looks like, that some data will be received by the bridge.

Polling is also active and set to the default value of 300s.

Best regards Raphael

Hi Daniel (@fruggy83)

I created the in wall module things by auto detection. The detected EEP is:

NodON SIN-2-1-0x (EEP: D2_01_12)

The reference of the in wall module I use based on the user manual is different:

SIN-2-2-0x

and the EEP is identically

EEP: D2-01-12

If I open the drop down list in the Paper UI of the related thing, I’ve got the following possible EEP’s

grafik

Its seems that the reference and EEP are mixed for the nodon in wall modules.

Best regards

Raphael

Good morning Raphael (@raphael),

thanks a lot for this trace log. I could find the error and will fix the bug today. Another interesting fact from the log is that whenever you press your physical switch the in wall module emulates an enocean rocker switch press/release. Therefore you could link another wireless enocean actuators to you wired switch (for example switch on light and activate an smart plug). Very nice feature :+1:
These in wall modules getting more and more interesting for me.

Best regards
Daniel

Hi Raphael (@raphael),

thanks a lot for this hint, too. I will also fix this.

Best regards
Daniel

Hi Raphael (@raphael),

I fixed these two issues. Just clear your openhab cache and update the binding.

Best regards
Daneil

Hey Daniel,

any news about the problem with the installation failure? I got the same message like Christian with the same settings:

Error executing command: Error installing bundles:
Unable to install bundle org.openhab.binding.openocean: org.osgi.framework.BundleException: Error reading bundle content.

Thanks and best regards
Matze

Hi Daniel (@fruggy83)

Thanks a lot for your support.

Unfortunately I am not able to update the binding. I did the following steps:

  1. Cleared the cache
  2. Update the binding

Using karaf to install the binding failed with the following error message:

Error executing command: Error installing bundles:
Unable to install bundle org.openhab.binding.openocean: org.osgi.framework.BundleException: Error reading bundle content.

I had the same problem during the first installation. But some how I was able to find the binding in Paper UI and to install it. Unfortunately I am now not able to reinstall the binding.

Do you have any idea how to fix this issue?

Edit:
After posting I read the posts of Matze and Christian. It looks like that I am facing the same issue.

Best regards Raphael

Hi Raphael (@raphael), Matze (@Matzefication), Christian (@c214),

after an update of my openhab installation, I had the same issues. In my case the feature openhab-transport-serial always gets uninstalled after a clean-cache. This must have been changed since OH 2.3. However after installing this feature again, the binding starts as usual.

I hope this helps.

Best regards
Daniel

Hi Daniel (@fruggy83),

unfortunately that did not work for me. I re-installed openhab-transport-serial and it also seems to be started, unfortunately the installation still fails with the same error.

Any other ideas :slight_smile:

Thanks and regards
Matze

Hi @Matzefication,

try the following:

  1. reinstall openhab-transport-serial
  2. Restart Openhab: “sudo /etc/init.d/openhab2 stop” and then “sudo /etc/init.d/openhab2 start”

This was enough to get my openocean binding working again after upgrading openhab.

Best regards,
Alex

Hi Alex (@Casshern),

I uninstalled the feature openhab-transport-serial, then installed it again, restarted the openhab service but it ends up in the same error message when I try to install the openocean bundle:

openhab> bundle:install org.openhab.binding.openocean
Bundle IDs:
Error executing command: Error installing bundles:
Unable to install bundle org.openhab.binding.openocean: org.osgi.framework.BundleException: Error reading bundle content.

I have no idea what I’m doing wrong :frowning:

Thanks for your support.
Matze

Hi @Matzefication, @raphael, @c214,

so i just used my test-setup to see what your problem could be. I deleted the binding, updated my openhab to the newest 2.4 snapshot and copied the newest openocean binding into the addons-folder.
Then i stoped openhab, cleared tmp + cache and restarted the whole system.
After everything booted up again, i went into karaf and executed “feature:install openhab-transport-serial”. When i now try to install the binding, i get the same error-message, you guys did, BUT the importent part is, when you execute “bundle:list” you will probably also see, that the bundle is already installed ! Openhab installs the bindings, put into the addons-folder, automaticly. When you now go into Paper-Ui and click on the “+ - symbol”, you will propably the the openocean-binding listed and working.
I hope it works for you.

Best regards,
Alex