 
   lastReconnectAttempt = 0;
 
-  #ifdef MQTT_ENABLE
-  if (mdns.begin(MQTTprefix, WiFi.localIP())) {
+  if (mdns.begin(HOSTNAME, WiFi.localIP())) {
     debug("MDNS responder started");
   }
-  #endif
 
   // Setup the root web page.
   server.on("/", handleRoot);

const char* mqtt_password = "";
#define MQTT_RECONNECT_TIME 5000  // Delay(ms) between reconnect tries.

#define MQTTprefix "ir_server"
#define MQTTack MQTTprefix "/sent"  // Topic we send back acknowledgements on
#define MQTTcommand MQTTprefix "/send"  // Topic we get new commands from.
#endif  // MQTT_ENABLE

// Configuration parameters
#define IR_LED 4  // GPIO the IR LED is connected to/controlled by. GPIO 4 = D2.
#define HTTP_PORT 80  // The port the HTTP server is listening on.
#define HOSTNAME "ir_server"  // Name of the device you want in mDNS.

#ifdef MQTT_ENABLE
// Address of your MQTT server.
