From d2d07543b2a3d46fbc2f100ef94c60e816a1f139 Mon Sep 17 00:00:00 2001 From: Mike <7153163+hackbar@users.noreply.github.com> Date: Tue, 15 Jan 2019 17:26:51 -0800 Subject: [PATCH] Do an MDNS resolve before using the cached host. MDNS shouldn't be aggressively cached, since the IP could change. This makes using DHCP for the host a lot easier. --- sonoff/xdrv_02_mqtt.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonoff/xdrv_02_mqtt.ino b/sonoff/xdrv_02_mqtt.ino index 1d3c3a4b8..ae84d1940 100644 --- a/sonoff/xdrv_02_mqtt.ino +++ b/sonoff/xdrv_02_mqtt.ino @@ -516,7 +516,7 @@ void MqttReconnect(void) #ifndef USE_MQTT_TLS #ifdef USE_DISCOVERY #ifdef MQTT_HOST_DISCOVERY - if (!strlen(Settings.mqtt_host) && !MqttDiscoverServer()) { return; } + if (!MqttDiscoverServer() && !strlen(Settings.mqtt_host)) { return; } #endif // MQTT_HOST_DISCOVERY #endif // USE_DISCOVERY #endif // USE_MQTT_TLS