1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00
This commit is contained in:
J. Nick Koston
2025-10-01 22:35:33 +02:00
parent b4b8b43bd7
commit de2838fa66
2 changed files with 5 additions and 0 deletions

View File

@@ -18,6 +18,8 @@ CODEOWNERS = ["@esphome/core"]
DEPENDENCIES = ["network"]
# Components that create mDNS services at runtime
# IMPORTANT: If you add a new component here, you must also update the corresponding
# #ifdef blocks in mdns_component.cpp compile_records_() method
COMPONENTS_WITH_MDNS_SERVICES = ("api", "prometheus", "web_server")
mdns_ns = cg.esphome_ns.namespace("mdns")

View File

@@ -75,6 +75,9 @@ void MDNSComponent::compile_records_() {
this->hostname_ = App.get_name();
this->services_count_ = 0;
// IMPORTANT: The #ifdef blocks below must match COMPONENTS_WITH_MDNS_SERVICES
// in mdns/__init__.py. If you add a new service here, update both locations.
#ifdef USE_API
if (api::global_api_server != nullptr) {
auto &service = this->services_[this->services_count_++];