 
     ether.printIp("[N] SRV: ", ether.hisip);
   }
-  sendToTwitter();
 }
 
 float getTemp() {

    numberOfDevices = sensors.getDeviceCount();

    // locate devices on the bus
    Serial.print("[T] Locating one-wire devices on port ");
    Serial.println(PIN_ONEWIRE);

    Serial.print("[T] Found ");
    Serial.print(numberOfDevices, DEC);
    Serial.println(" one-wire devices.");

    // report parasite power requirements
    Serial.print("[T] Parasite power is: ");
    if (sensors.isParasitePowerMode()) Serial.println("ON");
    else Serial.println("OFF");

    if (numberOfDevices < 1) delay(500);
  }

  return temp;
}

static uint32_t timer;
void loop () {
  ether.packetLoop(ether.packetReceive());

  if (millis() > timer) {
    timer = millis() + 5000;

    // TODO: check doorsensor
    int newDoorstatus = DOOR_ERROR;
    float newTemp = getTemp();

    if (newDoorstatus != oldDoorstatus) {
      Serial.println(newDoorstatus == DOOR_OPEN ? "[!] DOOR OPENED!" : "[!] DOOR CLOSED!");
      updateDoorstatus(newDoorstatus);
      oldDoorstatus = newDoorstatus;

    } else if (newTemp != oldTemp) { // comparing floats? well ...
      Serial.print("[!] Temp updated: ");
      Serial.println(newTemp);
      updateTemperature(newTemp);
      //oldTemp = newTemp;
    } else Serial.println("[*] Nothing to do.");

  }
}

