   espWifiSetup(); // Start up networking
 
   if (mdnsEnabled)
-  {
-    MDNS.begin(haspNode); // Add mDNS hostname
-    // MDNS.addService("http", "tcp", 80);
+  { // Setup mDNS service discovery if enabled
+    hMDNSService = MDNS.addService(haspNode, "http", "tcp", 80);
     if (debugTelnetEnabled)
     {
-      MDNS.addService("telnet", "tcp", 23);
-    }
-    MDNS.addServiceTxt("arduino", "tcp", "app_name", "HASwitchPlate");
-    MDNS.addServiceTxt("arduino", "tcp", "app_version", String(haspVersion));
-    MDNS.addServiceTxt("arduino", "tcp", "mac", WiFi.macAddress());
+      MDNS.addService(haspNode, "telnet", "tcp", 23);
+    }
+    MDNS.addServiceTxt(hMDNSService, "app_name", "HASwitchPlate");
+    MDNS.addServiceTxt(hMDNSService, "app_version", String(haspVersion).c_str());    
     MDNS.update();
   }
-
+  
   if ((configPassword[0] != '\0') && (configUser[0] != '\0'))
   {
     httpOTAUpdate.setup(&webServer, "/update", configUser, configPassword);

      lcdOtaTransferred += lcdOtaChunkCounter;
      if ((lcdOtaTransferred == lcdOtaFileSize) && nextionOtaResponse())
      {
        debugPrintln(String(F("LCD OTA: success, wrote ")) + String(lcdOtaTransferred) + " of " + String(lcdOtaFileSize) + " bytes.");
        delay(5000); // extra delay while the LCD does its thing
        espReset();
      }
      else
      {
        debugPrintln(F("LCD OTA: failure"));
        delay(2000); // extra delay while the LCD does its thing
        espReset();
      }
    }

ESP8266HTTPUpdateServer httpOTAUpdate;
WiFiServer telnetServer(23);
WiFiClient telnetClient;
MDNSResponder::hMDNSService hMDNSService;

// Additional CSS style to match Hass theme
const char HASP_STYLE[] = "<style>button{background-color:#03A9F4;}body{width:60%;margin:auto;}input:invalid{border:1px solid red;}input[type=checkbox]{width:20px;}</style>";
