[DISC] Add the capability to use the device BLE name (#1936)

This commit is contained in:
Florian authored and GitHub committed 2024-04-25 07:11:02 -05:00
1 parent 55d9d87a77
commit 68fd4dc17e
4 files changed
+30 -18

No files matched your search

+2 -2
View File
@@ -393,9 +393,9 @@ void createDiscovery(const char* sensor_type,
device["mdl"] = device_model;
}
// generate unique device name by adding the second half of the device_id only if device_name and device_id are different
// generate unique device name by adding the second half of the device_id only if device_name and device_id are different and we don't want to use the BLE name
if (device_name[0]) {
if (strcmp(device_id, device_name) != 0 && device_id[0]) {
if (strcmp(device_id, device_name) != 0 && device_id[0] && !ForceDeviceName) {
device["name"] = device_name + String("-") + String(device_id + 6);
} else {
device["name"] = device_name;