1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-26 12:43:48 +00:00

Include the bluetooth mac address in the device info when proxy is enabled (#8203)

This commit is contained in:
J. Nick Koston
2025-02-27 13:37:11 +00:00
committed by GitHub
parent c19621e238
commit 63a7234767
5 changed files with 22 additions and 0 deletions

View File

@@ -15,6 +15,9 @@
#include "bluetooth_connection.h"
#include <esp_bt.h>
#include <esp_bt_device.h>
namespace esphome {
namespace bluetooth_proxy {
@@ -114,6 +117,11 @@ class BluetoothProxy : public esp32_ble_tracker::ESPBTDeviceListener, public Com
return flags;
}
std::string get_bluetooth_mac_address_pretty() {
const uint8_t *mac = esp_bt_dev_get_address();
return str_snprintf("%02X:%02X:%02X:%02X:%02X:%02X", 17, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
protected:
void send_api_packet_(const esp32_ble_tracker::ESPBTDevice &device);