I recently wanted to add a new bluetooth device to an ESP32 and was stuck for a long time when trying to find the MAC address.
The Setting Up Devices documentation says that you just need to add esp32_ble_tracker: to your configuration and increase the log level and you’ll see the device details appear in the logs after installing the new config.
That worked for me a couple months ago, but after a recent ESPHome update, it was not working as described. The log showed that the tracker was scanning, but no results were appearing, even with VERY_VERBOSE logs. I tried tweaking all the options under esp32_ble_tracker: to no avail—still no devices were appearing in the logs. I then thought maybe I had a bad ESP32 board.
But I found a solution:
If you encounter this issue, you need to also add the following to your YAML to see the devices getting logged:
Then when you install the new config, the devices and MAC addresses will start appearing in the logs.
Find the one you want, copy the MAC address to complete your set up, and then remove the ble_scanner sensor from your config and re-install. You don’t want to leave the ble_scanner there since it will be updating constantly.
I’m just sharing this here since it took me ages to figure out and I think maybe the documentation is out-of-date.
# This worked
text_sensor:
- platform: ble_scanner
name: "BLE Devices Scanner"
# This didn't make a difference for me
logger:
level: VERBOSE #or VERY_VERBOSE
@flyize do you have the URL to that PR? I’d be happy to review if it’s still open! I looked to find it but couldn’t - this project has such an active PR queue! Which is great
This works but I’m getting tons of devices over and over (seems like every time it scans it just dumps everything out). Any way to just see new devices being added? I’m trying to figure out the Mac address for a single device I can turn on and off. Thanks!
same… it would be sooooo nice if the “ble_scanner” had an option to only send NEW mac adresses, or MAC adresses that haven’t seen since 1 hour or so…
i’m not bad in arduino c++ programming, but i don’t know where to start if i want to edit this component… and also i’m afraid to work for nothing if this option already exists but i cannot find it…
You could likely use
on_ble_advertise:
and build lambda to store new addresses to static string (perhaps std::set) and then compare to that list. If new address, print the advertising to template text sensor.