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:
esp32_ble_tracker: text_sensor: - platform: ble_scanner name: "BLE Devices Scanner"
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.