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

Can you compare this to “home” or “away”? I think this is an “away” problem with repeated scanning.

Hi @andrewjfreyer - sorry to nag, but any chance of an update on your progress on the next version?

Yes, slow going but progress is happening! I have a very reliable means of detecting a user has arrived at the house, so no more rapid scanning.

2 Likes

Hi Andrew! Yes! I see a clear correlation between when one or more users are not detected by the Rpi, and when al users are detected. When all users are detected, I have very few problems but as soon as anyone leaves speed starts to decrease rapidly.

1 Like

It will be appreciated if you could advise me on:

  1. A Bluetooth USB brand/model that has good coverage to use with my Raspberry Pi 2
  2. If I am intend to listen to music on my Bluetooth speakers will the presence detection still work?
1 Like

Nothing to add to the discussion besides kudos to @andrewjfreyer for making this. This solution has been running flawlessly on my Pi3 for over a month now. Just logged in to update the code from .25 to .28. Been running all the time with the t2 option and triggering it with the a sensor connected to the main door. The Pi3 is connected on LAN in the middle of the house (3 floors) and it has yet to give me any false readings on our four iPhones. The only little thing I have noticed is when the door is opened and the sensor triggered, it generates some MQTT traffic to the HASS server which again makes the light sensor (Hue) a wee bit slow turning on the hallway lights (talking about going from .5 second to 3-4 seconds). No biggie.

To summarize: This solution has made me 100% confident on running other automation based on presence! :grinning:

1 Like

Hi all,

Still pouring through the refactoring of the presence script to reduce interference with Wi-Fi and to improve overall performance. Quick poll:

  • Yes, I use GUEST SCANNING
  • No, I do not use GUEST SCANNING
  • I do not currently use GUEST SCANNING, but I might in the future

0 voters

And another:

  • YES, I use BTLE beacons (or would like to)
  • NO, I do not use BTLE tags (nor would I like to)

0 voters

Ive been running into huge slow downs since enabling bluetooth (not LE) tracking. Philips hue start going unavailable, my Hassio panel is just white, everything is incredibly slow in home assistant while the processor is only at 7% usage, plenty of free memory. It’s strange.

once disabling the BT addon, everything goes back to working smoothly.

1 Like

Yup, this is the WiFi interference issue many users have identified. Working on a fix!

In the meantime, some users have had success changing Wi-Fi channels.

2 Likes

well sorry for posting to this thread, but your message got me triggered, since i am suffering the same issues on my Hassio install.

disable the bluetooth and this is what happens:

018-05-31 16:39:24 ERROR (SyncWorker_14) [homeassistant.components.device_tracker.bluetooth_tracker] Error looking up Bluetooth device
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/bluetooth/bluez.py", line 289, in _gethcisock
    sock = _bt.hci_open_dev (device_id)
_bluetooth.error: no available bluetoot devices

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/bluetooth_tracker.py", line 92, in update_bluetooth
    result = bluetooth.lookup_name(mac, timeout=5)
  File "/usr/lib/python3.6/site-packages/bluetooth/bluez.py", line 61, in lookup_name
    sock = _gethcisock ()
  File "/usr/lib/python3.6/site-packages/bluetooth/bluez.py", line 291, in _gethcisock
    raise BluetoothError ("error accessing bluetooth device")
bluetooth.btcommon.BluetoothError: error accessing bluetooth device

would that be pointing to an issue with the device, or just be regular shut-off behavior…?

thanks for the pointer!

Tangentially related: how are you guys figuring out the bluetooth MAC address of devices? doing a bluetoothctl scan nets dozens of devices, few of which display any helpful info

on iOS or android, you can find your hardware addresses via Settings > About

thanks! ive also got a bunch of tiles and trackrs too though

my best idea is to place them near a scanning device and look for a MAC with a high RSSI :flushed:

Any ETA for that fix? :slight_smile:

1 Like

you enabled the add-on as well as setup device tracker? the mac address in your device tracker file should start with BT_

I disabled wifi by pulling the sd card from my pi, then editing the wpa_supplicant.conf file.

what’s interesting, is I could never get duckdns with letsencrypt to work, I had the pi plugged in, but was using wifi at the same time. When I edited my wpa_supplicant.conf and took out the wifi config in it, duckdns and letsencrypt worked flawlessly. I spent probably 40+ hours and that’s all I needed to do… ugh.

anyways, i set my wpa_supplicant.conf file to work with Ethernet instead of wifi, all my Bluetooth problems disappeared. Device tracker now works great.

unfortunately I have Google Wifi, it’s amazing with signal range and penetration, but it would let you force a channel or even 2.4 or 5ghz. It does everything on its own. I’m running home assistant on Ethernet now and BT works great.

Working hard! Complete rewrite and testing takes time :slight_smile:

6 Likes

guys… maybe stupid question, but no need to define port of mqtt broker?

Unless you’re using a non-default port, there is no need to specify. 1883 by default.

@andrewjfreyer

Would you mind sharing your wheezy service file (as systemd is not natively included in Wheezy)?

I also have a lying RPi1 with a BT dongle which I’d like to use for this purpose.

Thanks in advance and kind regards.