Hello everyone !
First - I’ve been using OpenHAB for 1 month now, and I am really a big fan. It is awesome, well documented… I have around 30 dimmable lights + 4 shutters connected with KNX installation (+ 10 switches). I have also added a home-made energy meter using MQTT, some Tasmota converted smart plugs…
Now, I want to connect my 3 air conditioning, but not willing to spend extra money in Daikin KNX gateways or any other, especially because my 3 controllers (Daikin BRC1H aka MADOKA) use Bluetooth Low Energy - and I have almost finished reversing all the communication protocol (git PUSH coming soon with full protocol documentation).
I have coded a standalone Java library that works for retrieving information and controlling the module, with only dependence for BLE on TinyB (which might be the tricky part to integrate it in OpenHAB - reducing the portability as it needs a native JNI lib…).
So - I have started to setup my environment and create my project, but despite starting the OpenHAB on my development platform and running it in Eclipse, I just want to generate a standalone KAR to integrate in my existing stable OpenHAB server (because it has the Bluetooth device, and I’m coding on Mac where TinyB is not working).
I am pretty stuck here so far ! Any help would be welcome.
Within my binding directory, mvn clean install is generating properly the JAR, but copy/paste the JAR in addons directory does not help loading it
2020-01-26 12:27:52.346 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-binding-madoka'
Thank you all again for your great work and further assistance
Without much more detail it will be hard to help. But a kar file is created with running maven with
karaf:kar. Regarding Bluetooth. The Bluetooth bindings are all build on a generic layer in openHAB, which separates from Bluetooth specific hardware. Did you look into that to use?
My general advice would be to take a look on Ruuvi or Blukii binding which shows how to support new device using existing bluetooth infrastructure (bluez/tinyb and bluegiga). It shifts from you necessity to manage tinyb dependencies and covers discovery api for both kind of bridges.
Anyhow, if you have failures during installation then look for debug output from
org.apache.karaf.feature). I suspect you know how to figure it out as you went over development of new binding.
Thanks for your answers. My immediate problem is that the bundle gets detected correctly:
openhab> bundle:list | grep Mado
265 │ Active │ 80 │ 18.104.22.168001261301 │ openHAB Add-ons :: Bundles :: Madoka Binding
But no binding:
openhab> feature:list | grep Mado
openhab> feature:list | grep mado
will try with the Karaf:kar Maven target.
Also, my OpenHAB is 2.5.1 and I compiled my binding with 2.5.2. Can it be a problem ?
Regarding the bluetooth, I’ll check your advise right now!
PS. be indulgent it is my first OpenHab development
ESH-INF files in your bundle. If you miss them then framework doesn’t know it actually ships new kind of devices and will never call your handlers even if you implemented them properly.
Feature itself is not mandatory, it is used to render addons/binding page, but thats all about it for development. Check if you can add new thing via inbox/my device is not listed and do not bother about packaging. It might wait till your code is confirmed working.
Just a quick question - on the BlueZ binding page, it is mentioned that only ARM is supported - https://www.openhab.org/addons/bindings/bluetooth.bluez/ - This extension supports Bluetooth access via BlueZ on Linux (ARMv6hf).
Is it a mistake - or it is only supported in OpenHABian ?
If the native TinyB libs are already compiled/installed on the target host (x86_64 for me), will it work ?
Ok just spent couple of hours trying to make working the BlueZ binding on my environment - hopeless so giving up with it. Seems the embedded TinyB is kinda outdated.
Jan 27 10:48:40 ubuntu-mini karaf: java.lang.UnsatisfiedLinkError: no tinyb in java.library.path
273 │ Active │ 80 │ 2.5.1 │ openHAB Add-ons :: Bundles :: BlueZ Bluetooth Adapter
I’ve been going over it too, the arm point is not quite up to date if you are on 2.5.0. It was true with 2.4.0. There are however things which are related to native library loading which do not work in stable way. I narrowed it to this https://github.com/openhab/openhab-osgiify/issues/13, and it seems to be fixed in https://github.com/openhab/openhab-addons/pull/6369/files#diff-3a290fefeb132dfd88d804b371d2ac16R13.
I have a gateway on x86_64 and I made it working few months back (before 2.5 release and above patch) myself. I will do one more lap on it to verify how it goes.
I managed to “fix” the BlueZ binding (had to change the OSGI package header as you suggested…)… would be nice if fixed in official build.
Now I figured out that the BlueZ binding is not working as it should. For example, it keeps “discovering” and introspecting every devices all the time, blocking connected operations.
discovery is totally ignored and this is confirmed, looking at the code…
The binding really looks buggy, I am not sure I will continue with it. I already spent hours just trying to make it working… It is very sad.
AFAIR you need to disable discovery at bluez adapter. Go to BlueZ bridge, edit settings and unmark discovery parameter.
You might be in luck. Fixes are currently in the works for the bluetooth bindings; fixes for the bluez binding have already been merged into the openhab’s 2.5.x branch. If pull the latest version of the code, you should be able to build a snapshot of the bluetooth and bluez bindings with the fixes.
Interesting! I was considering alternative options to this BT binding so I will double check then.
Guys - help needed.
As I’m not satisfied with existing bluetooth bindings, I am trying to implement a new Bluetooth bridge using DBUS and BlueZ, which uses full native java without JNI bindings (I’ve tested it successfully out of the OpenHAB).
I am facing a very stupid error: I can create a new binding using the
./create_openhab_binding_skeleton.sh script, but this one does not allow me to create the binding
I have tried to use manually the mvn archetype generate manually such as:
mvn -s archetype-settings.xml archetype:generate -N
Although it generates, it never compiles, and always getting the same error during the KARAF Verify:
[INFO] --- karaf-maven-plugin:4.2.7:verify (karaf-feature-verification) @ bluetooth.dbusbluez ---
[INFO] Using repositories: https://openhab.jfrog.io/openhab/libs-release@id=openhab-release,https://openhab.jfrog.io/openhab/libs-snapshot@id=openhab-snapshot@noreleases@snapshots,https://repo.maven.apache.org/maven2@id=central
[WARNING] Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:2.5.2-SNAPSHOT: [Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:2.5.2-SNAPSHOT in openhab-snapshot (https://openhab.jfrog.io/openhab/libs-snapshot/)]
java.io.IOException: Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:2.5.2-SNAPSHOT: [Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:2.5.2-SNAPSHOT in openhab-snapshot (https://openhab.jfrog.io/openhab/libs-snapshot/)]
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.configureIOException (AetherBasedResolver.java:803)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve (AetherBasedResolver.java:774)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve (AetherBasedResolver.java:657)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve (AetherBasedResolver.java:598)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve (AetherBasedResolver.java:565)
I admit I could just accept the “org.openhab.binding.dbusbluez” but I’d really like to get it clean, like 2 other existing bindings.
I have tried everything - without luck. Anybody can help ?
Your error message suggest somewhere it refers to the snapshot version when referring to openHAB core libraries.
Very strange, it only happens when I use the org.openhab.binding.BLUETOOTH.dbusbluez, not the org.openhab.binding.dbusbluez
Did you also run the patch commands from the skeleton script when you created the Binding by running maven directly?
I feel so idiot now - It works. Can’t believe I spent hours on this… Thanks… Continuing work now…