From f52bc6c11eaf9d61cbb40e0b703897114bb43eba Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 21 Jan 2026 08:22:00 -0600 Subject: [PATCH] [SYS] Fix: Set WiFi hostname to gateway name (#2272) * Fix: Set WiFi hostname to gateway name Add WiFi.setHostname() calls to ensure the ESP's WiFi hostname matches the configured gateway name instead of using the default ESP hostname. - Add wifiManager.setHostname(gateway_name) in setupWiFiManager() for WiFiManager-based setups - Add WiFi.setHostname(gateway_name) in setupWiFiFromBuild() for manual WiFi setup configurations (ESPWifiManualSetup) This matches the existing behavior for Ethernet connections where ETH.setHostname(gateway_name) is already called. Fixes #2150 Co-authored-by: Florian <1technophile@users.noreply.github.com> * Change WiFi mode position * Fix setHostname when using WiFi Manager --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Florian <1technophile@users.noreply.github.com> --- main/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/main.cpp b/main/main.cpp index cefaf82..7452920 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1427,6 +1427,7 @@ void setup() { extern void setupWiFiFromBuild(); setupWiFiFromBuild(); #else + WiFi.setHostname(gateway_name); WiFi.mode(WIFI_STA); if (loadConfigFromFlash()) { // Config present THEENGS_LOG_NOTICE(F("Config loaded from flash" CR)); @@ -1815,6 +1816,7 @@ void ESPRestart(byte reason) { #if defined(ESPWifiManualSetup) void setupWiFiFromBuild() { + WiFi.setHostname(gateway_name); WiFi.mode(WIFI_STA); wifiMulti.addAP(wifi_ssid, wifi_password); THEENGS_LOG_TRACE(F("Connecting to %s" CR), wifi_ssid);