ESP8266 Wbserver

Hallo Gemeinde, Hilfe

Ich versuche mir einen Webserver zu bauen, der am Anfang mit einer AP öffnet in dem ich meine Daten einstellen kann, und nach Verbindung mit dem Netzwerk, und am liebsten auch nach Verbindung mit dem MQTT Server als Webserver weiterläuft, und ich die Daten live verfolgen kann.

Noch besser wäre es wenn ich keine Verbindung bekomme, ich mir die Daten im AP anschauen kann.

Zurzeit ist es nur ein DHT11.

Dazu habe ich 2 Applikationen die ich im Netz gefunden habe „zusammen gewürfelt“

//WiFiManager with ESP8266 - Autoconnect, Custom Parameter and Manage your SSID and Password | Random Nerd Tutorials
//ESP8266: WiFi Passwort etc. ohne Programmieren speichern | Rustimation.eu

Beim ersten ist der AP und Webserver vorhanden, beim zweiten die MQTT Geschichte, Leider alles mit Deep Sleep.

Ausserdem habe ich die DHT.h gegen DHTesp.h getauscht, da sie im Nachhinein mehr Möglichkeiten bietet.

Leider funktioniert es nicht so wie es soll.

Hier mein Skript.

/*********
  Rui Santos
  Complete project details at https://randomnerdtutorials.com/wifimanager-with-esp8266-autoconnect-custom-parameter-and-manage-your-ssid-and-password/

 https://www.rustimation.eu/index.php/esp8266-wifi-parameter-speichern/
   WiFi Manager Library und allgemeines Vorgehen: https://github.com/tzapu/WiFiManager
  Rui Santos: JSON Routine für Parameterspeicherung - JSON Library muss < v6 sein!
              project details at http://randomnerdtutorials.com
  Mit LittleFS realisiert anstatt SPIFFS
 
  Beim Start versucht ESP 8266zu connecten, wenn kein WLAN gefunden, dann
  Start Captive Portal zur Konfiguration von SSID, PSK, MQTT Server, Username, Topic Pfade

  *********/
#include <LittleFS.h> //this needs to be first, or it all crashes and burns...
#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>          // https://github.com/tzapu/WiFiManager
#include <ArduinoJson.h>          // https://github.com/bblanchon/ArduinoJson
 
#include "DHTesp.h"
#include <MQTT.h>

#define DHTTYPE DHT11
const byte DHT_PIN = 13;     // Pin für DHT11 einstellen
DHTesp dht; 

float humidity;
float temp;
float taupunkt;
float hitzeindex;


float ADC;
float VCCber;

// Set web server port number to 80
WiFiServer server(80);
WiFiClient net;
MQTTClient mqtt;
 

 
char mqtt_server[15] = "IP Adresse";
char mqtt_user[20] = "MQTT User";
char mqtt_password[20] = "MQTT Password";
char mqtt_pathtemp[40] = "/Pfad/Temperatur";
char mqtt_pathhum[40] = "/Pfad/Luftfeuchtigkeit";
 
int MaxReconnects = 5; // Max Anzahl MQTT Server Verbindungsversuche
int MQTTReconnects = 0; // Zähler für MQTT Reconnects
int WiFiConnRetry=0; // Zähler für WiFi Connect Retrys
int WiFiConnMax=100; // Max Anzahl WiFi Verbindungsversuche

// Variable to store the HTTP request
String header;

// Auxiliar variables to store the current output state
String outputState = "off";

// Assign output variables to GPIO pins
char output[2] = "5";

//flag for saving data
bool shouldSaveConfig = false; 

//callback notifying us of the need to save config
void saveConfigCallback () {
  Serial.println("Should save config");
  shouldSaveConfig = true;
}

void setup() {
  Serial.begin(115200);
  Serial.println();
  Serial.println("Booting...");

 dht.setup(DHT_PIN, DHTesp::DHT11);
  //////////////////////////////////
  //clean FS, for testing//////////
//LittleFS.format();/////////////
 //////////////////////////////
  //read configuration from FS json
  Serial.println("mounting FS...");
  
  if (LittleFS.begin()) {
    Serial.println("mounted file system");
    if (LittleFS.exists("/config.json")) {
      //file exists, reading and loading
      Serial.println("reading config file");
      File configFile = LittleFS.open("/config.json", "r");
      if (configFile) {
        Serial.println("opened config file");
        size_t size = configFile.size();
        // Allocate a buffer to store contents of the file.
        std::unique_ptr<char[]> buf(new char[size]);
   
        configFile.readBytes(buf.get(), size);
        DynamicJsonBuffer jsonBuffer;
        JsonObject& json = jsonBuffer.parseObject(buf.get());
        json.printTo(Serial);
        if (json.success()) {
          Serial.println("\nparsed json");
          strcpy(mqtt_server, json["mqtt_server"]);
          strcpy(mqtt_user, json["mqtt_user"]);
          strcpy(mqtt_password, json["mqtt_password"]);
          strcpy(mqtt_pathtemp, json["mqtt_pathtemp"]);
          strcpy(mqtt_pathhum, json["mqtt_pathhum"]);
      strcpy(output, json["output"]);
        } else {
          Serial.println("failed to load json config");
        } 
     }
    }
  } else {
    Serial.println("failed to mount FS");
  }
  //end read

  WiFiManagerParameter custom_mqtt_server("server", "mqtt server", mqtt_server, 15);
  //WiFiManagerParameter custom_mqtt_user("user", "mqtt user", mqtt_user, 20);
  //WiFiManagerParameter custom_mqtt_password("password", "mqtt password", mqtt_password, 20);
  WiFiManagerParameter custom_mqtt_pathtemp("pathtemp", "mqtt path temp", mqtt_pathtemp, 40);
  WiFiManagerParameter custom_mqtt_pathhum("pathhum", "mqtt path hum", mqtt_pathhum, 40);
  WiFiManagerParameter custom_output("output", "output", output, 2);  
 // WiFiManager
  // Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wifiManager;
 
  //set config save notify callback
  wifiManager.setSaveConfigCallback(saveConfigCallback);
 
  // set custom ip for portal
  //wifiManager.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
 
  //add all your parameters here
  wifiManager.addParameter(&custom_mqtt_server);
  //wifiManager.addParameter(&custom_mqtt_user);
  //wifiManager.addParameter(&custom_mqtt_password);
  wifiManager.addParameter(&custom_mqtt_pathtemp);
  wifiManager.addParameter(&custom_mqtt_pathhum);
  wifiManager.addParameter(&custom_output);  
   //////////////////////////////////////////////////////////////////////////////////////////////// 
  // Uncomment and run it once, if you want to erase all the stored informa////////////////////////
//wifiManager.resetSettings();//////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
  //set minimum quality of signal so it ignores AP's under that quality
  //defaults to 8%
  //wifiManager.setMinimumSignalQuality();
 
  //sets timeout until configuration portal gets turned off
  //useful to make it all retry or go to sleep
  //in seconds
  //wifiManager.setTimeout(180);             //beim Spanier ist diese Zeile auskommentiert
  
   // fetches ssid and pass from eeprom and tries to connect
  // if it does not connect it starts an access point with the specified name
  // here  "AutoConnectAP"
  // and goes into a blocking loop awaiting configuration
  wifiManager.autoConnect("MY-Sensor");   
  //wifiManager.autoConnect();
  // or use this for auto generated name ESP + ChipID
  // wifiManager.autoConnect();    

// if you get here you have connected to the WiFi
  Serial.println("Connected.");  
  
  strcpy(mqtt_server, custom_mqtt_server.getValue());
  //strcpy(mqtt_user, custom_mqtt_user.getValue());
  //strcpy(mqtt_password, custom_mqtt_password.getValue());
  strcpy(mqtt_pathtemp, custom_mqtt_pathtemp.getValue());
  strcpy(mqtt_pathhum, custom_mqtt_pathhum.getValue());
  strcpy(output, custom_output.getValue());
  
  Serial.println("saved MQTT params:");
  Serial.println(mqtt_server);
  //Serial.println(mqtt_user);
  //Serial.println(mqtt_password);
  Serial.println(mqtt_pathtemp);
  Serial.println(mqtt_pathhum);
  
  //save the custom parameters to FS
  if (shouldSaveConfig) {
    Serial.println("saving config");
    DynamicJsonBuffer jsonBuffer;
    JsonObject& json = jsonBuffer.createObject();
    json["mqtt_server"] = mqtt_server;
    //json["mqtt_user"] = mqtt_user;
    //json["mqtt_password"] = mqtt_password;
    json["mqtt_pathtemp"] = mqtt_pathtemp;
    json["mqtt_pathhum"] = mqtt_pathhum;
  json["output"] = output;
  
  LittleFS.format(); // weiss nicht, ob das nötig ist, schadet aber nicht.
    File configFile = LittleFS.open("/config.json", "w");
    if (!configFile) {
      Serial.println("failed to open config file for writing");
    }
 
    json.printTo(Serial);
    json.printTo(configFile);
    configFile.close();
    //end save
  }
  
  // Initialize the output variables as outputs
  pinMode(atoi(output), OUTPUT);
  // Set outputs to LOW
  digitalWrite(atoi(output), LOW);;
  
  server.begin();
}

void loop(){
  WiFiClient client = server.available();   // Listen for incoming clients

 if (client) {                             // If a new client connects,
    Serial.println("New Client.");          // print a message out in the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        header += c;
        if (c == '\n') {                    // if the byte is a newline character
          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println("Connection: close");
            client.println();
            
            // turns the GPIOs on and off
            if (header.indexOf("GET /output/on") >= 0) {
              Serial.println("Output on");
              outputState = "on";
              digitalWrite(atoi(output), HIGH);
            } else if (header.indexOf("GET /output/off") >= 0) {
              Serial.println("Output off");
              outputState = "off";
              digitalWrite(atoi(output), LOW);
            }
            
            // Display the HTML web page
            client.println("<!DOCTYPE html><html>");
            client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
            client.println("<link rel=\"icon\" href=\"data:,\">");
            // CSS to style the on/off buttons 
            // Feel free to change the background-color and font-size attributes to fit your preferences
            client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
            client.println(".button { background-color: #195B6A; border: none; color: white; padding: 16px 40px;");
            client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
            client.println(".button2 {background-color: #77878A;}</style></head>");
            
            // Web Page Heading
            client.println("<body><h1>ESP8266 Web Server</h1>");
            
            // Display current state, and ON/OFF buttons for the defined GPIO  
            client.println("<p>Output - State " + outputState + "</p>");
            // If the outputState is off, it displays the ON button       
            if (outputState=="off") {
              client.println("<p><a href=\"/output/on\"><button class=\"button\">ON</button></a></p>");
            } else {
              client.println("<p><a href=\"/output/off\"><button class=\"button button2\">OFF</button></a></p>");
            }                  
            client.println("</body></html>");
            
            // The HTTP response ends with another blank line
            client.println();
            // Break out of the while loop
            break;
          } else { // if you got a newline, then clear currentLine
            currentLine = "";
          }
        } else if (c != '\r') {  // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }
      }
    }
    // Clear the header variable
    header = "";
    // Close the connection
    client.stop();
    Serial.println("Client disconnected.");
    Serial.println("");
  }
  if (client){                                          // neu  hinzugefügt
 mqtt.begin(mqtt_server, net);
  mqtt.loop();
  delay(10);
  while (!mqtt.connect(mqtt_server, mqtt_user, mqtt_password)) {
    Serial.print("MQTT connect ");
    Serial.println(MQTTReconnects);
    MQTTReconnects++;
    if (MQTTReconnects > MaxReconnects) {
      //Serial.println("No MQTT Connect, going to sleep");
      delay(1000);
     // ESP.deepSleep(1800e6);  //30 Minuten
    }
    delay(500);
  }
  Serial.println("MQTT connection established!");
  
  
  delay(2000);
  temp = dht.getTemperature();
  humidity = dht.getHumidity();
  taupunkt = dht.computeDewPoint(temp, humidity);
  hitzeindex = dht.computeHeatIndex(temp, humidity);
  
  Serial.print("MQTT Status: ");
  Serial.println(mqtt.connected());
  Serial.print("Sending... ");
  Serial.println();
  if (!isnan(humidity) || !isnan(temp)) {
    Serial.print("Temp: ");
    Serial.print(String(temp));
    Serial.print(" Humidity: ");
    Serial.println(String(humidity));
    mqtt.publish(String(mqtt_pathtemp), String(temp));
    mqtt.publish(String(mqtt_pathhum), String(humidity));
    mqtt.disconnect();
  }
  }
}

Wenn ich vor dem Laden der Datei
LittleFS.format(); und wifiManager.resetSettings(); einkommentiere
Bekomme ich diese Meldung in der Seriellen Ausgabe.

mit Zeile LittleFS.format(); und wifiManager.resetSettings();
14:16:09.821 -> ⸮⸮⸮xx
14:16:09.821 -> *wm:[2] Added Parameter: pathhum
14:16:09.821 -> *wm:[2] Added Parameter: output
14:16:09.821 -> *wm:[1] resetSettings 
14:16:10.055 -> *wm:[1] SETTINGS ERASED 
14:16:10.055 -> *wm:[1] AutoConnect 
14:16:10.055 -> *wm:[1] No Credentials are Saved, skipping connect 
14:16:10.055 -> *wm:[2] Starting Config Portal 
14:16:10.055 -> *wm:[2] Disabling STA 
14:16:10.055 -> *wm:[2] Enabling AP 
14:16:10.055 -> *wm:[1] StartAP with SSID:  MY-Sensor
14:16:10.572 -> *wm:[2] AP has anonymous access! 
14:16:11.086 -> *wm:[1] AP IP address: 192.168.4.1
14:16:11.086 -> *wm:[1] Starting Web Portal 
14:16:11.086 -> *wm:[2] HTTP server started 
14:16:11.086 -> *wm:[2] Config Portal Running, blocking, waiting for clients... 
14:16:39.642 -> *wm:[2] NUM CLIENTS:  0
14:16:46.698 -> *wm:[2] <- Request redirected to captive portal 
14:16:46.931 -> *wm:[2] <- HTTP Root 
14:16:47.678 -> *wm:[2] <- Request redirected to captive portal 
14:16:48.472 -> *wm:[2] <- Request redirected to captive portal 
14:16:48.563 -> *wm:[2] <- Request redirected to captive portal 
14:16:48.657 -> *wm:[2] <- Request redirected to captive portal 
14:16:58.843 -> *wm:[2] <- HTTP Root 
14:17:04.389 -> *wm:[2] <- HTTP Wifi 
14:17:04.389 -> *wm:[2] WiFi Scan SYNC started 
14:17:06.585 -> *wm:[2] WiFi Scan completed in 2188 ms
14:17:06.585 -> *wm:[1] 8 networks found
14:17:06.585 -> *wm:[2] DUP AP: WLAN-3C6AFE
14:17:06.585 -> *wm:[2] DUP AP: HWB24
14:17:06.585 -> *wm:[2] AP:  -38 WLAN-3C6AFE
14:17:06.632 -> *wm:[2] AP:  -47 DIRECT-FtC48x Series
14:17:06.632 -> *wm:[2] AP:  -53 Woni_pekaway
14:17:06.632 -> *wm:[2] AP:  -75 HWB24
14:17:06.632 -> *wm:[2] AP:  -87 FRITZ!Box Fon WLAN 7360
14:17:06.632 -> *wm:[2] AP:  -94 WLAN-580682
14:17:06.632 -> 15
14:17:06.632 -> 40
14:17:06.632 -> 40
14:17:06.632 -> 2
14:17:09.622 -> *wm:[2] NUM CLIENTS:  1
14:17:39.621 -> *wm:[2] NUM CLIENTS:  1
14:17:48.875 -> *wm:[2] <- Request redirected to captive portal 
14:17:49.481 -> *wm:[2] <- Request redirected to captive portal 
14:18:02.189 -> *wm:[2] <- HTTP WiFi save  
14:18:02.189 -> *wm:[2] Parameters 
14:18:02.189 -> *wm:[2] -------------------- 
14:18:02.189 -> *wm:[2] server: 192.168.2.133
14:18:02.189 -> *wm:[2] pathtemp: ESP/Temperatur
14:18:02.189 -> *wm:[2] pathhum: ESP/Luftfeuchtigkeit
14:18:02.236 -> *wm:[2] output: 5
14:18:02.236 -> *wm:[2] -------------------- 
14:18:02.236 -> *wm:[2] processing save 
14:18:04.245 -> *wm:[2] Connecting as wifi client... 
14:18:04.245 -> *wm:[2] setSTAConfig static ip not set, skipping 
14:18:04.245 -> *wm:[1] Connecting to NEW AP: WLAN-3C6AFE
14:18:04.385 -> *wm:[1] connectTimeout not set, ESP waitForConnectResult... 
14:18:08.025 -> *wm:[2] Connection result: WL_CONNECTED
14:18:08.025 -> *wm:[1] Connect to new AP [SUCCESS] 
14:18:08.025 -> *wm:[1] Got IP Address: 
14:18:08.025 -> *wm:[1] 192.168.2.124 
14:18:08.025 -> Should save config
14:18:08.025 -> *wm:[2] shutdownConfigPortal 
14:18:08.025 -> *wm:[2] restoring usermode STA
14:18:09.008 -> *wm:[2] wifi status: WL_CONNECTED
14:18:09.054 -> *wm:[2] wifi mode: STA
14:18:09.054 -> *wm:[2] configportal closed 
14:18:09.054 -> *wm:[1] config portal exiting 
14:18:09.054 -> Connected.
14:18:09.054 -> saved MQTT params:
14:18:09.054 -> 192.168.2.133
14:18:09.054 -> ESP/Temperatur
14:18:09.054 -> ESP/Luftfeuchtigkeit
14:18:09.054 -> saving config
14:18:09.148 -> {"mqtt_server":"192.168.2.133","mqtt_pathtemp":"ESP/Temperatur","mqtt_pathhum":"ESP/Luftfeuchtigkeit","output":"5"}New Client.
14:18:25.970 -> GET / HTTP/1.1
14:18:25.970 -> Host: 192.168.2.124
14:18:25.970 -> Connection: keep-alive
14:18:25.970 -> Save-Data: on
14:18:25.970 -> Upgrade-Insecure-Requests: 1
14:18:25.970 -> User-Agent: Mozilla/5.0 (Linux; Android 9; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.73 Mobile Safari/537.36
14:18:25.970 -> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
14:18:25.970 -> Accept-Encoding: gzip, deflate
14:18:25.970 -> Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,lb;q=0.6,da;q=0.5
14:18:25.970 -> 
14:18:26.017 -> Client disconnected.
14:18:26.017 -> 
14:18:26.017 -> New Client.
14:18:30.133 -> GET /output/on HTTP/1.1
14:18:30.133 -> Host: 192.168.2.124
14:18:30.133 -> Connection: keep-alive
14:18:30.133 -> Upgrade-Insecure-Requests: 1
14:18:30.133 -> Save-Data: on
14:18:30.133 -> User-Agent: Mozilla/5.0 (Linux; Android 9; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.73 Mobile Safari/537.36
14:18:30.133 -> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
14:18:30.133 -> Referer: http://192.168.2.124/
14:18:30.133 -> Accept-Encoding: gzip, deflate
14:18:30.179 -> Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,lb;q=0.6,da;q=0.5
14:18:30.179 -> 
14:18:30.179 -> Output on
14:18:30.179 -> Client disconnected.
14:18:30.179 -> 
14:18:30.179 -> New Client.
14:18:32.232 -> GET /output/off HTTP/1.1
14:18:32.232 -> Host: 192.168.2.124
14:18:32.232 -> Connection: keep-alive
14:18:32.232 -> Upgrade-Insecure-Requests: 1
14:18:32.232 -> Save-Data: on
14:18:32.232 -> User-Agent: Mozilla/5.0 (Linux; Android 9; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.73 Mobile Safari/537.36
14:18:32.232 -> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
14:18:32.232 -> Referer: http://192.168.2.124/output/on
14:18:32.232 -> Accept-Encoding: gzip, deflate
14:18:32.279 -> Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,lb;q=0.6,da;q=0.5
14:18:32.279 -> 
14:18:32.279 -> Output off
14:18:32.279 -> Client disconnected.
14:18:32.279 -> 
14:18:32.279 -> New Client

Wenn ich dann den Rst Taster drücke, diese Meldung

14:21:48.290 -> rl""""""""""hier wurde resettet"""""""""""""
14:21:48.384 -> Booting...
14:21:48.477 -> mounting FS...
14:21:48.477 -> mounted file system
14:21:48.524 -> *wm:[2] Added Parameter: server
14:21:48.524 -> *wm:[2] Added Parameter: pathtemp
14:21:48.524 -> *wm:[2] Added Parameter: pathhum
14:21:48.524 -> *wm:[2] Added Parameter: output
14:21:48.524 -> *wm:[1] resetSettings 
14:21:48.757 -> *wm:[1] SETTINGS ERASED 
14:21:48.757 -> *wm:[1] AutoConnect 
14:21:48.757 -> *wm:[1] No Credentials are Saved, skipping connect 
14:21:48.757 -> *wm:[2] Starting Config Portal 
14:21:48.757 -> *wm:[2] Disabling STA 
14:21:48.757 -> *wm:[2] Enabling AP 
14:21:48.757 -> *wm:[1] StartAP with SSID:  MY-Sensor
14:21:49.272 -> *wm:[2] AP has anonymous access! 
14:21:49.786 -> *wm:[1] AP IP address: 192.168.4.1
14:21:49.786 -> *wm:[1] Starting Web Portal 
14:21:49.786 -> *wm:[2] HTTP server started 
14:21:49.786 -> *wm:[2] Config Portal Running, blocking, waiting for clients... 
14:22:18.329 -> *wm:[2] NUM CLIENTS:  0

Wenn ich vor dem Laden der Datei
//LittleFS.format(); und //wifiManager.resetSettings(); auskommentiere
Bekomme ich diese Meldung in der Seriellen Ausgabe.

Neu Programm geladen
mit Zeile //LittleFS.format(); und //wifiManager.resetSettings(); auskomentiert

14:28:19.513 -> *wm:[2] AP has anonymous access! 
14:28:19.979 -> *wm:[1] AP IP address: 192.168.4.1
14:28:19.979 -> *wm:[1] Starting Web Portal 
14:28:19.979 -> *wm:[2] HTTP server started 
14:28:20.026 -> *wm:[2] Config Portal Running, blocking, waiting for clients... 
14:28:48.913 -> *wm:[2] NUM CLIENTS:  0
14:29:09.430 -> *wm:[2] <- Request redirected to captive portal 
14:29:09.710 -> *wm:[2] <- Request redirected to captive portal 
14:29:10.128 -> *wm:[2] <- Request redirected to captive portal 
14:29:18.916 -> *wm:[2] NUM CLIENTS:  1
14:29:27.515 -> *wm:[2] <- HTTP Root 
14:29:29.003 -> *wm:[2] <- HTTP Wifi 
14:29:29.003 -> *wm:[2] WiFi Scan SYNC started 
14:29:31.196 -> *wm:[2] WiFi Scan completed in 2187 ms
14:29:31.196 -> *wm:[1] 7 networks found
14:29:31.196 -> *wm:[2] DUP AP: WLAN-3C6AFE
14:29:31.196 -> *wm:[2] AP:  -43 DIRECT-FtC48x Series
14:29:31.196 -> *wm:[2] AP:  -53 Woni_pekaway
14:29:31.196 -> *wm:[2] AP:  -54 WLAN-3C6AFE
14:29:31.196 -> *wm:[2] AP:  -73 HWB24
14:29:31.196 -> *wm:[2] AP:  -80 FRITZ!Box 7590 LQ
14:29:31.196 -> *wm:[2] AP:  -83 FRITZ!Box Fon WLAN 7360
14:29:31.196 -> 15
14:29:31.196 -> 40
14:29:31.196 -> 40
14:29:31.196 -> 2
14:29:48.909 -> *wm:[2] NUM CLIENTS:  1
14:30:03.817 -> *wm:[2] <- HTTP WiFi save  
14:30:03.817 -> *wm:[2] Parameters 
14:30:03.817 -> *wm:[2] -------------------- 
14:30:03.817 -> *wm:[2] server: 192.168.2.133
14:30:03.817 -> *wm:[2] pathtemp: ESP/Temperatur
14:30:03.817 -> *wm:[2] pathhum: ESP/Luftfeuchtigkeit
14:30:03.817 -> *wm:[2] output: 5
14:30:03.817 -> *wm:[2] -------------------- 
14:30:03.817 -> *wm:[2] processing save 
14:30:05.828 -> *wm:[2] Connecting as wifi client... 
14:30:05.828 -> *wm:[2] setSTAConfig static ip not set, skipping 
14:30:05.828 -> *wm:[1] Connecting to NEW AP: WLAN-3C6AFE
14:30:06.013 -> *wm:[1] connectTimeout not set, ESP waitForConnectResult... 
14:30:09.612 -> *wm:[2] Connection result: WL_CONNECTED
14:30:09.612 -> *wm:[1] Connect to new AP [SUCCESS] 
14:30:09.612 -> *wm:[1] Got IP Address: 
14:30:09.659 -> *wm:[1] 192.168.2.124 
14:30:09.659 -> Should save config
14:30:09.659 -> *wm:[2] shutdownConfigPortal 
14:30:09.659 -> *wm:[2] restoring usermode STA
14:30:10.637 -> *wm:[2] wifi status: WL_CONNECTED
14:30:10.637 -> *wm:[2] wifi mode: STA
14:30:10.637 -> *wm:[2] configportal closed 
14:30:10.637 -> *wm:[1] config portal exiting 
14:30:10.637 -> Connected.
14:30:10.637 -> saved MQTT params:
14:30:10.637 -> 192.168.2.133
14:30:10.637 -> ESP/Temperatur
14:30:10.637 -> ESP/Luftfeuchtigkeit
14:30:10.637 -> saving config
14:30:10.730 -> {"mqtt_server":"192.168.2.133","mqtt_pathtemp":"ESP/Temperatur","mqtt_pathhum":"ESP/Luftfeuchtigkeit","output":"5"}New Client.
14:30:44.858 -> GET / HTTP/1.1
14:30:44.858 -> Host: 192.168.2.124
14:30:44.858 -> Connection: keep-alive
14:30:44.858 -> Save-Data: on
14:30:44.905 -> Upgrade-Insecure-Requests: 1
14:30:44.905 -> User-Agent: Mozilla/5.0 (Linux; Android 9; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.73 Mobile Safari/537.36
14:30:44.905 -> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
14:30:44.905 -> Accept-Encoding: gzip, deflate
14:30:44.905 -> Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,lb;q=0.6,da;q=0.5
14:30:44.905 -> 
14:30:44.905 -> Client disconnected.
14:30:44.905 -> 
14:30:44.905 -> New Client.
14:30:55.834 -> GET /output/on HTTP/1.1
14:30:55.834 -> Host: 192.168.2.124
14:30:55.834 -> Connection: keep-alive
14:30:55.834 -> Upgrade-Insecure-Requests: 1
14:30:55.834 -> Save-Data: on
14:30:55.834 -> User-Agent: Mozilla/5.0 (Linux; Android 9; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.73 Mobile Safari/537.36
14:30:55.834 -> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
14:30:55.834 -> Referer: http://192.168.2.124/
14:30:55.834 -> Accept-Encoding: gzip, deflate
14:30:55.881 -> Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,lb;q=0.6,da;q=0.5
14:30:55.881 -> 
14:30:55.881 -> Output on
14:30:55.881 -> Client disconnected.
14:30:55.881 -> 
14:30:55.881 -> New Client.
14:31:01.768 -> GET /output/off HTTP/1.1
14:31:01.768 -> Host: 192.168.2.124
14:31:01.768 -> Connection: keep-alive
14:31:01.768 -> Upgrade-Insecure-Requests: 1
14:31:01.768 -> Save-Data: on
14:31:01.768 -> User-Agent: Mozilla/5.0 (Linux; Android 9; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.73 Mobile Safari/537.36
14:31:01.768 -> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
14:31:01.815 -> Referer: http://192.168.2.124/output/on
14:31:01.815 -> Accept-Encoding: gzip, deflate
14:31:01.815 -> Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,lb;q=0.6,da;q=0.5
14:31:01.815 -> 
14:31:01.815 -> Output off
14:31:01.815 -> Client disconnected.
14:31:01.815 -> 
14:31:01.815 -> New Client.

Wenn ich dann den Rst Taster drücke, diese Meldung

Und das pssaiert nach einem Reset

14:32:42.667 -> Booting...
14:32:42.667 -> mounting FS...
14:32:42.667 -> mounted file system
14:32:42.667 -> reading config file
14:32:42.667 -> opened config file
14:32:42.667 -> {"mqtt_server":"192.168.2.133","mqtt_pathtemp":"ESP/Temperatur","mqtt_pathhum":"ESP/Luftfeuchtigkeit","output":"5"}
14:32:42.667 -> parsed json
14:32:42.667 -> 
14:32:42.667 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
14:32:42.696 -> 
14:32:42.696 -> Exception (28):
14:32:42.696 -> epc1=0x402215aa epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
14:32:42.696 -> 
14:32:42.696 -> >>>stack>>>
14:32:42.696 -> 
14:32:42.696 -> ctx: cont
14:32:42.696 -> sp: 3ffffb00 end: 3fffffc0 offset: 0190
14:32:42.696 -> 3ffffc90:  3fff0798 3ffffeb0 3ffef444 40206676  
14:32:42.696 -> 3ffffca0:  00000073 3ffffeb0 3ffef444 4020745b  
14:32:42.696 -> 3ffffcb0:  4021c258 00000000 000003e8 40214784  
14:32:42.743 -> 3ffffcc0:  00000000 3fff06ac 3fff069c 40208480  
14:32:42.743 -> 3ffffcd0:  00000000 00000000 3ffef3f0 feefeffe  
14:32:42.743 -> 3ffffce0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.743 -> 3ffffcf0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.743 -> 3ffffd00:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.743 -> 3ffffd10:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.743 -> 3ffffd20:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.743 -> 3ffffd30:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.743 -> 3ffffd40:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.743 -> 3ffffd50:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffd60:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffd70:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffd80:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffd90:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffda0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffdb0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffdc0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffdd0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffde0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.790 -> 3ffffdf0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe00:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe10:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe20:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe30:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe40:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe50:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe60:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe70:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe80:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffe90:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.837 -> 3ffffea0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.884 -> 3ffffeb0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.884 -> 3ffffec0:  feefeffe 3ffef444 00000073 3fff0776  
14:32:42.884 -> 3ffffed0:  feefef0a feefeffe feefeffe feefeffe  
14:32:42.884 -> 3ffffee0:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.884 -> 3ffffef0:  4021bf20 feefeffe 3fff078c 00000200  
14:32:42.884 -> 3fffff00:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.884 -> 3fffff10:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.884 -> 3fffff20:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.884 -> 3fffff30:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.931 -> 3fffff40:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.931 -> 3fffff50:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.931 -> 3fffff60:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.931 -> 3fffff70:  feefeffe feefeffe feefeffe feefeffe  
14:32:42.931 -> 3fffff80:  3fff0714 00000000 feefeffe feefeffe  
14:32:42.931 -> 3fffff90:  feefeffe feefeffe feefeffe 3ffef584  
14:32:42.931 -> 3fffffa0:  3fffdad0 00000000 3ffef570 402172a8  
14:32:42.931 -> 3fffffb0:  feefeffe feefeffe 3ffe86b4 40100d29  
14:32:42.931 -> <<<stack<<<
14:32:42.931 -> 
14:32:42.931 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
14:32:42.978 -> 
14:32:42.978 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,6)
14:32:42.978 -> 
14:32:42.978 -> load 0x4010f000, len 3460, room 16 
14:32:42.978 -> tail 4
14:32:42.978 -> chksum 0xcc
14:32:42.978 -> load 0x3fff20b8, len 40, room 4 
14:32:42.978 -> tail 4
14:32:42.978 -> chksum 0xc9
14:32:42.978 -> csum 0xc9
14:32:42.978 -> v00062d50
14:32:42.978 -> ~ld
14:32:43.025 -> 
14:32:43.025 -> Booting...
14:32:43.025 -> mounting FS...
14:32:43.025 -> mounted file system
14:32:43.072 -> reading config file
14:32:43.072 -> opened config file
14:32:43.072 -> {"mqtt_server":"192.168.2.133","mqtt_pathtemp":"ESP/Temperatur","mqtt_pathhum":"ESP/Luftfeuchtigkeit","output":"5"}
14:32:43.072 -> parsed json
14:32:43.072 -> 
14:32:43.072 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
14:32:43.072 -> 
14:32:43.072 -> Exception (28):
14:32:43.072 -> epc1=0x402215aa epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
14:32:43.072 -> 
14:32:43.072 -> >>>stack>>>
14:32:43.072 -> 
14:32:43.072 -> ctx: cont
14:32:43.072 -> sp: 3ffffb00 end: 3fffffc0 offset: 0190
14:32:43.072 -> 3ffffc90:  3fff0798 3ffffeb0 3ffef444 40206676  
14:32:43.072 -> 3ffffca0:  00000073 3ffffeb0 3ffef444 4020745b  
14:32:43.072 -> 3ffffcb0:  4021c258 00000000 000003e8 40214784  
14:32:43.118 -> 3ffffcc0:  00000000 3fff06ac 3fff069c 40208480  
14:32:43.118 -> 3ffffcd0:  00000000 00000000 3ffef3f0 feefeffe  
14:32:43.118 -> 3ffffce0:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.118 -> 3ffffcf0:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.118 -> 3ffffd00:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.118 -> 3ffffd10:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.118 -> 3ffffd20:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.118 -> 3ffffd30:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.118 -> 3ffffd40:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffd50:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffd60:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffd70:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffd80:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffd90:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffda0:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffdb0:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffdc0:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffdd0:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffde0:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.165 -> 3ffffdf0:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.212 -> 3ffffe00:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.212 -> 3ffffe10:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.212 -> 3ffffe20:  feefeffe feefeffe feefeffe feefeffe  
14:32:43.212 -> 3ffffe30:  feefeffe feefeffe feefeffe feefeffe  

und so weiter, und so weiter, und so weiter.....................

Kann mir da einer helfen, und mir sagen wo der Fehler liegt, und wie man Ihn beheben kann, oder gibt es eine bessere Lösung für das was ich vorhabe.

Die HTML Geschichte für den DHT ist noch nicht eingebaut, da muss ich mich auch noch mit beschäftigen. (FUP programmieren ist einfacher :wink: )

Das Ganze soll auf einem ESP8266 D1 laufen

Vielen lieben Dank vorab!
Gruß
Arno

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.