diff --git a/environments.ini b/environments.ini index 80adcd53..37da16ec 100644 --- a/environments.ini +++ b/environments.ini @@ -257,6 +257,7 @@ build_flags = '-DMQTT_USER=""' '-DMQTT_PASS=""' '-DMQTT_PORT="1883"' + '-DMDNS_SD=true' '-DDEEP_SLEEP_IN_US=120000000' ; Deep sleep for a period of time to conserve battery '-DESP32_EXT0_WAKE_PIN=GPIO_NUM_14' ;Should a water leak be detected immediatly wake the ESP32 and report the problem '-DESP32_EXT0_WAKE_PIN_STATE=0' ;Should a water leak be detected immediatly wake the ESP32 and report the problem, sensor state to look for wakeup diff --git a/main/main.cpp b/main/main.cpp index 812f4f91..cefaf82c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -936,7 +936,7 @@ std::pair discoverMQTTbroker() { } if (n == 1) { THEENGS_LOG_TRACE(F("One MQTT server found setting parameters" CR)); - return {MDNS.IP(0).toString(), uint16_t(MDNS.port(0))}; + return {MDNS.hostname(0).c_str(), uint16_t(MDNS.port(0))}; } else { THEENGS_LOG_WARNING(F("Several MQTT servers found, please deactivate mDNS and set your default server" CR)); }