Setting up Bluetooth binding in 2017


(Nolan Darilek) #1

Hello. Apologies if this is documented and I’ve just failed to find it. I just set up Openhab2 on my Raspberry Pi, and not yet having a lot of home automation hardware, I thought I’d begin by setting up presence detection via bluetooth. I just want to detect whether my phone is present, and eventually automate temperature and other controls based on that.

I found a wiki page documenting the process of rebuilding the bluetooth bindings to work under Linux. Didn’t look too complicated, and I’ve used Linux since Slackware96 so…

  1. The directions for recompiling Bluecove have you check out a svn repository on Google Code. The Google Code service no longer exists.
  2. Googling for a new source location for Bluecove takes me to a SourceForge page, which in turn points me to the defunct Google Code page. I don’t even know if the source for this library is still available.
  3. I can’t find the Bluetooth addon sources. I’d thought to download the jars for 2.1.0 still available on Google Code and see if the addon built with those, though lots has changed in the Linux world since those were built (2008) and I’m worried they may not work.

Is this still even a supported addon? I’m familiar with Linux, but navigating this ecosystem is incredibly overwhelming. :slight_smile:
Thanks.


Connecting autonomous bluetooth device
(Alex Wood) #2

I know this doesn’t answer you directly. But can you not use the Network binding (just make sure to stop paper ui from autoadding things as you’ll have a nightmare as I did when I used it a few days ago for the first time, adding everything on your network, agh, and even things which weren;t there), and add the ip addresses of the phones (set them static in your router)?


(Rich Koshak) #3

Until a new 2.0 version of the binding is released I cannot recommend using the BT binding. I never was able to get it to work on Linux.

A couple options you have for BT presence detection are:

Use the above in conjunction with Network binding and you will have a pretty reliable solution.

To aggregate the sensors together see Sensor Aggregation

@thete, I’ve found that Network is not very reliable with phones. A lot of phones, iPhone in particular, turn off their network when they go to sleep and stop responding to pings as a result. There are some approaches to overcome this using hping3 but over all they tend to be unsatisfactory.

Also, I didn’t know the Network binding now supports autodiscovery. That’s kind of cool.


(Nolan Darilek) #4

Thanks! So it looks like what I could do is:

  • Create an item for each presence I want to track, perhaps as a switch.
  • Set up sensorReporter to monitor for configured Bluetooth devices, making a REST call to indicate the on/off state of the presence item.
  • Configure rules and scripts to act on my presence or absence.

Does that about sum it up? I’m learning lots and want to ensure that I’m synthesizing it all correctly.


(Rich Koshak) #5

Pretty much right on. You also have the option of using MQTT (which is what I use). Note that the REST communicator of sensorReporter was written for OH 1.8. I do not know if it still works with OH 2.0 (there was one not officially supported way to set an Item’s state through a GET that may be used in that class).

See the Sensor Aggregation link above for how I integrate multiple sensors for presence.


(Vlad Kolotov) #6

Hi all, a new bluetooth binding is available for betta testing: