3rd Party Bluetooth Binding. Beta testers needed

bluetooth
binding
Tags: #<Tag:0x00007f015a041750> #<Tag:0x00007f015a0415c0>

(Stefan) #624

Hello @hmerk, @diyha. I changed to Zulu embedded 8:

openjdk version “1.8.0_152”
OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)

I removed this bluetoothbinding + TinyB libraries, installed it again but the same error;

2018-09-02 10:40:35.933 [WARN ] [th.manager.impl.BluetoothManagerImpl] - Disposing Bluetooth manager: 798879
2018-09-02 10:40:35.986 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Loading native libraries from the bundle. Environment: linux : arm
2018-09-02 10:40:35.988 [DEBUG] [anager.transport.tinyb.NativesLoader] - OS name: linux; OS arch: arm
2018-09-02 10:40:35.991 [DEBUG] [anager.transport.tinyb.NativesLoader] - isLinux: true; isARM6: true; isX86_64: false; isX86_32: false
2018-09-02 10:40:35.993 [DEBUG] [manager.transport.tinyb.TinyBFactory] - The environment is supported.
2018-09-02 10:40:35.995 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Preparing libtinyb.so native library
2018-09-02 10:40:35.997 [DEBUG] [anager.transport.tinyb.NativesLoader] - Preparing libtinyb.so native library
2018-09-02 10:40:35.999 [DEBUG] [anager.transport.tinyb.NativesLoader] - Library path: /native/arm/armv6/libtinyb.so
2018-09-02 10:40:36.002 [DEBUG] [anager.transport.tinyb.NativesLoader] - Creating a temporary file: /var/lib/openhab2/tmp/tinyb1140987271407000815libs/libtinyb.so
2018-09-02 10:40:36.005 [DEBUG] [anager.transport.tinyb.NativesLoader] - Temporary file has been created. Copying the library to that file.
2018-09-02 10:40:36.025 [DEBUG] [anager.transport.tinyb.NativesLoader] - The library has been prepared to be loaded: /var/lib/openhab2/tmp/tinyb1140987271407000815libs/libtinyb.so
2018-09-02 10:40:36.027 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Loading libtinyb.so native library: /var/lib/openhab2/tmp/tinyb1140987271407000815libs/libtinyb.so
2018-09-02 10:40:36.033 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Could not load bundled TinyB native libraries.
java.lang.UnsatisfiedLinkError: /var/lib/openhab2/tmp/tinyb1140987271407000815libs/libtinyb.so: libglib-2.0.so.0: cannot open shared object file: No such file or directory
2018-09-02 10:40:36.042 [INFO ] [manager.transport.tinyb.TinyBFactory] - TinyB: environment is not supported out of the box. Attempting to load system libs.
2018-09-02 10:40:36.044 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Loading native library from class path: tinyb
2018-09-02 10:40:36.048 [DEBUG] [manager.transport.tinyb.TinyBFactory] - TinyB: Could not load system libraries. Thus, environemnt is not supported. Only Linux OS; x86, x86_64 and arm6 architectures are supported out of the box. Consider providing own tinyb. in one of :/var/lib/openhab2/lib:/usr/share/openhab2/runtime/lib:/usr/java/packages/lib/aarch32:/lib:/usr/lib

Update: Issue resolved by installing libglib2.0-0:armhf:

2018-09-02 10:47:26.716 [WARN ] [th.manager.impl.BluetoothManagerImpl] - Disposing Bluetooth manager: 1c286e3
2018-09-02 10:47:26.792 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Loading native libraries from the bundle. Environment: linux : arm
2018-09-02 10:47:26.794 [DEBUG] [anager.transport.tinyb.NativesLoader] - OS name: linux; OS arch: arm
2018-09-02 10:47:26.797 [DEBUG] [anager.transport.tinyb.NativesLoader] - isLinux: true; isARM6: true; isX86_64: false; isX86_32: false
2018-09-02 10:47:26.800 [DEBUG] [manager.transport.tinyb.TinyBFactory] - The environment is supported.
2018-09-02 10:47:26.802 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Preparing libtinyb.so native library
2018-09-02 10:47:26.805 [DEBUG] [anager.transport.tinyb.NativesLoader] - Preparing libtinyb.so native library
2018-09-02 10:47:26.807 [DEBUG] [anager.transport.tinyb.NativesLoader] - Library path: /native/arm/armv6/libtinyb.so
2018-09-02 10:47:26.811 [DEBUG] [anager.transport.tinyb.NativesLoader] - Creating a temporary file: /var/lib/openhab2/tmp/tinyb1496159064945801838libs/libtinyb.so
2018-09-02 10:47:26.813 [DEBUG] [anager.transport.tinyb.NativesLoader] - Temporary file has been created. Copying the library to that file.
2018-09-02 10:47:26.836 [DEBUG] [anager.transport.tinyb.NativesLoader] - The library has been prepared to be loaded: /var/lib/openhab2/tmp/tinyb1496159064945801838libs/libtinyb.so
2018-09-02 10:47:26.839 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Loading libtinyb.so native library: /var/lib/openhab2/tmp/tinyb1496159064945801838libs/libtinyb.so
2018-09-02 10:47:26.881 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Preparing libjavatinyb.so native library
2018-09-02 10:47:26.883 [DEBUG] [anager.transport.tinyb.NativesLoader] - Preparing libjavatinyb.so native library
2018-09-02 10:47:26.886 [DEBUG] [anager.transport.tinyb.NativesLoader] - Library path: /native/arm/armv6/libjavatinyb.so
2018-09-02 10:47:26.889 [DEBUG] [anager.transport.tinyb.NativesLoader] - Creating a temporary file: /var/lib/openhab2/tmp/tinyb7205049595900343527libs/libjavatinyb.so
2018-09-02 10:47:26.891 [DEBUG] [anager.transport.tinyb.NativesLoader] - Temporary file has been created. Copying the library to that file.
2018-09-02 10:47:26.902 [DEBUG] [anager.transport.tinyb.NativesLoader] - The library has been prepared to be loaded: /var/lib/openhab2/tmp/tinyb7205049595900343527libs/libjavatinyb.so
2018-09-02 10:47:26.905 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Loading libjavatinyb.so native library: /var/lib/openhab2/tmp/tinyb7205049595900343527libs/libjavatinyb.so
2018-09-02 10:47:26.909 [DEBUG] [manager.transport.tinyb.TinyBFactory] - Native libraries has been successfully loaded from the bundle.
2018-09-02 10:47:37.101 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'bluetooth:adapter:001A7DDA7113' to inbox.

(DIY HA) #625

I wonder if we should document this step, if its occurring on multiple setups.


(Stefan) #626

BT was only working when I had bluetoothctl running in a different terminal. As soon as I exited it, BT stopped working.

It turns out that the Odroid C2 runs a too old kernel. Same issue as here. A newer kernel only exists for Ubuntu 18.04 and isn’t compatible with 16.04. There is no upgrade path from Odroid’s Ubuntu 16.04 to 18.04. So I took the opportunity to reinstall OH on a Pi 3b+ using openHABian.


(Lemmy) #627

Hi @michael1186,

Sorry for the delay… I was out for a vacation.
Yes I think this is more of a RPi issue than an issue with @vkolotov 's binding.

I’m using the on-board Wifi and BLE functionalities and as I wrote as soon as I use the binding to scan for BLE devices my complete wireless infrastructure (2.4GHz) breaks down. I wasn’t sure if this also could be related to the scan frequency or some other settings of the binding so I thought I ask the community if anyone has seen the same behaviour.

I guess I should test combination of an USB-Ethernet adapter + RPi ZeroW + on-board Bluetooth chip. So far I could not find a good USB-Ethernet adapter which can be selfpowered by the ZeroW.


(Crispin) #628

Hi,

Could someone help with the gatt files? The binding is picking up the Soma Blinds but does not seem to be using the gatt files and showing the rest of the characteristics

I’ve got it in a folder which has access by openhab user. Folder is alongside the items and things folders.

org.bluetooth.characteristic.blind_position.xml

<?xml version="1.0" encoding="utf-8"?><!--Copyright 2011 Bluetooth SIG, Inc. All rights reserved.-->
<Characteristic xsi:noNamespaceSchemaLocation="http://schemas.bluetooth.org/Documents/characteristic.xsd"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Blind Position"
                type="org.bluetooth.characteristic.blind_position" uuid="1525" last-modified="2011-12-05"
                approved="No">
    <InformativeText>
        <Abstract>
			Position of blinds
        </Abstract>
    </InformativeText>
    <Value>
        <Field name="Position">
            <Requirement>Mandatory</Requirement>
            <Format>uint8</Format>
            <Unit>org.bluetooth.unit.percentage</Unit>
            <Minimum>0</Minimum>
            <Maximum>100</Maximum>
            <Enumerations>
                <Reserved start="101" end="255"/>
            </Enumerations>
        </Field>
    </Value>
</Characteristic>

org.bluetooth.service.blind_position.xml

<Service xsi:noNamespaceSchemaLocation="http://schemas.bluetooth.org/Documents/service.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Soma Blinds"
         type="org.bluetooth.service.blind_position" uuid="1861" last-modified="2018-09-06">
<InformativeText>
    <Abstract>
        Soma Blinds control
    </Abstract>
    <Summary>
        Controller for Soma Blinds
    </Summary>
</InformativeText>
<Dependencies>
    <Dependency>This service has no dependencies on other GATT-based services.</Dependency>
</Dependencies>
<GATTRequirements>
    <Requirement subProcedure="Write Characteristic Value">Mandatory</Requirement>
    <Requirement subProcedure="Notification">Mandatory</Requirement>
    <Requirement subProcedure="Read Characteristic Descriptors">Mandatory</Requirement>
    <Requirement subProcedure="Write Characteristic Descriptors">Mandatory</Requirement>
</GATTRequirements>
<Transports>
    <Classic>false</Classic>
    <LowEnergy>true</LowEnergy>
</Transports>
<ErrorCodes>
</ErrorCodes>
<Characteristics>
    <Characteristic name="Blind Position"
                    type="org.bluetooth.characteristic.blind_position">
        <InformativeText>Blind control
        </InformativeText>
        <Requirement>Mandatory</Requirement>
        <Properties>
            <Read>Excluded</Read>
            <Write>Excluded</Write>
            <WriteWithoutResponse>Excluded</WriteWithoutResponse>
            <SignedWrite>Excluded</SignedWrite>
            <ReliableWrite>Excluded</ReliableWrite>
            <Notify>Excluded</Notify>
            <Indicate>Mandatory</Indicate>
            <WritableAuxiliaries>Excluded</WritableAuxiliaries>
            <Broadcast>Excluded</Broadcast>
        </Properties>
    </Characteristic>
</Characteristics>
</Service>

The blinds have 4 characteristics - I’ve just tried to get the one working thus far.
from a python file I currently use control.py -

# battery
BATTERY_SERVICE_UUID 					= "0000180f-0000-1000-8000-00805f9b34fb".lower()
BATTERY_CHARACTERISTIC_UUID 			= "00002a19-0000-1000-8000-00805f9b34fb".lower()

# motor control
MOTOR_SERVICE_UUID 						= "00001861-B87F-490C-92CB-11BA5EA5167C".lower()
MOTOR_STATE_CHARACTERISTIC_UUID 		= "00001525-B87F-490C-92CB-11BA5EA5167C".lower()
MOTOR_CONTROL_CHARACTERISTIC_UUID 		= "00001530-B87F-490C-92CB-11BA5EA5167C".lower()
MOTOR_TARGET_CHARACTERISTIC_UUID 		= "00001526-B87F-490C-92CB-11BA5EA5167C".lower()
MOTOR_MOVE_UP = 69
MOTOR_MOVE_DOWN = 96

Original -

I’m hoping to get this working and then put it back into the main project :smiley:


Soma Blinds - Native support with Bluetooth Binding
(Vlad Kolotov) #629

Hi @Crispin, very good. Could you please create a ticket on github under Gatt parser project? I’ll be helping you with that.


(Crispin) #630

Thanks! All done


(Crispin) #631

This will be a cool feature. is there any overlap / synergy you have with Find3?
I had that working with APs and it worked quite well but it needed a client to report position rather than statics working it out.


(Fredrik Andersson) #632

@michael1186 @Lemmy

Hi there. I also HAD this problem, I found a fix for it (cant find it now unfortunally). It’s a problem with the firmware of the wifi/bt chip. Make sure you have the latest update and kernel on your raspbian. (The issue might be solved officially)

EDIT: Found the thread.
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=203508 <-- Solution here.
https://github.com/raspberrypi/linux/issues/1342 <-- Discussion here.


(Michael Cumming) #634

I installed Bluez 5.50 and see:

[10:16:44] openhabian@openHABianPi:~$ sudo systemctl status bluetooth
[sudo] password for openhabian:
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-09-11 09:32:06 CDT; 44min ago
     Docs: man:bluetoothd(8)
 Main PID: 7787 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           └─7787 /usr/local/libexec/bluetooth/bluetoothd --experimental

Sep 11 09:32:06 openHABianPi systemd[1]: Stopped Bluetooth service.
Sep 11 09:32:06 openHABianPi systemd[1]: Starting Bluetooth service...
Sep 11 09:32:06 openHABianPi bluetoothd[7787]: Bluetooth daemon 5.50
Sep 11 09:32:06 openHABianPi systemd[1]: Started Bluetooth service.
Sep 11 09:32:06 openHABianPi bluetoothd[7787]: Starting SDP server
Sep 11 09:32:06 openHABianPi bluetoothd[7787]: Bluetooth management interface 1.14 initialized

In the log I am seeing:

2018-09-11 10:17:46.554 [WARN ] [ace.internal.BindingExtensionHandler] - Installed bundle, but failed to start it: Could not resolve module: org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.bluegiga [269]

  Unresolved requirement: Import-Package: org.sputnikdev.bluetooth

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

2018-09-11 10:17:46.560 [thome.event.ExtensionEvent] - Extension 'market:binding-3769228' has been installed.


2018-09-11 10:18:02.259 [thome.event.ExtensionEvent] - Extension 'market:binding-3694484' has been installed.

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

2018-09-11 10:18:02.411 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler AdapterHandler of thing bluetooth:adapter:d561f45b tried checking if channel discovering is linked although the handler was already disposed.

2018-09-11 10:18:02.414 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler AdapterHandler of thing bluetooth:adapter:d561f45b tried checking if channel discovering-control is linked although the handler was already disposed.

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

2018-09-11 10:18:02.446 [hingStatusInfoChangedEvent] - 'bluetooth:adapter:d561f45b' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING

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

2018-09-11 10:18:02.481 [WARN ] [.core.thing.binding.BaseThingHandler] - BaseThingHandler.initialize() will be removed soon, ThingStatus can be set manually via updateStatus(ThingStatus.ONLINE)

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

2018-09-11 10:18:02.487 [hingStatusInfoChangedEvent] - 'bluetooth:adapter:d561f45b' changed from INITIALIZING to ONLINE

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

2018-09-11 10:18:02.508 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler AdapterHandler of thing bluetooth:adapter:395a54bd tried checking if channel discovering is linked although the handler was already disposed.

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

2018-09-11 10:18:02.509 [hingStatusInfoChangedEvent] - 'bluetooth:adapter:d561f45b' changed from ONLINE to OFFLINE

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

2018-09-11 10:18:02.511 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler AdapterHandler of thing bluetooth:adapter:395a54bd tried checking if channel discovering-control is linked although the handler was already disposed.

2018-09-11 10:18:02.526 [WARN ] [.core.thing.binding.BaseThingHandler] - BaseThingHandler.initialize() will be removed soon, ThingStatus can be set manually via updateStatus(ThingStatus.ONLINE)

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

2018-09-11 10:18:02.528 [hingStatusInfoChangedEvent] - 'bluetooth:adapter:395a54bd' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING

2018-09-11 10:18:02.535 [hingStatusInfoChangedEvent] - 'bluetooth:adapter:395a54bd' changed from INITIALIZING to ONLINE

2018-09-11 10:18:02.601 [hingStatusInfoChangedEvent] - 'bluetooth:adapter:395a54bd' changed from ONLINE to OFFLINE

(Vlad Kolotov) #635

Hi @mjcumming, thanks for that, but what did you want to say by that?


(Michael Cumming) #636

Sorry, meant to have more details included …

Running on a PI3B. The binding will not connect to the Raspberry bluetooth adapter. Wondering what to try?

Mike


(Vlad Kolotov) #637

Hi @mjcumming, looks like not all dependencies are installed, did you follow this installation guide?


(Gad Ofir) #638

Hi can anyone tell in short what are the steps ?
or give me some links?

what to buy?
what dongle
what is the recommned Keyring?

this post is longgg!


(Philip Knowles) #639

Yes because it’s complicated.
Before anyone can make any helpful suggestions then we need to know what kit and OS you’re running it on.


(Gad Ofir) #640

OH 2.3
windows run of OH
and what is the kit?

i have apple watch if it helps…


(Philip Knowles) #641

A lot of people are running OH on Linux and using things like Raspberry Pi and Synology which affects the choice of adaptor.

I’m running on W10 and use a Silabs Bluegiga BLED112 which works.

I use anut micro as the presence detection


(Michael Cumming) #642

Was using Bluez 5.50 - down graded and that worked!.


(Gad Ofir) #643

i see in ali 15$, and on bluegiga site allot more
is it ok to buy the fake one?

and what is aunt micro i cannot find it anywhere…
please some link

and thanks!


(Vlad Kolotov) #644

I have a couple of bluegiga from ali, they work fine.

It is not “aunt” it is NUT bluetooth key finder. I have also some of them, they work ok.