mirror of
https://github.com/1technophile/OpenMQTTGateway.git
synced 2026-02-20 00:32:04 +01:00
[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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user