3rd Party Bluetooth Binding. Beta testers needed

Anyone else having this as well? ^^

It works for me.

Hello!
I just installed your binding on a raspberry pi3. Everything went well till nearly the end.
I edited the bluetooth config file and inserted the group, but this is now happening:

bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-09-30 20:28:27 CEST; 7s ago
Docs: man:bluetoothd(8)
Process: 16209 ExecStart=/usr/libexec/bluetooth/bluetoothd (code=exited, status=1/FAILURE)
Main PID: 16209 (code=exited, status=1/FAILURE)
Status: “Starting up”

Thanks
Tom

Hi @Tommyshome, could you please clarify what you mean by “edited the bluetooth config file”? Which one? Please also post its content here.

Hello!
I followed this guide:

And entered point 8 of the guide in the conf file:

Thanks

Tom

Hi @Tommyshome, could you please add content of that file?

Sure! here it is:

<policy user="root">
    <allow own="org.bluez"/>
    <allow send_destination="org.bluez"/>
    <allow send_interface="org.bluez.Agent1"/>
    <allow send_interface="org.bluez.MediaEndpoint1"/>
    <allow send_interface="org.bluez.MediaPlayer1"/>
    <allow send_interface="org.bluez.ThermometerWatcher1"/>
    <allow send_interface="org.bluez.AlertAgent1"/>
    <allow send_interface="org.bluez.Profile1"/>
    <allow send_interface="org.bluez.HeartRateWatcher1"/>
    <allow send_interface="org.bluez.CyclingSpeedWatcher1"/>
    <allow send_interface="org.bluez.GattCharacteristic1"/>
    <allow send_interface="org.bluez.GattDescriptor1"/>
    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
    <allow send_interface="org.freedesktop.DBus.Properties"/>
  </policy>

  </policy>
  <policy group="bluetooth">
    <allow send_destination="org.bluez"/>
  </policy>

  <policy at_console="false">
    <allow send_destination="org.bluez"/>
  </policy>

  <!-- allow users of lp group (printing subsystem) to 
       communicate with bluetoothd -->
  <policy group="lp">
    <allow send_destination="org.bluez"/>
  </policy>

  <policy context="default">
    <deny send_destination="org.bluez"/>
  </policy>


</busconfig>

Thanks!
Tom

Hi all,

Just bought these tags off Amazon (2 for $10) and they appeared in OH just fine. Push the button, beeps twice, done. I haven’t connected via the app, but after 6 hours they are still working with OH. I did notice in the logs that sometimes the device would go off line but back on in one second.

I’m running OH on RPI 3+ B and using the built in bluetooth. Can’t say I’m impressed with the range on the RPI’s built in bluetooth, but I have some USB adapters on the way.

For those interested here’s the tags I ordered. https://www.amazon.com/gp/product/B07F35DJVC/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
If anyone has a question or would like me to test something with one of my tags let me know.

1 Like

Hi @H102, thanks for reporting this.

You can play with “Online timeout” to make it more stable.

Hi @Tommyshome, it looks ok to me. Could you please check syslog file for errors (when you start/restart bluetooth)? There should be some details why it has failed to start.

Thanks, do you mean the openhab.log?

Nope, I mean /var/log/syslog, pls do it in a separate window:

tail -f /var/log/syslog

And then restart bluetooth (in another terminal/window):

sudo /etc/init.d/bluetooth restart

Hi Vlad,

I’ve ordered (exactly) one of them and just received it. I think I can confirm, these are usable as trackers. (other than my older ones which have link loss service, beeping when you’re out of range and then turn off)

But: Once they’ve been connected for example using the nRF-Connect app or your binding, they will beep as well when out of range (despite not having the link loss service shown in the GATT list):

But it has a Battery Service, clicking on read brings the level value 99%, which sounds valid for a new coin cell.
I guess, you will usually not connect to the trackers to avoid battery drain. So the battery level will not be available as channel - right?

EDIT: Forget about the battery, just clicked on “connection control” and got the battery channel :wink:

btw.: Did you had a chance meanwhile looking into:

Hi!

This is the result:

Oct 2 15:35:05 raspberrypi systemd[1]: Starting Bluetooth service…
Oct 2 15:35:05 raspberrypi bluetoothd[32253]: Bluetooth daemon 5.47
Oct 2 15:35:05 raspberrypi bluetoothd[32253]: D-Bus setup failed: Connection “:1.2008” is not allowed to own the service “org.bluez” due to security policies in the configuration file
Oct 2 15:35:05 raspberrypi bluetoothd[32253]: Unable to get on D-Bus
Oct 2 15:35:05 raspberrypi systemd[1]: bluetooth.service: Main process exited, code=exited, status=1/FAILURE
Oct 2 15:35:05 raspberrypi systemd[1]: Failed to start Bluetooth service.
Oct 2 15:35:05 raspberrypi systemd[1]: bluetooth.service: Unit entered failed state.
Oct 2 15:35:05 raspberrypi systemd[1]: bluetooth.service: Failed with result ‘exit-code’.

Thanks
Tom

Hi Tom,

I recently install this binding on my RPI and found a few things I needed to change. Looking at your bluetooth.config file above and comparing with mine I see a few differences.

Policy at console is true on my RPI

Policy group is only listed once for me and the group is lp ( I also needed to add lp to openhab via sudo usermod -a -G lp openhab)

Here is a pic of my bluetooth.config, if you want to test using my configs. Just remember to add lp group to openhab then sudo systemctl daemon-reload and sudo systemctl restart bluetooth

1 Like

Thank you very much H102!
Working now!!!

Bluetooth is working, but I don’t find any thing in inbox. How do I set them manually?

Thanks

Tom

@Tommyshome from PaperUI > Inbox > click the + and select the bluetooth binding. If nothing found, click add manually and select bluetooth adapter. This is assuming you haven’t discovered your adapter???

Edit: Also from PaperUI make sure you have Configuration>System>Item Linking> Simple mode turned on.

I added the bluetooth adapter manually, but the status of the adapter is offline…

In the openhab.log file I have a lot of warnings:

2018-10-02 21:03:18.695 [WARN ] [th.manager.impl.BluetoothManagerImpl] - Device discovery job error
java.lang.RuntimeException: Error getting object manager client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type=“method_call”, sender=“:1.1801” (uid=109 pid=450 comm=“/usr/bin/java -Dopenhab.home=/usr/share/openhab2 -”) interface=“org.freedesktop.DBus.ObjectManager” member=“GetManagedObjects” error name=“(unset)” requested_reply=“0” destination=“:1.322” (uid=0 pid=1890 comm=“/usr/libexec/bluetooth/bluetoothd “)
at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.3]
at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) [230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.3]
at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBFactory.getDiscoveredDevices(TinyBFactory.java:175) [230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.3]
at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$DeviceDiscoveryJob.discoverDevices(BluetoothManagerImpl.java:723) [231:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.6]
at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$DeviceDiscoveryJob.run(BluetoothManagerImpl.java:716) [231:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.6]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
2018-10-02 21:03:28.519 [WARN ] [th.manager.impl.BluetoothManagerImpl] - Adapter discovery job error
java.lang.RuntimeException: Error getting object manager client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type=“method_call”, sender=”:1.1802” (uid=109 pid=450 comm=“/usr/bin/java -Dopenhab.home=/usr/share/openhab2 -”) interface=“org.freedesktop.DBus.ObjectManager” member=“GetManagedObjects” error name=“(unset)” requested_reply=“0” destination=“:1.322” (uid=0 pid=1890 comm="/usr/libexec/bluetooth/bluetoothd ")
at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.3]
at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) [230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.3]
at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBFactory.getDiscoveredAdapters(TinyBFactory.java:162) [230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.3]
at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$AdapterDiscoveryJob.discoverAdapters(BluetoothManagerImpl.java:817) [231:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.6]
at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$AdapterDiscoveryJob.run(BluetoothManagerImpl.java:810) [231:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.6]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

What output do you have using:

$cat /lib/systemd/system/bluetooth.service

$sudo systemctl status bluetooth

Also use the config tools to make sure permissions are correct

$sudo openhabian-config
Can’t recall the exact location but look around and find “fix permissions” select it and exit.

pi@raspberrypi:~ $ cat /lib/systemd/system/bluetooth.service
[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
ConditionPathIsDirectory=/sys/class/bluetooth

[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/libexec/bluetooth/bluetoothd
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
ProtectHome=true
ProtectSystem=full

[Install]
WantedBy=bluetooth.target
Alias=dbus-org.bluez.service

Now I have: Failed to set privacy: Rejected (0x0b)

pi@raspberrypi:~ $ sudo openhabian-config
sudo: openhabian-config: command not found