Add friendly name in MDNS records if it is not empty (#4317)

This commit is contained in:
Stroe Andrei Catalin 2023-01-19 22:13:18 +02:00 committed by GitHub
parent f2eafa8fbe
commit 6d65671f92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ void MDNSComponent::compile_records_() {
service.service_type = "_esphomelib"; service.service_type = "_esphomelib";
service.proto = "_tcp"; service.proto = "_tcp";
service.port = api::global_api_server->get_port(); service.port = api::global_api_server->get_port();
if (App.get_friendly_name().empty()) { if (!App.get_friendly_name().empty()) {
service.txt_records.push_back({"friendly_name", App.get_friendly_name()}); service.txt_records.push_back({"friendly_name", App.get_friendly_name()});
} }
service.txt_records.push_back({"version", ESPHOME_VERSION}); service.txt_records.push_back({"version", ESPHOME_VERSION});