3rd Party Bluetooth Binding. Beta testers needed

@Master79, just try it.

It is not necessary to do indoor positioning yourself. The binding supports it. Just set location of each adapter, then add the “Location” channel for your devices. The binding will do all calculation for you and change the “Location” channel when your device moves from one room to another. I’ve put so much of my effort to make it working, it seems to me it is not very obvious that the binding supports it.

It thought it is obvious… Ok, I’ll try to improve documentation.

Just so you know, there are some other settings for indoor positioning that can be used to improve accuracy:

  1. “Signal propagation exponent” for adapters (read description how to use that)
  2. “Received signal strength indication (RSSI) filter” and “Measured transmit power (Tx Power)”

Just because this is wireless technology, all adapters and devices have different radio characteristics:

  1. Some adapters report stronger RSSI signal than others
  2. Some devices transmit weaker signal than others.
  3. Some walls in your house has weaker/stronger radio signal penetration characteristics etc

You don’t have to play with these settings. You may use them if the indoor positioning is not accurate enough. The default values should work fine.

I’ve tried to implement some algorithms/settings that could mitigate differences between radio characteristics. Please try that and let me know how it goes.

Sorry Vlad,
but i don’t understand what i have to do with the Tx Power.
The channel shows 0dBm. So i have to set it to -60?
And the location channel is no option because the adapters are on other slave servers and send the value of RSSI over mqtt.
Greetings and sorry for my unkown.

No worries. It is my fault not to make the documentation up to standard.

For the initial set up, you probably should not touch the settings I mentioned above. Just set locations for your adapters in OH and add “Location” channel for your devices.

I suggest you to play with the calibration parameters once everything is working but you are not satisfied with accuracy.

Not sure I understand this:

And the location channel is no option because the adapters are on other slave servers and send the value of RSSI over mqtt.

Have you added adapters in the binding? If so, go to their settings and set location parameter accordingly to where they located. As per this:

I have one adapter on my master openhab server per usb. The second adapter is on another slave server with openhab per USB. Can’t find both adapters on the same server. So i send the values from the slave to the master server and compares it. If master adapter is online and RSSI under -76 and slave adapter is online i am in the living room. :slight_smile:

I see now… You are using mqtt. In that case you won’t be able to use the binding indoor positioning system. How about adding your remote adapters via serial over IP? @Dibbler42 created a nice manual for that: Forwarding of serial and USB ports over the network to openHAB

Yes, this would be an option. I will test it. Thank you very much for your help.
Greetings, Markus.

openhab.log

2018-07-17 22:22:23.393 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'bluetooth:adapter:001A7DDA7111' to inbox.
2018-07-17 22:23:59.700 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler AdapterHandler of thing bluetooth:adapter:001A7DDA7111 tried checking if channel discovering is linked although the handler was already disposed.
2018-07-17 22:23:59.710 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler AdapterHandler of thing bluetooth:adapter:001A7DDA7111 tried checking if channel discovering-control is linked although the handler was already disposed.
2018-07-17 22:24:00.160 [WARN ] [.core.thing.binding.BaseThingHandler] - BaseThingHandler.initialize() will be removed soon, ThingStatus can be set manually via updateStatus(ThingStatus.ONLINE)
2018-07-17 22:24:10.217 [WARN ] [impl.AbstractBluetoothObjectGovernor] - Error occurred while updating governor: /00:1A:7D:DA:71:11 / 1fb3b98 : GDBus.Error:org.bluez.Error.NotSupported: Operation is not supported
2018-07-17 22:24:20.475 [WARN ] [impl.AbstractBluetoothObjectGovernor] - Error occurred while updating governor: /00:1A:7D:DA:71:11 / 35bf4a : GDBus.Error:org.bluez.Error.NotSupported: Operation is not supported
2018-07-17 22:24:30.589 [WARN ] [impl.AbstractBluetoothObjectGovernor] - Error occurred while updating governor: /00:1A:7D:DA:71:11 / 35bf4a : GDBus.Error:org.bluez.Error.NotSupported: Operation is not supported
2018-07-17 22:24:40.607 [WARN ] [impl.AbstractBluetoothObjectGovernor] - Error occurred while updating governor: /00:1A:7D:DA:71:11 / 35bf4a : GDBus.Error:org.bluez.Error.NotSupported: Operation is not supported

lsusb
Bus 008 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

systemctl status bluetooth

● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-07-17 22:20:29 CEST; 37min ago
 Docs: man:bluetoothd(8)
 Main PID: 25740 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
       └─25740 /usr/libexec/bluetooth/bluetoothd

Jul 17 22:20:29 orangepizero systemd[1]: Starting Bluetooth service...
Jul 17 22:20:29 orangepizero bluetoothd[25740]: Bluetooth daemon 5.47
Jul 17 22:20:29 orangepizero bluetoothd[25740]: Starting SDP server
Jul 17 22:20:29 orangepizero systemd[1]: Started Bluetooth service.
Jul 17 22:20:29 orangepizero bluetoothd[25740]: Bluetooth management interface 1.0 initialized

Adapter itself works correctly - finds the device and I can read the data from the xiaomi bluetooth termomter with this command:

gatttool -b XX:XX:XX:XX:XX:XX --char-write-req --handle=0x0010 --value=0100 --listen
Characteristic value was written successfully
Notification handle = 0x000e value: 54 3d 32 35 2e 37 20 48 3d 36 35 2e 37 00
Notification handle = 0x000e value: 54 3d 32 35 2e 38 20 48 3d 36 35 2e 36 00
Notification handle = 0x000e value: 54 3d 32 35 2e 37 20 48 3d 36 35 2e 37 00
Notification handle = 0x000e value: 54 3d 32 35 2e 38 20 48 3d 36 35 2e 36 00

Does anyone else have such a problem? how to fix it?

Thanks for reporting this @JohnD, I’ve responded on your ticket

*Bump* Anyone know the answer to this? I would really like to have my things defined in a .thing file as I do for the things related to other bindings.

Thanks

Hi … First thank you for this binding and all the great effort !

I just want to share with you that I bought the LM1010 bluetooth usb adapter (with external antennas) for improving range. I put them in different rooms, connecting with usbip …

These adapters turned out to stop reporting after the first report.
I found that I needed to set kernel parameter : enable_autosuspend = “N” for these adapters to keep reporting. see :
https://bbs.archlinux.org/viewtopic.php?pid=1781522#p1781522

I spent quite some time tracking this down, so I tougth I’d share it here.

Br
Torstein

1 Like

Could you describe your setup, especialy what did you put into the different rooms and on whick system is your openhab running

Hi

The USBIP setup is discussed here earlier … By you ?! :smile: Forwarding of serial and USB ports over the network to openHAB](http://)
I did use your information together with this one to make it persist :
https://unix.stackexchange.com/questions/406847/use-usbip-for-devices-that-are-being-removed-and-reconnected

I have the bluetooth-adapters in : Desktop (HTCP), a RaspberryPi 2, RaspberryPi 3, and a headless Server located troughout the appertment … (all my devices run ArchLinux)

Openhab (one of the latest snapshots) is currently running in the HTPC (ArchLinux gnome desktop), Bluez + Bluez-utils 5.47

Br
-Torstein

Awesome news @Baltazar72, I’ll add this to the troubleshooting section

These adapters turned out to stop reporting after the first report.
I found that I needed to set kernel parameter : enable_autosuspend = “N” for these adapters to keep reporting. see :
https://bbs.archlinux.org/viewtopic.php?pid=1781522#p1781522

How’s that usb adapter working? Better reception?

Hey @Baltazar72,

just wondering if you are using the “indoor positioning” feature of the binding? I have not heard from anyone if it is used so far… If so, could you please let me know how it goes? Cheers

Hi @mcqwerty, would you be able to create an issue on github and attach some details/files?

I have not tried defining adapters in files, so not sure if it is working. However I do not see any issues with that. Let’s create a ticket on github so I won’t forget to check it. Cheers

wrong post …

Hi, no I have only used for Miflora so far … Not used positioning …

Br
Torstein

Reception is definetly better.
I’ll se if I can make an more “scientific” measurement, but for me it was a “needed” improvement on range, I can se devicec popping in on adapter locations not possible with the small usb “internal antenna” adapters.

Br
Torstein

@vkolotov And what about this issue? can you help me?