     }
  
     Serial.print("Requesting " + action + "... ");
-    action = action + " HTTP/1.0\r\n\r\n";
+    action = action + " HTTP/1.0\r\nHost: " + hostName + "\r\n\r\n";
     wifi.print("AT+CIPSEND=");
     delay(100);
     wifi.println(action.length());



void healthcheck() {
    request(SERVER_ADDRESS, SERVER_PORT, healthcheckAction);
}

void registerEvent() {
    request(SERVER_ADDRESS, SERVER_PORT, eventAction);
}


void request(String host, int port, String action) {
    wifi.println("AT+CIPSTART=\"TCP\",\"" + host + "\"," + port);
    delay(2000);
    if (wifi.find("Error")) {

Task wifiTask(30000, sendStatus);
Task sensorTask(1200, detectPresence);
Task blinkTask(500, pblink);


void setup() {
    pinMode(sensor, INPUT);
