[mdns] add Sendspin advertisement support (#14013)

Co-authored-by: J. Nick Koston <nick@home-assistant.io>
This commit is contained in:
Kevin Ahrendt
2026-02-18 21:51:16 -06:00
committed by GitHub
parent 264c8faedd
commit ba7134ee3f
3 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ 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")
COMPONENTS_WITH_MDNS_SERVICES = ("api", "prometheus", "sendspin", "web_server")
mdns_ns = cg.esphome_ns.namespace("mdns")
MDNSComponent = mdns_ns.class_("MDNSComponent", cg.Component)
+18 -1
View File
@@ -29,6 +29,10 @@ static const char *const TAG = "mdns";
#define USE_WEBSERVER_PORT 80 // NOLINT
#endif
#ifndef USE_SENDSPIN_PORT
#define USE_SENDSPIN_PORT 8928 // NOLINT
#endif
// Define all constant strings using the macro
MDNS_STATIC_CONST_CHAR(SERVICE_TCP, "_tcp");
@@ -150,6 +154,18 @@ void MDNSComponent::compile_records_(StaticVector<MDNSService, MDNS_SERVICE_COUN
prom_service.port = USE_WEBSERVER_PORT;
#endif
#ifdef USE_SENDSPIN
MDNS_STATIC_CONST_CHAR(SERVICE_SENDSPIN, "_sendspin");
MDNS_STATIC_CONST_CHAR(TXT_SENDSPIN_PATH, "path");
MDNS_STATIC_CONST_CHAR(VALUE_SENDSPIN_PATH, "/sendspin");
auto &sendspin_service = services.emplace_next();
sendspin_service.service_type = MDNS_STR(SERVICE_SENDSPIN);
sendspin_service.proto = MDNS_STR(SERVICE_TCP);
sendspin_service.port = USE_SENDSPIN_PORT;
sendspin_service.txt_records = {{MDNS_STR(TXT_SENDSPIN_PATH), MDNS_STR(VALUE_SENDSPIN_PATH)}};
#endif
#ifdef USE_WEBSERVER
MDNS_STATIC_CONST_CHAR(SERVICE_HTTP, "_http");
@@ -159,7 +175,8 @@ void MDNSComponent::compile_records_(StaticVector<MDNSService, MDNS_SERVICE_COUN
web_service.port = USE_WEBSERVER_PORT;
#endif
#if !defined(USE_API) && !defined(USE_PROMETHEUS) && !defined(USE_WEBSERVER) && !defined(USE_MDNS_EXTRA_SERVICES)
#if !defined(USE_API) && !defined(USE_PROMETHEUS) && !defined(USE_SENDSPIN) && !defined(USE_WEBSERVER) && \
!defined(USE_MDNS_EXTRA_SERVICES)
MDNS_STATIC_CONST_CHAR(SERVICE_HTTP, "_http");
MDNS_STATIC_CONST_CHAR(TXT_VERSION, "version");
+2
View File
@@ -210,6 +210,8 @@
#define USE_ESP32_IMPROV_NEXT_URL
#define USE_MICROPHONE
#define USE_PSRAM
#define USE_SENDSPIN
#define USE_SENDSPIN_PORT 8928 // NOLINT
#define USE_SOCKET_IMPL_BSD_SOCKETS
#define USE_SOCKET_SELECT_SUPPORT
#define USE_WAKE_LOOP_THREADSAFE