Closed wmarkow closed 6 years ago
I have set up my development environment as described in openHAB IDE Setup. I was able to compile openhab/openhab2-addons. With a help of e303975 commit by @freynder I was able to compile mysensor openHAB binding against openHAB-2.4.0-SNAPSHOT distribution.
I just wanted to do some debug of MySensors binding in openHAB instance started directly from Eclipse. When I started openHAB then MySensors Binding was not visible in openHAB. I have found solved-how-to-add-binding-source-to-working-project-in-eclipse post. I have selected the org.openhab.binding.mysensors Plug-ins tab of openHAB_Runtime.launch launcher configuration:
When you start openHAB application you will see Eclipse validation error message about some missing dependency. You can continue but you will notice some error during openHAB startup and MySensors Binding will not be loaded:
2018-06-17 10:35:38.719 [DEBUG] [.c.c.registry.AbstractRegistry:312 ] - Provider 'org.eclipse.smarthome.automation.ManagedRuleProvider' has been added.
!ENTRY org.openhab.binding.mysensors 4 0 2018-06-17 10:35:38.734
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [106]
Unresolved requirement: Import-Package: org.eclipse.jdt.annotation; resolution:="optional"
Unresolved requirement: Import-Package: org.eclipse.smarthome.io.transport.mqtt
at org.eclipse.osgi.container.Module.start(Module.java:444)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1628)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1608)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1579)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1522)
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)
Mostly it says that org.eclipse.smarthome.io.transport.mqtt dependency can not be resolved. To get rid of this error I needed to go back again to the Run Configurations Plug-ins tab and select two more dependencies for MQTT (just type mqtt as a filter in the edit text box):
After this openHAB starts and MySensors Binding is visible in the binding liste in Paper UI. Now I was able to add a MySensors Serial Gateway and even make some debugging.
Question is if those two dependencies to MQTT can be loaded automatically by setting up some configuration scripts of MySensors Binding.
Similar issue with MySensors + openHAB + MQTT:
Hello,
I guess you are thinking about the Feature concept in OSGI which can automatically install dependencies: https://dzone.com/articles/apache-karaf-features-for-osgi-deployment
The addons repository already provides these for other addons: https://github.com/openhab/openhab2-addons/blob/master/features/openhab-addons/src/main/feature/feature.xml .
If you're setting up the development environment there is no way to automatically resolve these dependencies. What you've described is the way to go.
Because the binding is not yet part of the official distribution the dependencies aren't resolved automatically within OpenHAB. So you need to execute the commands described in the Wiki to set up an running environment. If OpenHAB is part of the official distribution the dependencies will be resolved automatically.
@wmarkow Thank you very much for your offer. I will look at the PR to official distribution and to talk to you about the things to do. 😄
I started to play around with MySensors and OpenHAB. It would be nice if MySensors binding was finally merged into openhab upstream. I have already read the whole discussion in openhab/openhab2-addons/pull/2066.
@tobof, I can offer my help in this issue but first I need to organize my development environment. I tried to build MySensors binding with Maven but I have failed. Probably I was doing something wrong but I will manage this :) It may be also related to #111 PR.
We will be in touch.