 
 void Sonoff::listener() {
   if (Configuration.mode == MODE_SWITCH) {
-    if (!Mqtt.connected()) {
-      connectMQTT();
-    }
-    Mqtt.loop();
+    if (Configuration.interface == INTERFACE_MQTT) {
+      if (!Mqtt.connected()) {
+        connectMQTT();
+      }
+      Mqtt.loop();
+    } else if (Configuration.interface == INTERFACE_HTTP) {
+      /* HTTP */
+    }
   } else if (Configuration.mode == MODE_CONFIGURATION) {
     server.handleClient();
   } else if (Configuration.mode == MODE_ACCESSPOINT) {


/* Private methods */

void Sonoff::runSwitch() {
  Led.on();
  if (Configuration.debugger) Serial << endl << "Device mode: SWITCH" << endl;
  if (Configuration.debugger) Serial << endl << "Configuring MQTT" << endl;
  WiFi.mode(WIFI_STA);
  connectWiFi();
  WiFi.mode(WIFI_STA);
  if (Configuration.ds18b20_present) {
    if (Configuration.debugger) Serial << endl << "Starting DS18B20" << endl;
    setDS18B20Interval(Configuration.ds18b20_interval);
  } else {
    if (Configuration.debugger) Serial << endl << "DS18B20 not present" << endl;
  }
  if (Configuration.switch_present) {
    if (Configuration.debugger) Serial << endl << "Initiating external switch" << endl;
    Switch.init(Configuration.switch_gpio);
  } else {
      if (Configuration.debugger) Serial << endl << "External switch present" << endl;
  }  
}

void Sonoff::runConfigurationLAN() {
  Led.on();
  if (Configuration.debugger) Serial << endl << "Device mode: LAN Configuration" << endl;  
  WiFi.mode(WIFI_STA);
  connectWiFi();
  WiFi.mode(WIFI_STA);

    runSwitch();
  } else if (Configuration.mode == MODE_CONFIGURATION) {
    runConfigurationLAN();
  } else { /* Configuration: Access point */
    runConfigurationAP();
  } 
}


/* It removed configuration */
void Sonoff::reset() {
  if (Configuration.debugger) Serial << "- ereasing EEPROM" << endl;
  Eeprom.erase();
