     }
 
     client.stop();
-
   }
   
   Serial.print("< ");

  Serial.println("===============================");
}

void setup()
{
  Serial.begin(115200);

  WiFiManager wifiManager;

  String apName = String(AUTOCONFIG_ACCESSPOINT_NAME) + String("_") + String(ESP.getChipId());
  char apNameBuffer[apName.length()];
  apName.toCharArray(apNameBuffer, apName.length());
  
  if(!wifiManager.autoConnect(apNameBuffer)) {
    Serial.println("failed to connect to WiFi and hit timeout");

  return error;
}

void getCurrentColor() {
  Serial.println("> getCurrentColor()");

  if (connectToAPI()) {
    client.print("GET /api/handlers/");
    client.print(ESP.getFlashChipId());
    client.println("/control HTTP/1.1");
    sendHTTPHeader();
    client.println();

    delay(10);
    String line = client.readStringUntil('\r');

    if (line.startsWith("HTTP/1.1 404 Not Found")) {
      Serial.println("light color not found");
      result = false;
    } else if (line.startsWith("HTTP/1.1 200 OK")) {
      String received_data = "";
      while(client.available()) {
        received_data = received_data + client.readStringUntil('\r');
      }
      StaticJsonBuffer<256> jsonBuffer;
      JsonObject& root = jsonBuffer.parseObject(receive);
      
      const char* hostname = root["hostname"];
      const char* ip = root["ip"];
      const char* port = root["port"];
      const char* name = root["name"];
    } else {
      Serial.print(line);
      while(client.available()) {
        String line = client.readStringUntil('\r');
        Serial.print(line);
      }
      Serial.println("");
      Serial.println("unrecognized status code or error");
    }

    client.stop();
  }
}

void listenForServer()
