   if (prevSendTime + REPORT_INTERVAL < millis() || millis() < prevSendTime || isnan(h) || isnan(t) ) {
     int uptime = millis()/1000;
     digitalWrite(LED_PIN, LOW);
-    if (exosite.writeRead(writeString +String(t) + writeString2 + String(uptime) + writeString3 + String(h), readString, returnString)) {
+    if (exosite.writeRead(writeString + String(t) + writeString2 + String(uptime) + writeString3 + String(h), readString, returnString)) {
       //Serial.println("Succeeded");
       exosite_comm_errors = 0;
       comm_errors = 0;
       prevSendTime = millis();
       //Handle Response Message
-      for(;;) {
-        index = returnString.indexOf("=", lastIndex+1);
-        if(index != 0) {
+      for (;;) {
+        index = returnString.indexOf("=", lastIndex + 1);
+        if (index != 0) {
           String alias = "";
-          String tempString = returnString.substring(lastIndex+1, index);
+          String tempString = returnString.substring(lastIndex + 1, index);
           Serial.print(F("exo: Dataport - "));
           Serial.print(tempString);
-          lastIndex = returnString.indexOf("&", index+1);
+          lastIndex = returnString.indexOf("&", index + 1);
           alias = tempString;
-          if(lastIndex != -1){
-            tempString = returnString.substring(index+1, lastIndex);
-          }else{
-            tempString = returnString.substring(index+1);
+          if (lastIndex != -1) {
+            tempString = returnString.substring(index + 1, lastIndex);
+          } else {
+            tempString = returnString.substring(index + 1);
           }
           Serial.print("=");
           Serial.print(tempString);
           Serial.print(" ->");
 
           //Handle response for pin D13 to control LED
-          if (alias == "state"){
-            if(tempString == "1"){
+          if (alias == "state") {
+            if (tempString == "1") {
+              s = 1;
               digitalWrite(LIGHTBULB_PIN, LOW);
               Serial.println("turn on Light");
-            }else if(tempString == "0"){
+              exosite.writeRead(writeString4 + String(s), readString, returnString);
+            } else if (tempString == "0") {
+              s = 0;
               digitalWrite(LIGHTBULB_PIN, HIGH);
               Serial.println("turn off Light");
-            }else{
+              exosite.writeRead(writeString4 + String(s), readString, returnString);
+            } else {
               Serial.print(F("Unknown Setting: "));
               Serial.println(tempString);
             }
-          } else if (alias == "msg"){
+          } else if (alias == "msg") {
             Serial.print("Message: ");
             Serial.println(tempString);
           } else {
             Serial.println("Unknown Alias Dataport");
           }
 
-          if(lastIndex == -1)
+          if (lastIndex == -1)
             break;
 
-        } else{
+        } else {
           Serial.println(F("No Index"));
           break;
         }

      //Serial.println("HANDLER: network or platform api request issue");
      exosite_comm_errors++;
      comm_errors++;
      for (int c=0; c<4; c++) {
         digitalWrite(LED_PIN, LOW);
         delay(200);
         digitalWrite(LED_PIN, HIGH);
         delay(200);
      }
    }
    digitalWrite(LED_PIN, HIGH);

    if (exosite_comm_errors == 5) {
       for (int c=0; c<3; c++) {
         digitalWrite(LED_PIN, LOW);
         delay(500);
         digitalWrite(LED_PIN, HIGH);
         delay(500);
      }
      Serial.print("exo: Check Provisioning - ");
      Serial.print("Murano Product ID: ");


}
/*==============================================================================
 * 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();
