[presence] Reliable, Multi-User, Distributed Bluetooth Occupancy/Presence Detection

I bet it will be easy to add Bluetooth support into room-assistant than create one from scratch.

Could be done, sure. My other reasons include that room-assistant has more dependencies to maintain and that node is less approachable if users want to modify.

Plus, the core of presence is active inquiry. The core of room-assistant is passive monitoring. Modification of room-assistant would be much more substantial than slight modification.

1 Like

I disabled beacon mode and removed the beacon MAC from owners_devices, was running solid with no crashes but noticed it took an hour for my phone to show 0% after leaving home yesterday, I then noticed my Xiaomi GW had gone offline so looks like it was still interfering with the 2.5ghz wifi so I’ve switched the Pi Zero off for now.

I’ll power it back up and apply your new code when it’s available.

Thanks again for your hard work, I’m so close to using this as a major presence component! :slight_smile:

Sorry @andrewjfreyer, I think my question got lost :wink:
Did you ever think about implementing on SmartThings ?

Thanks !

I haven’t investigated whether we have hardware access to the bluetooth radio through groovy, but the answer is likely no, I don’t intend to implement this in smart things.

No sorry, I explained it wrong.

I mean to keep using the RPi hardware but instead of MQTT it would send updates to a virtual device on SmartThings.

Thanks !

MQTT is kinda core. How are you reporting the data to your home automation system?

I bet that SmartThings has MQTT support. So Presence will work as-is if you set up MQTT correctly.

1 Like

Look into setting up this:

Is there any trick to getting iOS Bluetooth to work? I’m able to get it to report with my Android phone, but my wife’s iPhone just reports 0 confidence

Had no problems getting iphone bluetooth mac to work

And you pulled it from the General Settings? Do I need to reboot the pi in order for the owner device to take hold?

The script needs to restart, at least. Also be sure that Bluetooth is turned on.

Hmm, I confirmed the mac address, toggled BT and sure that it was on, and then rebooted the Pi. Android is still reporting, but the iphone started at 100 before steadily dropping to zero. Here is one of the messages:

Client mosqsub|520-raspberrypi received PUBLISH (d0, q0, r0, m0, ‘location/owner/home/20:xx:xx:xx:xx:xx’, … (138 bytes))
{“confidence”:“0”,“name”:“Invalid device: No such device”,“scan_duration_ms”:“5073”,“timestamp”:“Tue May 15 2018 01:21:39 GMT+0000 (UTC)”}

EDIT: Nevermind, another reboot got it to stick. Thanks for the great addition!

1 Like

That make sense. Node.js dependency is a good argument.

In the script, there is a command for hcitool name -i hci0 ....; try deleting the -i hci0

I’ve got an issue where the pi can both an android and iPhone Mac but is only reporting
On the iPhone. After restarting the pi, the confidence on the android starts at 100 and goes down to 0. Scanning the Mac I can see this as active by the pi directly through hcitool.
Any help to troubleshoot this would be great

Thanks !

I installed MQTT-Bridge and is up and running on my RPi and SmartThings Hub.

I modified presence.sh to report : “smarthings/(MAC ADD.)”

Now the question is : Smartthings expect “Present” or “Not Present”. Do I need to setup a new virtual device that would accept “confidence” as an attribute ?
Anyone already did this kind of thing ?

Thanks,

A couple of different ways, off the top of my head:

  1. You could create “thing” with a custom device handler in SmartThings to deal with the confidence <–> present translation… would not be my first choice, but if you’re not running HA, this is it.

  2. You can set up a device_tracker in HA as outlined in the 1st post, and fire an MQTT message to SmartThings when its status changes.
    .
    device_tracker.jmbinette becomes home --> smartthings/jmbinette/Present
    device_tracker.jmbinette becomes not_home --> smartthings/jmbinette/Not Present

Have mine running without authentication.

image

I can also confirm that I’m having problems with my network and wifi interfering. Installed everything yesterday Here is a graph of how it looks over the night (internet speed):

1 Like