 void sendData() {
   // poll energino
   char *json = getDatastreams();
-  // if there's a successful connection:
+  // check if the feed has been initialized
+  if (settings.feed == 0) {
+    lastConnectionTime = millis();
+    return;
+  }
+  // try to connect
   DBG Serial.println("Connecting.");
-  if ((settings.feed != 0) && client.connect(settings.host, settings.port)) {
+  EthernetClient client;    
+  if (client.connect(settings.host, settings.port)) {
     DBG Serial.println("connected.");
     DBG Serial.print("PUT /v2/feeds/");
     DBG Serial.println(settings.feed);

    if (value > 0) {
      settings.period = value;
    }
  } else if (cmd == 'A') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      settings.r1 = value;
    }
  } else if (cmd == 'B') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      settings.r2 = value;
    }
  } else if (cmd == 'C') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      settings.offset = value;
    }
  } else if (cmd == 'D') {
    int value = atoi(inputBytesPtr);
    if (value >= 0) {
      settings.sensitivity = value;
    }
  } else if (cmd == 'K') {
    strncpy(settings.apikey, inputBytes,49);
    settings.apikey[48] = '\0';
  }

  else {
    // if you couldn't make a connection:
    DBG Serial.println("Unable to connect.");
  }
  lastConnectionTime = millis();
}
