diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index c4cc9d18f8..fc10fb103b 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -805,7 +805,7 @@ DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) { resp.project_version = ESPHOME_PROJECT_VERSION; #endif #ifdef USE_WEBSERVER - resp.webserver_port = WEBSERVER_PORT; + resp.webserver_port = USE_WEBSERVER_PORT; #endif return resp; } diff --git a/esphome/components/esp32_improv/esp32_improv_component.cpp b/esphome/components/esp32_improv/esp32_improv_component.cpp index 788e7a9460..956934abc1 100644 --- a/esphome/components/esp32_improv/esp32_improv_component.cpp +++ b/esphome/components/esp32_improv/esp32_improv_component.cpp @@ -128,7 +128,7 @@ void ESP32ImprovComponent::loop() { std::vector urls = {ESPHOME_MY_LINK}; #ifdef USE_WEBSERVER auto ip = wifi::global_wifi_component->wifi_sta_ip(); - std::string webserver_url = "http://" + ip.str() + ":" + to_string(WEBSERVER_PORT); + std::string webserver_url = "http://" + ip.str() + ":" + to_string(USE_WEBSERVER_PORT); urls.push_back(webserver_url); #endif std::vector data = improv::build_rpc_response(improv::WIFI_SETTINGS, urls); diff --git a/esphome/components/improv_serial/improv_serial_component.cpp b/esphome/components/improv_serial/improv_serial_component.cpp index 9f86c06e6f..b55855abf9 100644 --- a/esphome/components/improv_serial/improv_serial_component.cpp +++ b/esphome/components/improv_serial/improv_serial_component.cpp @@ -95,7 +95,7 @@ std::vector ImprovSerialComponent::build_rpc_settings_response_(improv: std::vector urls; #ifdef USE_WEBSERVER auto ip = wifi::global_wifi_component->wifi_sta_ip(); - std::string webserver_url = "http://" + ip.str() + ":" + to_string(WEBSERVER_PORT); + std::string webserver_url = "http://" + ip.str() + ":" + to_string(USE_WEBSERVER_PORT); urls.push_back(webserver_url); #endif std::vector data = improv::build_rpc_response(command, urls, false); diff --git a/esphome/components/mdns/mdns_component.cpp b/esphome/components/mdns/mdns_component.cpp index 915c640b06..168eaf3ae1 100644 --- a/esphome/components/mdns/mdns_component.cpp +++ b/esphome/components/mdns/mdns_component.cpp @@ -16,8 +16,8 @@ namespace mdns { static const char *const TAG = "mdns"; -#ifndef WEBSERVER_PORT -#define WEBSERVER_PORT 80 // NOLINT +#ifndef USE_WEBSERVER_PORT +#define USE_WEBSERVER_PORT 80 // NOLINT #endif void MDNSComponent::compile_records_() { @@ -63,7 +63,7 @@ void MDNSComponent::compile_records_() { MDNSService service{}; service.service_type = "_prometheus-http"; service.proto = "_tcp"; - service.port = WEBSERVER_PORT; + service.port = USE_WEBSERVER_PORT; this->services_.push_back(service); } #endif @@ -74,7 +74,7 @@ void MDNSComponent::compile_records_() { MDNSService service{}; service.service_type = "_http"; service.proto = "_tcp"; - service.port = WEBSERVER_PORT; + service.port = USE_WEBSERVER_PORT; service.txt_records.push_back({"version", ESPHOME_VERSION}); this->services_.push_back(service); } diff --git a/esphome/components/web_server/__init__.py b/esphome/components/web_server/__init__.py index 62d5ec6f14..1e5f341717 100644 --- a/esphome/components/web_server/__init__.py +++ b/esphome/components/web_server/__init__.py @@ -66,8 +66,8 @@ async def to_code(config): cg.add_define("USE_WEBSERVER") cg.add(paren.set_port(config[CONF_PORT])) - cg.add_define("WEBSERVER_PORT", config[CONF_PORT]) cg.add_define("USE_WEBSERVER") + cg.add_define("USE_WEBSERVER_PORT", config[CONF_PORT]) cg.add(var.set_css_url(config[CONF_CSS_URL])) cg.add(var.set_js_url(config[CONF_JS_URL])) cg.add(var.set_allow_ota(config[CONF_OTA])) diff --git a/esphome/core/defines.h b/esphome/core/defines.h index a74755f651..cb30c0cf66 100644 --- a/esphome/core/defines.h +++ b/esphome/core/defines.h @@ -47,8 +47,8 @@ #define USE_MQTT #define USE_PROMETHEUS #define USE_WEBSERVER +#define USE_WEBSERVER_PORT 80 // NOLINT #define USE_WIFI_WPA2_EAP -#define WEBSERVER_PORT 80 // NOLINT #endif // ESP32-specific feature flags