I am looking for a way to track devices via Bluetooth, and I’m not talking about BLE devices or ibeacons.
I want a way to have HA monitor for all Bluetooth devices and use the MAC address as the trigger etc.
I have a BT dongle that is supported and I have some ESP32 boards at my disposal.
What is the best way to achieve this? Im trying to use normal Bluetooth instead of making everyone use a iBeacon app or, walk around with a BLE tag hidden on them, instead utilise normal Bluetooth mac’s.
I few months ago I needed something similar: Detect known phones in the house with Bluetooth on.
I started simple and I never had to change it. All I do is run a simple MQTT client daemon on a Raspberry Pi 3. With a list of the Bluetooth MAC addresses in the Python variable Devices, I do something like this
import bluetooth
import paho.mqtt.client
...
tracked = {}
while True:
for device in Devices:
name = bluetooth.lookup_name(device, timeout=3)
if name is not None and device not in tracked:
mqtt.publish(topic=f'tracker/{device}', payload='home', retain=True)
tracked[device] = name
elif name is None and device in tracked:
mqtt.publish(topic=f'tracker/{device}', payload='not_home', retain=True)
del tracked[device]
time.sleep(15)
...
Then I define an MQTT device_tracker for each known MAC, something like this under mqtt: device_tracker: in configuration.yaml