 #include <ESP8266WiFi.h>
 #include <ESP8266WebServer.h>
 #include <WiFiUDP.h>
-#include "SSDP.h"
-
-const char* ssid = "********";
-const char* password = "********";
+#include "ESP8266SSDP.h"
+#include <NeoPixelBus.h>
+
+// The follwing is needed in order to fill ipString with a String that contains the IP address
+extern "C" {
+#include "ip_addr.h"
+}
+char ipChars[16];
+
+#include "/secrets.h" // Delete this line and populate the following
+//const char* ssid = "********";
+//const char* password = "********";
+
+// Settings for the NeoPixels
+#define pixelCount 30 // Strip has 30 NeoPixels
+#define colorSaturation 128
+NeoPixelBus strip = NeoPixelBus(pixelCount, 2); // Strip is attached to GPIO2 on ESP-01
+RgbColor red = RgbColor(colorSaturation, 0, 0);
+RgbColor green = RgbColor(0, colorSaturation, 0);
+RgbColor blue = RgbColor(0, 0, colorSaturation);
+RgbColor white = RgbColor(colorSaturation);
+RgbColor black = RgbColor(0);
+
+/// X, Y, Z and x, y are values to desvribe colors
+float X;
+float Y;
+float Z;
+float x;
+float y;
+
+// Determines wheter a client is already authorized
+bool isAuthorized = false;
+
+byte mac[6]; // MAC address
+String macString;
+String ipString;
 
 ESP8266WebServer HTTP(80);
-uDevice device;
-uSSDP SSDP;
+
 
 String client = "e7x4kuCaC8h885jo"; // "UjBZ0nvTLu7aMdOe"; // The client string that the client app sends. Need to enter here what the app sends.
 // FIXME: Parse this out of what is being sent by the app.
+
+String getLightString(int lightNumber) {
+  String lightString = "\"" + String(lightNumber) + "\": {"
+                       "\"state\": {"
+                       "\"on\": true,"
+                       "\"bri\": 144,"
+                       "\"hue\": 13088,"
+                       "\"sat\": 212,"
+                       "\"xy\": [0.5128,0.4147],"
+                       "\"ct\": 467,"
+                       "\"alert\": \"none\","
+                       "\"effect\": \"none\","
+                       "\"colormode\": \"xy\","
+                       "\"reachable\": true"
+                       "},"
+                       "\"type\": \"Extended color light\","
+                       "\"name\": \"Hue Lamp 1\","
+                       "\"modelid\": \"LCT001\","
+                       "\"swversion\": \"66009461\","
+                       "\"pointsymbol\": {"
+                       "\"1\": \"none\","
+                       "\"2\": \"none\","
+                       "\"3\": \"none\","
+                       "\"4\": \"none\","
+                       "\"5\": \"none\","
+                       "\"6\": \"none\","
+                       "\"7\": \"none\","
+                       "\"8\": \"none\""
+                       "}"
+                       "}";
+  return lightString;
+}
+
 
 void handleAllOthers() {
   Serial.println("===");

}

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

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  if (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("WiFi Failed");
    while (1) delay(100);
  }

  Serial.print("Starting HTTP at ");
  Serial.print(WiFi.localIP());

  if ( requestedUri.endsWith("/config") )
  {
    String longstr = "[{"
                     " \"lights\": { " + getLightString(1) + " }," // FIXME: Properly iterate as to provide more than one light
                     " \"name\": \"Philips hue\","
                     " \"zigbeechannel\": 0," // As per spec, 0 is allowed
                     " \"mac\": \"" + macString + "\","
                     " \"dhcp\": true,"
                     " \"ipaddress\": \"" + ipString + "\","
                     " \"netmask\": \"255.255.255.0\"," // TODO: FIXME
                     " \"gateway\": \"192.168.0.1\"," // TODO: FIXME
                     " \"proxyaddress\": \"none\","
                     " \"proxyport\": 0,"
                     " \"UTC\": \"2014-07-17T09:27:35\","
                     //" \"localtime\": \"2014-07-17T11:27:35\"," // This was added in a bridge update at the beginning of 2014
                     " \"timezone\": \"\","
                     //" \"timezone\": \"Europe/Berlin\","
                     " \"whitelist\": {"
                     " \"" + client + "\": {"
                     " \"last use date\": \"2015-06-17T07:21:38\","
                     " \"create date\": \"2014-04-08T08:55:10\","
                     " \"name\": \"Chroma for Hue\""
                     " }"
                     //  " \"pAtwdCV8NZId25Gk\": {"
                     //   " \"last use date\": \"2014-05-07T18:28:29\","
                     //   " \"create date\": \"2014-04-09T17:29:16\","
                     //   " \"name\": \"MyApplication\""
                     //   " },"
                     //  " \"gDN3IaPYSYNPWa2H\": {"
                     //  " \"last use date\": \"2014-05-07T09:15:21\","
                     //  " \"create date\": \"2014-05-07T09:14:38\","
                     //  " \"name\": \"iPhone Web 1\""
                     //  " }"
                     " },"
                     " \"swversion\": \"01012917\","
                     " \"apiversion\": \"1.3.0\","
