       // trigger timer before we try again
       //startWifiConnectTimer();
 
-      // Sleep for 1 minute
-      ESP.deepSleep(60000000);
+      // Serial.println("Simulating deep sleep, couldn't find known network");
+      // delay(5000);
+      // ESP.restart();
+      // Serial.println("Shouldn't have gotten here");
+
+      // Sleep for 5 minute
+      Serial.println("startWiFi:Deep sleeping (couldn't find known network)");
+      ESP.deepSleep(300000000);
 
     }
   } else {
     // We are connected to a network
     // Only if we were waiting for wifi do these
     // otherwise just carry on
-    if (isWaitingForWiFi == true) {
-      isWaitingForWiFi = false;
-      configureOTA();
-      //startSensorTimer();
-
-    }
+    // if (isWaitingForWiFi == true) {
+    //   isWaitingForWiFi = false;
+    //   configureOTA();
+    //   //startSensorTimer();
+    //
+    // }
   }
 }
 

// MQTT topics

char sensorTopic[] = "iot-2/evt/sensor/fmt/json";

WiFiClient wifiClient;
PubSubClient client(server, 1883, callback, wifiClient);

    connectWithBroker();
  }

  publishDebug("Wifi intialised");

  readSensorData();
  sendSensorData();


  // Serial.println("Simulating deep sleep after sending sensor data");
  // delay(5000);
  // ESP.restart();
  // Serial.println("Shouldn't have gotten here");

  Serial.println("Setup:Deep sleeping");
  publishDebug("Setup:Deep sleeping");
  ESP.deepSleep(60000000);
}

