1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-10 22:03:46 +01:00

[mdns] Support templatable config options for MDNS extra services (#8606)

This commit is contained in:
Nate Clark
2025-04-28 00:27:39 -04:00
committed by GitHub
parent fdc4ec8a57
commit 253e3ec6f6
9 changed files with 45 additions and 21 deletions

View File

@@ -29,9 +29,11 @@ void MDNSComponent::setup() {
while (*service_type == '_') {
service_type++;
}
MDNS.addService(service_type, proto, service.port);
uint16_t port = const_cast<TemplatableValue<uint16_t> &>(service.port).value();
MDNS.addService(service_type, proto, port);
for (const auto &record : service.txt_records) {
MDNS.addServiceTxt(service_type, proto, record.key.c_str(), record.value.c_str());
MDNS.addServiceTxt(service_type, proto, record.key.c_str(),
const_cast<TemplatableValue<std::string> &>(record.value).value().c_str());
}
}
}