       return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;
     }
   }
-  Serial.println(millis() - beginWait);
-  Serial.println("No NTP Response :-(");
+  if (DEBUG_PRINT) {
+    Serial.println(millis() - beginWait);
+    Serial.println("No NTP Response :-(");
+  }
   return 0; // return 0 if unable to get the time
 }
 
 // send an NTP request to the time server at the given address
 void sendNTPpacket(IPAddress & address)
 {
-  Serial.println("Transmit NTP Request");
+  if (DEBUG_PRINT) {
+    Serial.println("Transmit NTP Request");
+  }
   // set all bytes in the buffer to 0
   memset(packetBuffer, 0, NTP_PACKET_SIZE);
   // Initialize values needed to form NTP request


void sendmqttMsg(char* topictosend, String payload)
{
  /*
  if (!client.connected()) {
    if (client.connect((char*) clientName.c_str(), willTopic, 0, true, willMessage)) {
      client.publish(willTopic, "1", true);
      client.publish(hellotopic, "hello again 2 from ESP8266 s02");
      client.subscribe(subtopic);
    }
  }
  */

  if (client.connected()) {
    Serial.print("Sending payload: ");
    Serial.print(payload);

    unsigned int msg_length = payload.length();

    Serial.print(" length: ");
    Serial.println(msg_length);

    byte* p = (byte*)malloc(msg_length);
    memcpy(p, (char*) payload.c_str(), msg_length);

    if ( client.publish(topictosend, p, msg_length, 1)) {
      Serial.println("Publish ok");
      free(p);
    } else {
      Serial.println("Publish failed");
      free(p);
    }
  }

  f = dht.readTemperature(true);

  if (isnan(h) || isnan(t) || isnan(f)) {
    if (DEBUG_PRINT) {
      Serial.println("Failed to read from DHT sensor!");
    }
    return;
  }

