Hi, I’m playing with Bluetooth integration to track people at home.
Since “bluetooth_tracker” doesn’t work, I’ve tried enabling “bluetooth_le_tracker”.
My apartment is located several floors above an busy intersection.
After one week, “known_devices.yaml” contains more than 6400 devices. While most are simply hex macs, a not so tiny fraction shows they are headsets/headphones, bike intercoms, car and truck media connections, but also bulbs (not mine), audio speakers, and TV led strips. Curiously, almost no smartphones.
I have no idea if my phone uses temporary addresses, but I guess it does: I have discovered it by device_tracker.see with its Bluetooth address, but after a few minutes it was not_home and never seen again.
I was wondering:
Discovered devices will remain forever in known_devices.yaml, right? I see no ageing in Bluetooth LE Tracker’s source.
Apparently, bluetooth_le_tracker adds any type of bluetooth device it discovers to known_devices.yaml; however, on start it would only track BLE devices (BLE_xx-xx…). What’s the purpose of this behavior? Doesn’t it clutter device list? If the addon is only for BLE devices, shouldn’t it ignore all other types of BT?
Has anyone thought of a minimum RSSI setting to discover a device, so that devices passing on the street would be ignored, while still having autodiscover of devices inside the home?
If it worked, what would bluetooth_tracker do differently/better?
All good questions. Did you ever find answers? I have 36 devices after running for an hour. When I first enables the tracker there were only 10. So I’m guessing some of these are duplicates with randomized MACs. A few of these have descriptive names (tv, tv1, tv2 - even though I only have on TV). The rest are just MACs. How did you determine the device type?
I live on 1/3 acre so the nearest house or car is about 70ft away. I wouldn’t expect those to be in range, but I’m not sure.
Going on, these are the things I’ve discovered; I leave them to make anyone easier to collect them, as I had to test a bit.
BLE devices advertise “services”, as opposed to classic BT that advertise device names.
The Bleak library, used by device_le_tracker, only works with BLE, i.e. it “sees” only devices advertising services.
Tech detail: I have tried pairing my cell phone with Home Assistant box, but homessistant.log only shows:
The tracker never shows anything different from “not_home”.
So, I’m convinced that there’s no way to use bluetooh_le_tracker to track classic devices.
I concede it’s not easy to find an alternative bluetooth python3 library to use with HomeAssistant on all supported platforms. I saw there’s a pybluez2 but it’s not a solution either, as it doesn’t seem to know about dbus.
So, it seems at the moment bluetooth presence means monitor; you need mqtt and fiddling with the OS though. I didn’t try it yet.
Hello there,
I think your phone will be discovered only using the BT tracker and not the BLE.
I am on an RPI 3b+ with internal Bluetooth disabled and a USB dongle added.
For me it works, I track the phone and a watch using BLE, but recently, after the renewal of the BT stack I cannot control the time at home for the BLE elements, they go away only after 15 minutes while the normal BT shows them away after 120 seconds (as I choose in the configuration file).
If anyone knows how to control the consider_home parameter on BLE, it would be greatly appreciated.
I personally edit the known_devices.yaml and set the parameter track to true.
If your device isn’t there (BLE devices aren’t added for example in my env), you have to add it manually, simply copying the mac address of the device. Here two examples:
my_phone:
mac: BT_XX:1C:F0:45:C1:AD (this is a normal BT device - phone)
icon: mdi:cellphone
name: Redmi
picture:
track: true
amazfit_gts_2:
mac: BLE_XX:F4:C6:65:9B:5C (this is a BLE device - watch)
icon: mdi:watch
name: Amazfit GTS 2
picture:
track: true
I use two USB BT dongles, not very new (over BT 5.X software started to have problems with the newest dongles) and I assign one to BT and the other to BLE, in this way they work smoothly.
As in my previous post:
If anyone knows how to control the consider_home parameter on BLE, it would be greatly appreciated.
Hope this helps and hope someone can help me with controlling the BLE (consider_home parameter).
M.
Apple use “address randomisation” in BLE to reduce the risk of tracking, so that could be the reason that you see many more MAC addresses than expected.