 
 }
 /*==============================================================================
-* loop
-*
-* Arduino loop function.
-*=============================================================================*/
+ * loop
+ *
+ * Arduino loop function.
+ *=============================================================================*/
 void loop()
 {
   int8_t index = 0;
   int8_t lastIndex = -1;
   float h,t;
-
+  
+  // Set initial value for "state", lightbulb off (0)
+  if (initial)
+  {
+    exosite.writeRead(writeString4 + String(s), readString, returnString);
+    initial = false;
+  }
+  
   if (prevSensorTime + SENSOR_INTERVAL < millis() || millis() < prevSensorTime)
   {
     h = dht.readHumidity();

  Serial.println(macString);

  for (int c=0; c<8; c++) {
     digitalWrite(LED_PIN, LOW);
     delay(100);
     digitalWrite(LED_PIN, HIGH);
     delay(100);
  }
  if (exosite.provision(productId, productId, macString)) {
        Serial.println("setup: Provision Succeeded");
        EEPROM.commit();
  } else {
        Serial.println("setup: Provision Check Done");
  }

  // Setup Sensor Interface

  // Print Some Useful Info
  Serial.print(F("wifi: MAC Address: "));
  Serial.println(macString);
}