Update ble_presence.rst (#4181)

The original example code to generate the list of discovered BLE devices was not up to date and didn't work for the last year since the following PR: https://github.com/esphome/esphome/pull/4049
With this update users can easily find out how to get this information.
This commit is contained in:
Tomer 2024-08-30 14:46:10 +03:00 committed by GitHub
parent 5a077ecfab
commit b9b975cc47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -82,35 +82,29 @@ Setting Up Devices
------------------
To set up binary sensors for specific BLE beacons you first have to know which MAC address
to track. Most devices show this screen in some setting menu. If you don't know the MAC address,
to track. Most devices show this screen in some settings menu. If you don't know the MAC address,
however, you can use the ``esp32_ble_tracker`` hub without any binary sensors attached and read through
the logs to see discovered Bluetooth Low Energy devices.
.. code-block:: yaml
# Example configuration entry for finding MAC addresses
esp32_ble_tracker:
Using the configuration above, first you should see a ``Starting scan...`` debug message at
boot-up. Then, when a BLE device is discovered, you should see messages like
``Found device XX:XX:XX:XX:XX:XX`` together with some information about their
address type and advertised name. If you don't see these messages, your device is unfortunately
currently not supported.
.. code-block:: yaml
# Example configuration entry for finding
# Service UUIDs and iBeacon UUIDs and identifiers
# MAC addresses, Service UUIDs, iBeacon UUIDs, and identifiers
esp32_ble_tracker:
on_ble_advertise:
- then:
logger:
level: VERY_VERBOSE
You can increase the :ref:`log level <logger-log_levels>` to ``VERY_VERBOSE`` to review detailed
data for each discovered BLE device. This will make ESPHome print Service UUIDs, iBeacon UUIDs,
iBeacon major and minor identifiers, BLE manufacturer data, RSSI and other data useful for
debugging purposes. Note that this is useful only during set-up and a less verbose log level
should be specified afterwards.
Using the configuration above, first, you should see a ``Starting scan...`` debug message at
boot-up. Then, when a BLE device is discovered, you should see messages like
``Parse Result:`` together with some information about their MAC address, address type,
advertised name, Service UUIDs, iBeacon UUIDs, iBeacon major and minor identifiers,
BLE manufacturer data, RSSI, and other data useful for debugging purposes.
Note that this is useful only during set-up and a less verbose log level
should be specified afterwards. If you don't see these messages, your device is unfortunately
currently not supported.
Please note that devices that show a ``RANDOM`` address type in the logs probably use a privacy
feature called Resolvable Private Addresses to avoid BLE tracking. Since their MAC-address periodically