     serverCheck();
     networkCheck();
   #endif
-  #ifdef USE_NEOPIXEL
-    neopixelLoop();
+}
+
+#ifdef USE_NETWORK
+void networkCheck()
+{
+  // dump all pending data from network connections to the serial interface
+  if (client.available())
+  {
+    for (byte i=0; i<12; i++)
+    {
+      readBuffer[i] = client.read();
+    }
+    client.stop();
     
-    if (millis()-lastTrigger < 1000)
+    String response = readBuffer;
+    if (response.substring(9) == "200")
     {
-      neopixelSet(255 - (millis()-lastTrigger)*255/1000, 0, 0);
-    } else if (lastTrigger > 0)
+      Serial.println("[network] HTTP push successful"); 
+    } else
     {
-      neopixelSet(0, 64, 0);
-      lastTrigger = 0;
+      Serial.println("[network] HTTP push failed - response: "+response.substring(9));
     }
-  #endif
-}
-
-#ifdef USE_NETWORK
-void networkCheck()
-{
-  // dump all pending data from network connections to the serial interface
-  while (client.available())
-  {
-    char c = client.read();
-    Serial.print(c);
-  }
-
-  // stop the client if we lost the connection since the last loop
-  if (!client.connected() && lastConnected) {
-    Serial.println("[network] closing connection");
-    client.stop();
-  }
-  lastConnected = client.connected();
+  }
 }
 #endif
 

#define WIFI_SSID "ssid"
#define WIFI_KEY "wpakey"

// Uncomment this line if you would like to use a NeoPixel for status indication
//#define USE_NEOPIXEL
#define NEOPIXEL_PIN 9

//#define USE_XS1_SERVER
#define XS1_IP (10, 11, 10, 18)
#define XS1_URL "/control?callback=cname&cmd=set_state_sensor&number=9&value="
#define XS1_TIMEFRAME 2

#ifdef USE_NETWORK
bool networkRequestIP(IPAddress ip, String url)
{
  Serial.print("[network] HTTP request ");
  Serial.println(url);
  
  if (client.connect(ip, 80))
  {
    client.print("GET ");
    client.print(url);
    client.println(" HTTP/1.0");
    client.println("Connection: close");
    client.println();
    return true;
  } else
  {
