 
 
 void setup_wifi() {
-
+  WiFi.mode(WIFI_STA);
   delay(10);
   // We start by connecting to a WiFi network
   Serial.println();

  setupOTA();
  mqttClient.setServer(mqtt_server, 1883);
  mqttClient.setCallback(callback);
  mqttReconnect();
  registration();
}


void loop() {
  ArduinoOTA.handle();
  if (!mqttClient.connected()) {
    mqttReconnect();
  }
  mqttClient.loop();
  fadeLoop();




void mqttTryReconnect() {  
  Serial.print("Attempting MQTT connection...");
  // Attempt to connect
  if (mqttClient.connect(clientID.c_str())) {
    Serial.println("connected");
    for (int i = 0; i < subscriptions_length; i++ )
    {
      mqttClient.subscribe(subscriptions[i].c_str());
      #if DEBUG
        Serial.print("Subscribing to: ");
        Serial.println(subscriptions[i]);
      #endif
    }
  } else {
    Serial.print("failed, rc=");
    Serial.print(mqttClient.state());
    Serial.println(" try again in 5 seconds");
    // Wait 5 seconds before retrying
    delay(5000);
    
  }
}

