   }
   else {
     server.send(200, "text/html", INDEX_RELAY_HTML);
-  }
-}
-
-
-
-void handleRoot()
-{
-   if (server.args() > 1){
-      Serial.println("Field update requested");
-      sensorName = server.arg("SENSOR_NAME");
-      String wifiName   = server.arg("WIFI_NAME");
-      String wifiPwd    = server.arg("WIFI_PWD");
-      String mqttIp     = server.arg("MQTT_IP");
-      String mqttPort   = server.arg("MQTT_PORT");
-
-      Serial.print("sensorName :");
-      Serial.println(sensorName);
-      Serial.print("wifiName :");
-      Serial.println(wifiName);
-      Serial.print("wifiPwd :");
-      Serial.println(wifiPwd);
-      Serial.print("mqttIp :");
-      Serial.println(mqttIp);
-      Serial.print("mqttPort :");
-      Serial.println(mqttPort);
-
-      strcpy(&eepromArray[0][0], sensorName.c_str());
-      strcpy(&eepromArray[1][0], wifiName.c_str());
-      strcpy(&eepromArray[2][0], wifiPwd.c_str());
-      strcpy(&eepromArray[3][0], mqttIp.c_str());
-      strcpy(&eepromArray[4][0], mqttPort.c_str());
-
-      for (int addr = 0; addr < sizeof(eepromArray); addr++){
-          EEPROM.write(addr, ((char*)eepromArray)[addr]);
-      }
-      EEPROM.commit();
-      Serial.println("EEPROM updated");
-      returnOK();
-
-  }
-  else {
-    Serial.println("no  arg");
-    server.send(200, "text/html", INDEX_HTML);
-  }
-
-}
-
-
-
-
-void handleSubmit()
-{
-  String LEDvalue;
-
-  if (!server.hasArg("LED")) return returnFail("BAD ARGS");
-  LEDvalue = server.arg("LED");
-  if (LEDvalue == "1") {
-
-    server.send(200, "text/html", INDEX_HTML);
-  }
-  else if (LEDvalue == "0") {
-
-    server.send(200, "text/html", INDEX_HTML);
-  }
-  else {
-    returnFail("Bad LED value");
   }
 }
 

void toggleRelayState(){
    if(currentRelayState == RELAY_STATE_OFF)
    {
       currentRelayState= RELAY_STATE_ON;

       digitalWrite(LED, HIGH);
       digitalWrite(RELAY, HIGH);
       if(bootMode == BOOT_MODE_MQTT){
           char tmpChar = RELAY_STATE_ON;
           myMqtt->publishValue("state", &tmpChar);
       }
    }
    else
    {
       currentRelayState = RELAY_STATE_OFF;

       digitalWrite(LED, LOW);
       digitalWrite(RELAY, LOW);
       if(bootMode == BOOT_MODE_MQTT){
           char tmpChar = RELAY_STATE_OFF;
           myMqtt->publishValue("state", &tmpChar);
       }
    }


}


void loop() {
  // put your main code here, to run repeatedly:
 if(bootMode == BOOT_MODE_CONFIG){
    server.handleClient();
    blinkLedConfigMode();

}
else
{


  if(bootMode == BOOT_MODE_MQTT){
      if (!myMqtt->connected()) {
         myMqtt->reconnect();
         statusGiven = false;
      }
      if (myMqtt->connected() & !statusGiven) {
         deviceMqttReadyBlink();
         statusGiven = true;
      }
      myMqtt->loop();


  }
  else{
    server.handleClient();
    
  }

  //In all case monitor HW button
  if(digitalRead(BUTTON) == 0){
       pressCount +=1;
       Serial.print("count :");
       Serial.println(pressCount);
       if(pressCount == 2){
           Serial.println("Toggling state");
           toggleRelayState();
       }
  }
  else{
        pressCount = 0;
  }



}



delay(100);

}


"</html>";


void returnOK()
{
  server.sendHeader("Connection", "close");
