 
   server.on("/", handleRoot);
 
-  server.on("/getCurrentWeather", [](){
-    float h = dht.readHumidity();
-    float t = dht.readTemperature();
-    server.send(200, "text/plain", "{temperature: " + String(t) + ", humidity: " + String(h) + "}");
+  server.on("/getCurrentWeather", []() {
+    float currentHumidity = dht.readHumidity();
+    float currentTemperature = dht.readTemperature();
+    server.send(200, "text/plain", "{temperature: " + String(currentTemperature) + ", humidity: " + String(currentHumidity) + "}");
   });
 
-  server.on("/getCurrentSet", [](){
-    server.send(200, "text/plain", "{temperature: " + String(setTeperature) + ", humidity: " + String(setHumidity) + "}");
+  server.on("/putCurrentSet", handlePutCurrentSet);
+
+  server.on("/getCurrentSet", []() {
+    server.send(200, "text/plain", "{temperature: " + String(temperatureToLaunch) + ", humidity: " + String(humidityToLaunch) + "}");
   });
 
-  server.on("/setTemperature/", [](){
-    setTeperature = temperature;
-    server.send(200, "text/plain", "{temperature: " + String(setTeperature) + ", humidity: " + String(setHumidity) + "}");
+  server.on("/getAiring", []() {
+    server.send(200, "text/plain", "{furnace: " + String(airing) + "}" );
+  });
+
+  server.on("/putAiring", []() {
+    autoMode = false;
+    airing = !airing;
+
+    if (airing) {
+      digitalWrite(AIRING_PIN, HIGH);
+    } else {
+      digitalWrite(AIRING_PIN, LOW);
+    }
+
+    server.send(200, "text/plain", "{furnace: " + String(airing) + "}");
+  });
+
+  server.on("/getFurnace", []() {
+    server.send(200, "text/plain", "{furnace: " + String(furnace) + "}" );
+  });
+
+  server.on("/putFurnace", []() {
+    autoMode = false;
+    furnace = !furnace;
+
+    if (furnace) {
+      digitalWrite(FURNACE_PIN, HIGH);
+    } else {
+      digitalWrite(FURNACE_PIN, LOW);
+    }
+
+    server.send(200, "text/plain", "{furnace: " + String(furnace) + "}");
   });
 
   server.onNotFound(handleNotFound);

  Serial.println("HTTP server started");
}

void loop(void){
  server.handleClient();
}


DHT dht(DHTPIN, DHTTYPE);
ESP8266WebServer server(80);

int AIRING_PIN = 4;
int FURNACE_PIN = 3;

float temperatureToLaunch = 0;
float humidityToLaunch = 0;
boolean autoMode = false;
boolean airing = false;
boolean furnace = false;

void handleRoot() {
  server.send(200, "text/plain", "hello from esp8266!");
}

void handleNotFound() {
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET) ? "GET" : "POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i = 0; i < server.args(); i++) {
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}

void handlePutCurrentSet() {

  if (server.hasArg("plain") == false) {

    server.send(200, "text/plain", "Body not received");
    return;

  }

  autoMode = true;

  String message = "Body received:\n";
  message += server.arg("plain");
  message += "\n";

  server.send(200, "text/plain", message + " autoMode: " + String(autoMode));
}

void setup(void) {
  Serial.begin(9600);
  pinMode(AIRING_PIN, OUTPUT);
  pinMode(FURNACE_PIN, OUTPUT);
  WiFi.begin(ssid, password);
  Serial.println("");
  dht.begin();
