Update: 2024-03-06

Esp32 Zeitschaltuhr

Singel Zeitschaltuhr mit NTP Zeitsynchronisation

Automatischer Wechsel zwischen Sommer und Normalzeit

Optionaler Zugriffsschutz mittels HTTP-Authentifizierung

Betriebsstundenzähler für den Angeschlossenen Verbraucher

Schalten bei Dämmerung

Verbrauchsanzeige in Kilowattstunden

Ereignisdatenspeicher für Schaltzeiten und Auslöser

Eins vorweg, ich übernehme keinerlei Verantwortung falls ihr diesen Sketch nutzt um mittels Relais oder SSR Netzspannung zu schalten. Ich stelle bewusst keine Schaltpläne dazu zur Verfügung. Wendet euch dafür an eine Elektrofachkraft mit entsprechender Ausbildung.

Getestet habe ich mit den, bei Arduino-Jüngern, beliebten blauen Relais Modulen, einem Mosfet "IRF3708" und einem Solid State Relais "Fotek SSR-40 DA".

Esp32 Zeitschaltuhr

Highlight

Der Sketch Zeitschaltuhr ist für LOW und HIGH aktive Relais, Solid State Relais oder Mosfet geeignet. Dies muss vor dem Hochladen einmalig im Sketch, im Tab Schaltuhr.ino, eingestellt werden. Es lassen sich bis zu 100 Ein-/Aus-Schaltzeiten für ein angeschlossenes Gerät einstellen. Dies kann vor dem Hochladen im Tab Schaltuhr.ino eingestellt werden. Rechts neben dem Button zum manuellen Ein-/Ausschalten des Ausgangs befindet sich die optische Schaltzustandsanzeige.

Esp Zeitschaltuhr

Eine Betriebsstundenanzeige der Angeschlossenen Geräte erfolgt durch Klick/Touch in den oberen Teil. Gib den Verbrauch deines Gerätes in Watt in die Maske ein. Der Betriebstundenzähler lässt sich per Klick/Touch auf den Button zurücksetzen.

Esp Zeitschaltuhr

Es wird für jeden Monat eine neue CSV Datei angelegt, in der die Schaltzeiten und der Initiator des Schaltvorgangs gespeichert werden.

Ansicht Exel (formatiert)

Apr An Initiator Aus Initiator
1. 04:40:00 Programm 04:50:00 Programm
1. 21:36:20 192.168.178.36 21:36:41 192.168.178.36
1. 22:00:11 192.168.178.45 22:00:35 192.168.178.45
2. 04:38:00 Programm 04:40:00 Programm
3. 04:38:00 Programm 04:40:00 Programm
3. 20:47:07 192.168.178.36 20:47:48 192.168.178.36
3. 20:52:16 192.168.178.36 20:52:51 192.168.178.36
4. 05:47:09 Taster 05:53:21 Taster
5. 04:38:00 Programm 04:40:00 Programm

Esp32 Zeitschaltuhr

Funktionen

Die einzelnen Schaltzeiten können mittels Schaltfläche ON/OFF aktiviert oder deaktiviert werden. Ein-und Ausschaltzeiten werden in einer Datei im Filesystem des Esp.. gespeichert. Eingegebene Zeitperioden werden durch Klick/Touch des Speichern Buttons zum ESP.. gesendet. Ein erfolgreiches speichern der Schaltzeiten auf dem Esp32 Webserver wird im Webinterface für 5 Sekunden signalisiert. Alle Schaltzeiten können gleichzeitig aktiviert/deaktiviert werden.

Grafik Esp32 Zeitschaltuhr

Anleitung zur Inbetriebnahme

Zuerst im "Connect" Tab deine Wlan Zugangsdaten eingeben, anschliesend im "Schaltuhr" Tab die Variable "aktiv" auf HIGH oder LOW setzen. "const auto aktiv = HIGH;" Je nachdem welche Komponente du an den Ausgängen betreiben möchtest. Du kannst die Anzahl der Schaltzeiten pro Relais an deinen Bedarf anpassen. Diese werden im "Schaltuhr" Tab definiert. "constexpr uint8_t RECORDS = 20;" Im Tab Sonnenlauf den Längen- und Breitengrad deines Standortes eintragen. Eventuell den NTP Zeitserver und die Zeitzone, für deinen Standort, in der "Lokalzeit.ino" ändern. Anschließend den Sketch hochladen.
Im Seriellen Monitor wird die IP des ESP.. angezeigt. "deineIP/fs.html" Kopiere diese URL in die Adresszeile deines Browsers und verbinde dich mit deinem Esp32.
Falls sich im LittleFS (Speicher) des Esp32 noch keine "fs.html" befindet wird ein kleiner Helfer zu deinem Browser gesendet. Mit diesem kannst du die "fs.html" und die "style32.css" hochladen. Jetzt wird der Spiffs Manager angezeigt, mit dem du noch die "admin.html" , das Favicon und die "index.html" in den Speicher deines Esp... uploaden musst. Klick/Touch nun auf die index.html um zur Zeitschaltuhr zu kommen. Ein Klick/Touch auf das Blitz Symbol bringt dich zurück zum Filesystem Manager.

Neu: Optionaler Zugriffsschutz mittels HTTP-Authentifizierung.

Optional kann auch noch ein mechanischer Taster zum manuellen Schalten angeschlossen werden.

Wer möchte kann sich unten den Code ansehen und selbst in Dateien kopieren oder aber das Ganze als Archiv downloaden.

Zeitschaltuhrsingel32.ino

// ****************************************************************
// Sketch Esp32 Webserver Modular(Tab)
// created: Jens Fleischer, 2018-07-06
// last mod: Jens Fleischer, 2024-03-06
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 2.0.6 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2018 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Der WebServer Tab ist der Haupt Tab mit "setup" und "loop".
// #include <LittleFS.h> und #include <WebServer.h> 
// müssen im Haupttab aufgerufen werden.
// "server.onNotFound()" darf nicht im Setup des ESP32 Webserver stehen.
// Inklusive Arduino OTA-Updates (Erfordert freien Flash-Speicher)
/**************************************************************************************/

#include <WebServer.h>
#include <ArduinoOTA.h>
#include <LittleFS.h>

WebServer server(80);

//#define DEBUGGING                                          // Einkommentieren für die Serielle Ausgabe.
constexpr bool PROTECT {0};                                  // HTML-Basisauthentifizierung aktivieren. (1 = aktiviert)
const char* www_username = "admin";                          // Die Anmeldeinformationen für HTML Seiten müssen im Browser eingegeben werden.
const char* www_password = "esp32";

#ifdef DEBUGGING
#define DEBUG_B(...) Serial.begin(__VA_ARGS__)
#define DEBUG_P(...) Serial.println(__VA_ARGS__)
#define DEBUG_F(...) Serial.printf(__VA_ARGS__)
#else
#define DEBUG_B(...)
#define DEBUG_P(...)
#define DEBUG_F(...)
#endif

void setup() {
  DEBUG_B(115200);
  delay(100);
  DEBUG_F("\nSketchname: %s\nBuild: %s\t\tIDE: %d.%d.%d\n\n",
          __FILE__, __TIMESTAMP__, ARDUINO / 10000, ARDUINO % 10000 / 100, ARDUINO % 100 / 10 ? ARDUINO % 100 : ARDUINO % 10);

  setupFS();
  connectWifi();
  admin();
  setupTime();
  setupTimerSwitch();
  setupHobbsMeter();
  ArduinoOTA.onStart([]() {
    toSave();                                                // vor dem Sketch Update Betriebsstunden in Datei schreiben
  });
  ArduinoOTA.begin();
  server.begin();
  DEBUG_P("HTTP Server gestartet\n\n");
}

void loop() {
  ArduinoOTA.handle();
  server.handleClient();
  if (millis() < 0x2FFF || millis() > 0xFFFFF0FF) runtime(); // Uptime für den Admin Tab
  localTime();                                               // Funktionsaufruf Uhrzeit aktualisieren
  timerSwitch();                                             // Funktionsaufruf Zeitschaltuhr
  sunRun();                                                  // Funktionsaufruf zur Berechnung der Dämmerungszeiten einmal Täglich
}

Admin.ino

// ****************************************************************
// Arduino IDE Tab Esp32 Admin Modular
// created: Jens Fleischer, 2021-05-01
// last mod: Jens Fleischer, 2023-11-12
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 1.0.6 - 2.0.14
// Geprüft: bei 4MB Flash
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2021 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Admin sollte als Tab eingebunden werden.
// #include <LittleFS.h> #include <WebServer.h> müssen im Haupttab aufgerufen werden
// Die Funktionalität des ESP32 Webservers ist erforderlich.
// Die LittleFS.ino muss im ESP32 Webserver enthalten sein
// Funktion "admin();" muss im setup() nach setupFS() und dem Verbindungsaufbau aufgerufen werden.
// Die Funktion "runtime();" muss mindestens zweimal innerhalb 49 Tage aufgerufen werden.
// Entweder durch den Client(Webseite) oder zur Sicherheit im "loop();"
/**************************************************************************************/

#include <rom/rtc.h>

const char* const PROGMEM flashChipMode[] = {"QIO", "QOUT", "DIO", "DOUT", "Unbekannt"};
const char* const PROGMEM resetReason[] = {"ERR", "Power on", "Unknown", "Software", "Watch dog", "Deep Sleep", "SLC module", "Timer Group 0", "Timer Group 1",
                                           "RTC Watch dog", "Instrusion", "Time Group CPU", "Software CPU", "RTC Watch dog CPU", "Extern CPU", "Voltage not stable", "RTC Watch dog RTC"
                                          };

void admin() {                          // Funktionsaufruf "admin();" muss im Setup eingebunden werden
  File file = LittleFS.open(existFolder("/Config") + "/config.json", FILE_READ);
  if (file) {
    String Hostname = file.readStringUntil('\n');
    if (Hostname != "") {
      WiFi.setHostname(Hostname.substring(2, Hostname.length() - 2).c_str());
      ArduinoOTA.setHostname(WiFi.getHostname());
    }
  }
  file.close();
  server.on("/admin/renew", handlerenew);
  server.on("/admin/once", handleonce);
  server.on("/reconnect", []() {
    server.send(304, "message/http");
    WiFi.reconnect();
  });
  server.on("/restart", []() {
    server.send(304, "message/http");
    toSave();          //Einkommentieren wenn Werte vor dem Neustart gesichert werden sollen
    ESP.restart();
  });
}

void handlerenew() {
  server.send(200, "application/json", R"([")" + runtime() + R"(",")" + temperatureRead() + R"(",")" + WiFi.RSSI() + R"("])");     // Json als Array
}

void handleonce() {
  if (server.arg(0) != "") {
    WiFi.setHostname(server.arg(0).c_str());
    File file = LittleFS.open(existFolder("/Config") + "/config.json", FILE_WRITE);
    file.printf("[\"%s\"]", WiFi.getHostname());
    file.close();
  }
  String fname = String(__FILE__).substring( 3, String(__FILE__).lastIndexOf ('\\'));
  String temp = R"({"File":")" + fname.substring(fname.lastIndexOf ('\\') + 1, fname.length()) + R"(", "Build":")" +  (String)__DATE__ + " " + (String)__TIME__ +
                R"(", "SketchSize":")" + formatBytes(ESP.getSketchSize()) + R"(", "SketchSpace":")" + formatBytes(ESP.getFreeSketchSpace()) +
                R"(", "LocalIP":")" +  WiFi.localIP().toString() + R"(", "Hostname":")" + WiFi.getHostname() + R"(", "SSID":")" + WiFi.SSID() +
                R"(", "GatewayIP":")" +  WiFi.gatewayIP().toString() +  R"(", "Channel":")" +  WiFi.channel() + R"(", "MacAddress":")" +  WiFi.macAddress() +
                R"(", "SubnetMask":")" +  WiFi.subnetMask().toString() + R"(", "BSSID":")" +  WiFi.BSSIDstr() + R"(", "ClientIP":")" + server.client().remoteIP().toString() +
                R"(", "DnsIP":")" + WiFi.dnsIP().toString() + R"(", "ChipModel":")" + ESP.getChipModel() + R"(", "Reset1":")" + resetReason[rtc_get_reset_reason(0)] +
                R"(", "Reset2":")" + resetReason[rtc_get_reset_reason(1)] + R"(", "CpuFreqMHz":")" + ESP.getCpuFreqMHz() + R"(", "HeapSize":")" + formatBytes(ESP.getHeapSize()) +
                R"(", "FreeHeap":")" + formatBytes(ESP.getFreeHeap()) + R"(", "MinFreeHeap":")" + formatBytes(ESP.getMinFreeHeap()) +
                R"(", "ChipSize":")" +  formatBytes(ESP.getFlashChipSize()) + R"(", "ChipSpeed":")" + ESP.getFlashChipSpeed() / 1000000 +
                R"(", "ChipMode":")" + flashChipMode[ESP.getFlashChipMode()] + R"(", "IdeVersion":")" + ARDUINO + R"(", "SdkVersion":")" + ESP.getSdkVersion() + R"("})";
  server.send(200, "application/json", temp);     // Json als Objekt
}

String runtime() {
  static uint8_t rolloverCounter;
  static uint32_t previousMillis;
  uint32_t currentMillis {millis()};
  if (currentMillis < previousMillis) {
    rolloverCounter++;                       // prüft Millis Überlauf
    DEBUG_P("Millis Überlauf");
  }
  previousMillis = currentMillis;
  uint32_t sec {(0xFFFFFFFF / 1000) * rolloverCounter + (currentMillis / 1000)};
  char buf[20];
  snprintf(buf, sizeof(buf), "%d Tag%s %02d:%02d:%02d", sec / 86400, sec < 86400 || sec >= 172800 ? "e" : "", sec / 3600 % 24, sec / 60 % 60, sec % 60);
  return buf;
}

In diesem Tab sind deine Wlan Zugangsdaten einzutragen.

Connect.ino

// ****************************************************************
// Arduino IDE Tab Esp32 Connect Modular mit optischer Anzeige
// created: Jens Fleischer, 2018-07-06
// last mod: Jens Fleischer, 2020-03-26
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 1.0.0 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2018 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Connect sollte als Tab eingebunden werden.
// #include <WebServer.h> muss im Haupttab aufgerufen werden
// Die Funktionalität des ESP32 Webservers ist erforderlich.
// Die Funktion "connectWifi();" muss im Setup eingebunden werden.
/**************************************************************************************/

const char* ssid = "Netzwerkname";               // << kann bis zu 32 Zeichen haben
const char*password = "PasswortvomNetzwerk";     // << mindestens 8 Zeichen jedoch nicht länger als 64 Zeichen

void connectWifi() {                             // Funktionsaufruf "connectWifi();" muss im Setup nach "setupFS();" eingebunden werden
  pinMode(LED_BUILTIN, OUTPUT);                  // OnBoardLed ESP32 Dev Module
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    digitalWrite(LED_BUILTIN, 1);
    delay(250);
    digitalWrite(LED_BUILTIN, 0);
    delay(250);
    DEBUG_F(".");
    if (millis() > 10000) {
      DEBUG_P("\nVerbindung zum AP fehlgeschlagen\n\n");
      ESP.restart();
    }
  }
  DEBUG_P("\nVerbunden mit: " + WiFi.SSID());
  DEBUG_P("Esp32 IP: " + WiFi.localIP().toString() + "\n");
}

LittleFS.ino


// ****************************************************************
// Arduino IDE Tab Esp32 Filesystem Manager spezifisch sortiert Modular
// created: Jens Fleischer, 2023-03-26
// last mod: Jens Fleischer, 2024-03-06
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 2.0.6 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2023 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von LittleFS sollte als Tab eingebunden werden.
// #include <LittleFS.h> #include <WebServer.h> müssen im Haupttab aufgerufen werden
// Die Funktionalität des ESP32 Webservers ist erforderlich.
// "server.onNotFound()" darf nicht im Setup des ESP32 Webserver stehen.
// Die Funktion "setupFS();" muss im Setup aufgerufen werden.
/**************************************************************************************/

#include <detail/RequestHandlersImpl.h>
#include <list>
#include <tuple>

const char WARNING[] PROGMEM = R"(<h2>LittleFS konnte nicht initialisiert werden!)";
const char HELPER[] PROGMEM = R"(<form method="POST" action="/upload" enctype="multipart/form-data">
                                <input type="file" name="[]" multiple><button>Upload</button></form>Lade die fs.html hoch.)";

void setupFS() {                                                                           // Funktionsaufruf "setupFS();" muss im Setup eingebunden werden
  LittleFS.begin(true);
  server.on("/format", formatFS);
  server.on("/upload", HTTP_POST, sendResponce, handleUpload);
  server.onNotFound([](String path = server.urlDecode(server.uri())) {
    if (!handleFile(path)) server.send(404, "text/html", "Not Found: " + path);
  });
}

bool handleList() {                                                                        // Senden aller Daten an den Client
  File root = LittleFS.open("/");
  using namespace std;
  using records = tuple<String, String, int>;
  list<records> dirList;
  while (File f = root.openNextFile()) {                                                   // Ordner und Dateien zur Liste hinzufügen
    if (f.isDirectory()) {
      uint8_t ran {0};
      File fold = LittleFS.open(static_cast<String>("/") + f.name());
      while (File f = fold.openNextFile()) {
        ran++;
        dirList.emplace_back(fold.name(), f.name(), f.size());
      }
      if (!ran) dirList.emplace_back(fold.name(), "", 0);
    }
    else {
      dirList.emplace_back("", f.name(), f.size());
    }
  }
  dirList.sort([](const records & f, const records & l) {                                  // Dateien sortieren
    if (server.arg(0) == "1") {
      return get<2>(f) > get<2>(l);
    } else {
      for (uint8_t i = 0; i < 31; i++) {
        if (tolower(get<1>(f)[i]) < tolower(get<1>(l)[i])) return true;
        else if (tolower(get<1>(f)[i]) > tolower(get<1>(l)[i])) return false;
      }
      return false;
    }
  });
  dirList.sort([](const records & f, const records & l) {                                  // Ordner sortieren
    if (get<0>(f)[0] != 0x00 || get<0>(l)[0] != 0x00) {
      for (uint8_t i = 0; i < 31; i++) {
        if (tolower(get<0>(f)[i]) < tolower(get<0>(l)[i])) return true;
        else if (tolower(get<0>(f)[i]) > tolower(get<0>(l)[i])) return false;
      }
    }
    return false;
  });
  String temp = "[";
  for (auto& t : dirList) {
    if (temp != "[") temp += ',';
    temp += "{\"folder\":\"" + get<0>(t) + "\",\"name\":\"" + get<1>(t) + "\",\"size\":\"" + formatBytes(get<2>(t)) + "\"}";
  }
  temp += ",{\"usedBytes\":\"" + formatBytes(LittleFS.usedBytes()) +                       // Berechnet den verwendeten Speicherplatz
          "\",\"totalBytes\":\"" + formatBytes(LittleFS.totalBytes()) +                    // Zeigt die Größe des Speichers
          "\",\"freeBytes\":\"" + (LittleFS.totalBytes() - LittleFS.usedBytes()) + "\"}]"; // Berechnet den freien Speicherplatz
  server.send(200, "application/json", temp);
  return true;
}

void deleteFiles(const String &path) {
  DEBUG_F("delete: %s\n", path.c_str());
  if (!LittleFS.remove("/" + path)) {
    File root = LittleFS.open(path);
    while (String filename = root.getNextFileName()) {
      LittleFS.remove(filename);
      LittleFS.rmdir(path);
      if (filename.length() < 1) break;
    }
  }
}

bool handleFile(String &path) {
  if (!LittleFS.exists("/fs.html")) server.send(200, "text/html", LittleFS.begin(true) ? HELPER : WARNING);   // ermöglicht das hochladen der fs.html
  if (!(PROTECT && !authenticated())) {
    if (server.hasArg("new")) {
      String folderName {server.arg("new")};
      for (auto& c : {34, 37, 38, 47, 58, 59, 92}) for (auto& e : folderName) if (e == c) e = 95;   // Ersetzen der nicht erlaubten Zeichen
      DEBUG_F("Creating Dir: %s\n", folderName.c_str());
      LittleFS.mkdir("/" + folderName);
    }
    if (server.hasArg("sort")) return handleList();
    if (server.hasArg("delete")) {
      deleteFiles(server.arg("delete"));
      sendResponce();
      return true;
    }
    if (path.endsWith("/")) path += "index.html";
    File f = LittleFS.open(path);
    return LittleFS.exists(path) ? server.streamFile(f, StaticRequestHandler::getContentType(path)) : false;
  }
  return false;
}

void handleUpload() {                                                                      // Dateien ins Filesystem schreiben
  static File fsUploadFile;
  HTTPUpload& upload = server.upload();
  if (upload.status == UPLOAD_FILE_START) {
    if (upload.filename.length() > 31) {  // Dateinamen kürzen
      upload.filename = upload.filename.substring(upload.filename.length() - 31, upload.filename.length());
    }
    DEBUG_F("handleFileUpload Name: /%s\n", upload.filename.c_str());
    fsUploadFile = LittleFS.open("/" + server.arg(0) + "/" + server.urlDecode(upload.filename), "w");
  } else if (upload.status == UPLOAD_FILE_WRITE) {
    DEBUG_F("handleFileUpload Data: %u\n", upload.currentSize);
    fsUploadFile.write(upload.buf, upload.currentSize);
  } else if (upload.status == UPLOAD_FILE_END) {
    DEBUG_F("handleFileUpload Size: %u\n", upload.totalSize);
    fsUploadFile.close();
  }
}

void formatFS() {                                                                          // Formatiert das Filesystem
  LittleFS.format();
  sendResponce();
}

void sendResponce() {
  server.sendHeader("Location", "fs.html");
  server.send(303, "message/http");
}

const String formatBytes(size_t const & bytes) {                                           // lesbare Anzeige der Speichergrößen
  return bytes < 1024 ? static_cast<String>(bytes) + " Byte" : bytes < 1048576 ? static_cast<String>(bytes / 1024.0) + " KB" : static_cast<String>(bytes / 1048576.0) + " MB";
}

String existFolder( String const & folderName) {
  if (!LittleFS.exists(folderName)) LittleFS.mkdir(folderName);
  return folderName;
}

bool authenticated() {
  if (server.authenticate(www_username, www_password)) return true;
  server.requestAuthentication(DIGEST_AUTH, "Anmeldung erforderlich", "Authentifizierung fehlgeschlagen!");
  return false;
}

Lokalzeit.ino

// ****************************************************************
// Arduino IDE Tab Esp32 Lokalzeit Modular
// created: Jens Fleischer, 2024-03-02
// last mod: Jens Fleischer, 2024-03-06
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 2.0.6 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2024 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Lokalzeit sollte als Tab eingebunden werden.
// #include <WebServer.h> oder #include <WiFi.h> muss im Haupttab aufgerufen werden
// Funktion "setupTime();" muss im setup() nach dem Verbindungsaufbau aufgerufen werden.
/**************************************************************************************/

#include "time.h"
#include "esp_sntp.h"

struct tm tm;

const char* const PROGMEM ntpServer[] = {"fritz.box", "de.pool.ntp.org", "at.pool.ntp.org", "ch.pool.ntp.org", "ptbtime1.ptb.de", "europe.pool.ntp.org"};
const char* const PROGMEM monthShortNames[] = {"Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"};

void setupTime() {
  sntp_set_time_sync_notification_cb([](struct timeval * t) {
    DEBUG_P("********* Zeitstempel vom NTP Server erhalten! *********");
  });
  configTzTime("CET-1CEST,M3.5.0/02,M10.5.0/03", ntpServer[1]);    // deinen NTP Server einstellen (von 0 - 5 aus obiger Liste)
}

char* localTime() {
  static char buf[10];                                             // je nach Format von "strftime" eventuell die Größe anpassen
  getLocalTime(&tm);
  strftime (buf, sizeof(buf), "%T", &tm);                          // http://www.cplusplus.com/reference/ctime/strftime/
  return buf;
}

In diesem Tab einstellen ob dein Device LOW oder HIGH aktiv geschaltet wird.
Und die Anzahl der Schaltzeiten einstellen. (1 bis 100).

Schaltuhr.ino

// ****************************************************************
// Arduino IDE Tab Esp32 Schaltuhr Modular
// created: Jens Fleischer, 2020-09-05
// last mod: Jens Fleischer, 2024-03-06
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32, Relais Modul o. Mosfet IRF3708 o. Fotek SSR-40 DA
// für Relais Modul
// GND an GND
// IN an T7 = GPIO 27
// VCC an VIN -> je nach verwendeten Esp.. möglich
// Jumper JD-VCC VCC
// alternativ ext. 5V Netzteil verwenden
//
// für Mosfet IRF3708
// Source an GND
// Mosfet Gate an T7 = GPIO 27
//
// für 3V Solid State Relais
// GND an GND
// SSR Input + an T7 = GPIO 27
//
// Software: Esp32 Arduino Core 2.0.6 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2020 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Zeitschaltuhr sollte als Tab eingebunden werden.
// #include <LittleFS.h> #include <WebServer.h> müssen im Haupttab aufgerufen werden
// Die Funktionalität des ESP32 Webservers ist erforderlich.
// Der Lokalzeit Tab ist zum ausführen der Zeitschaltuhr einzubinden.
// Die Funktion "setupTimerSwitch();" muss im Setup aufgerufen werden.
// Zum schalten muss die Funktion "timerSwitch();" im loop(); aufgerufen werden.
/**************************************************************************************/

#include <tuple>
#include <vector>

constexpr auto ACTIVE = LOW;                                             // LOW für LOW aktive Relais oder HIGH für HIGH aktive (zB. SSR, Mosfet) einstellen
constexpr uint8_t DEVICE_PIN = T7;                                       // Pin für Device einstellen
constexpr uint8_t RECORDS = 20;                                          // Anzahl Schaltzeiten festlegen 1 - 100
bool pinState {!ACTIVE};

typedef char timeArr[6];
timeArr sunTime[4];

using namespace std;
using Subset = tuple<bool, uint8_t, String, String>;
vector<Subset> device;

struct extra {
  uint8_t sun;
  bool fixed;
} option;

void setupTimerSwitch() {
  digitalWrite(DEVICE_PIN, !ACTIVE);
  pinMode(DEVICE_PIN, OUTPUT);
  device.reserve(RECORDS);
  Subset t = make_tuple(1, 127, "", "");
  File file = LittleFS.open(existFolder("/Config") + "/stime.dat");
  if (file) {                                                            // Einlesen aller Daten falls die Datei im LittleFS vorhanden und deren Größe stimmt.
    file.read(reinterpret_cast<uint8_t*>(&option), sizeof(option));
    for (uint8_t i = 0; i < device.capacity(); i++) {
      file.read(reinterpret_cast<uint8_t*>(&t), sizeof(Subset));
      device.emplace_back(t);
    }
    file.close();
#ifdef DEBUGGING
    uint8_t j = 0;
    for (const auto &e : device) DEBUG_F(PSTR("Subset %d: %d, %d, %s, %s\n"), ++j, get<0>(e), get<1>(e), get<2>(e).c_str(), get<3>(e).c_str());
#endif
  }
  else {
    DEBUG_P(F("Die \"stime.dat\" ist nicht vorhanden!"));
    for (uint8_t i = 0; i < device.capacity(); i++) device.push_back(t);
  }
  DEBUG_F(PSTR("\nZeitschaltuhr Automatik %saktiviert\n\n"), option.fixed ? "de" : "");
  server.on("/timer", HTTP_POST, []() {
    if (server.hasArg("dTime")) {
      device.clear();
      Subset t = make_tuple(0, 0, "", "");
      char str[server.arg("dTime").length()];
      strcpy (str, server.arg("dTime").c_str());
      char* ptr = strtok(str, "[\"");
      for (auto i = 0; ptr != NULL; i++, i %= 4) {
        if (strcmp(ptr, ",")) {
          if (i == 0) {
            get<0>(t) = atoi(ptr);
          }
          else if (i == 1) {
            get<1>(t) = atoi(ptr);
          }
          else if (i == 2) {
            get<2>(t) = static_cast<String>(ptr);
          }
          else if (i == 3) {
            get<3>(t) = static_cast<String>(ptr);
            device.emplace_back(t);
          }
        }
        ptr = strtok(NULL, "\",[]");
      }
      printer();
    }
    String temp = "[";
    for (auto &t : device) {
      temp == "[" ? temp += "[" : temp += ",[";
      temp += "\"" + static_cast<String>(get<0>(t)) + "\",";
      temp += "\"" + static_cast<String>(get<1>(t)) + "\",";
      temp += "\"" + get<2>(t) + "\",";
      temp += "\"" + get<3>(t) + "\"]";
    }
    temp += "]";
    server.send(200, "application/json", temp);
  });
  server.on("/timer", HTTP_GET, []() {
    char buf[44];
    if (server.arg(0) == "tog") {
      pinState = !pinState;                                              // Pin Status manuell ändern
      timeDataLogger(ACTIVE, pinState, server.client().remoteIP().toString());   // Funktionsaufruf Zeitdatenlogger
    }
    else if (server.arg(0) == "fix") {
      option.fixed = !option.fixed;                                      // alle Schalzeiten deaktivieren/aktivieren
      printer();
    }
    if (server.arg(0) == "sun") {
      if (server.hasArg("select")) {
        option.sun = server.arg(1).toInt();
        printer();
      }
      snprintf(buf, sizeof(buf), "[[\"%s\",\"%s\",\"%s\",\"%s\"],[\"%d\"]]", sunTime[0], sunTime[1], sunTime[2], sunTime[3], option.sun);
    }
    else {
      snprintf(buf, sizeof(buf), "[\"%d\",\"%s\",\"%d\"]", pinState == ACTIVE, localTime(), option.fixed);
    }
    server.send(200, "application/json", buf);
  });
}

void printer() {
  File file = LittleFS.open(existFolder("/Config") + "/stime.dat", "w");
  if (file) {
    file.write(reinterpret_cast<const uint8_t*>(&option), sizeof(option));
    for (const auto &e : device) {
      file.write(reinterpret_cast<const uint8_t*>(&e), sizeof(e));
    }
    file.close();
  }
}

void timerSwitch() {
  static uint8_t lastmin {CHAR_MAX}, lastState {ACTIVE};
  hobbsMeter(pinState);                                                  // Funktionsaufruf Betriebsstundenzähler mit Pin Status
  button(pinState);                                                      // Funktionsaufruf Manueller Taster mit Pin Status
  timeDataLogger(ACTIVE, pinState, "Taster");                            // Funktionsaufruf Zeitdatenlogger
  if (tm.tm_min != lastmin && !option.fixed) {
    lastmin = tm.tm_min;
    char buf[6];
    sprintf(buf, "%.2d:%.2d", tm.tm_hour, tm.tm_min);
    for (auto &t : device) {
      if (get<0>(t) && (get<1>(t) & (1 << (tm.tm_wday ? tm.tm_wday - 1 : 6)))) {
        if (!get<2>(t).compareTo(buf)) pinState = ACTIVE;
        if (!get<3>(t).compareTo(buf)) pinState = !ACTIVE;
      }
    }
    for (auto i = 0; i < 4; i++) {
      if (!strcmp(sunTime[i], buf)) {                                    // Pin Status zum Sonnenstand ändern
        if (option.sun & (1 << i * 2)) pinState = !ACTIVE;
        if (option.sun & (1 << (i * 2 + 1))) pinState = ACTIVE;
      }
    }
    timeDataLogger(ACTIVE, pinState, "Programm");                        // Funktionsaufruf Zeitdatenlogger
  }
  if (pinState != lastState) {                                           // Pin schalten wenn sich der Status geändert hat
    lastState = pinState;
    digitalWrite(DEVICE_PIN, pinState);
    DEBUG_F(PSTR("Schaltausgang A%s\n"), digitalRead(DEVICE_PIN) == ACTIVE ? "n" : "us");
  }
}

In diesem Tab den Längen- und Breitengrad deines Standortes angeben.

Sonnenlauf.ino

// ****************************************************************
// Arduino IDE Tab Esp32 Sonnenlauf Modular
// source: https://lexikon.astronomie.info/zeitgleichung/neu.html
// created: Jens Fleischer, 2018-12-29
// last mod: Jens Fleischer, 2024-03-02
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 2.0.6 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2018 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Sonnenlauf sollte als Tab eingebunden werden.
// Der Lokalzeit Tab (bzw. "struct tm") ist zum ausführen erforderlich.
// Gib zunächst den Längen- und Breitengrad deines Ortes an.
// https://www.laengengrad-breitengrad.de/
/**************************************************************************************/

constexpr double LONGITUDE = 12.473173;         // Geographische Länge
constexpr double LATITUDE = 51.017669;          // Geographische Breite

void sunRun() {
  static uint8_t lastday, lastdst;
  if (tm.tm_mday != lastday || tm.tm_isdst != lastdst) {    // Sonnenlauf für Tage mit Zeitumstellung zweimal Täglich berechnen
    lastday = tm.tm_mday;
    lastdst = tm.tm_isdst;
    const double w = LATITUDE * DEG_TO_RAD;
    double JD = julianDate(1900 + tm.tm_year, 1 + tm.tm_mon, tm.tm_mday);
    double T = (JD - 2451545.0) / 36525.0;
    double DK;
    double EOT = calculateEOT(DK, T);
    double h = -0.833333333333333 * DEG_TO_RAD; // Sonenaufgang/Sonnenuntergang
    double differenceTime = 12.0 * acos((sin(h) - sin(w) * sin(DK)) / (cos(w) * cos(DK))) / PI;
    strcpy(sunTime[1], outputFormat((12.0 - differenceTime - EOT) - LONGITUDE / 15.0 + (_timezone * -1) / 3600 + tm.tm_isdst));
    strcpy(sunTime[2], outputFormat((12.0 + differenceTime - EOT) - LONGITUDE / 15.0 + (_timezone * -1) / 3600 + tm.tm_isdst));
    h = -6.0 * DEG_TO_RAD;                      // Bürgerliche Dämmerung
    differenceTime = 12.0 * acos((sin(h) - sin(w) * sin(DK)) / (cos(w) * cos(DK))) / PI;
    strcpy(sunTime[0], outputFormat((12.0 - differenceTime - EOT) - LONGITUDE / 15.0 + (_timezone * -1) / 3600 + tm.tm_isdst));
    strcpy(sunTime[3], outputFormat((12.0 + differenceTime - EOT) - LONGITUDE / 15.0 + (_timezone * -1) / 3600 + tm.tm_isdst));
    DEBUG_F(PSTR("\nMorgendämmerung: %s\tAbenddämmerung: %s\nSonnenaufgang: %s\tSonnenuntergang: %s\n"), sunTime[0], sunTime[3], sunTime[1], sunTime[2]);
  }
}

double julianDate (int y, int m, int d) {       // Gregorianischer Kalender
  if (m <= 2) {
    m = m + 12;
    y = y - 1;
  }
  int gregorian = (y / 400) - (y / 100) + (y / 4); // Gregorianischer Kalender
  return 2400000.5 + 365.0 * y - 679004.0 + gregorian + (30.6001 * (m + 1)) + d + 12.0 / 24.0;
}

double InPi(double x) {
  int n = x / TWO_PI;
  x = x - n * TWO_PI;
  if (x < 0) x += TWO_PI;
  return x;
}

double calculateEOT(double &DK, double T) {
  double RAm = 18.71506921 + 2400.0513369 * T + (2.5862e-5 - 1.72e-9 * T) * T * T;
  double M  = InPi(TWO_PI * (0.993133 + 99.997361 * T));
  double L  = InPi(TWO_PI * (  0.7859453 + M / TWO_PI + (6893.0 * sin(M) + 72.0 * sin(2.0 * M) + 6191.2 * T) / 1296.0e3));
  double e = DEG_TO_RAD * (23.43929111 + (-46.8150 * T - 0.00059 * T * T + 0.001813 * T * T * T) / 3600.0);    // Neigung der Erdachse
  double RA = atan(tan(L) * cos(e));
  if (RA < 0.0) RA += PI;
  if (L > PI) RA += PI;
  RA = 24.0 * RA / TWO_PI;
  DK = asin(sin(e) * sin(L));
  RAm = 24.0 * InPi(TWO_PI * RAm / 24.0) / TWO_PI;
  double dRA = RAm - RA;
  if (dRA < -12.0) dRA += 24.0;
  if (dRA > 12.0) dRA -= 24.0;
  dRA = dRA * 1.0027379;
  return dRA ;
}

char* outputFormat(double sunTime) {
  if (sunTime < 0) sunTime += 24;
  else if (sunTime >= 24) sunTime -= 24;
  int8_t decimal = 60 * (sunTime - static_cast<int>(sunTime)) + 0.5;
  int8_t predecimal = sunTime;
  if (decimal >= 60) {
    decimal -= 60;
    predecimal++;
  }
  else if (decimal < 0) {
    decimal += 60;
    predecimal--;
    if (predecimal < 0) predecimal += 24;
  }
  static char buf[9];
  snprintf(buf, sizeof(buf), "%.2d:%.2d", predecimal, decimal);
  return buf;
}

Stundenzaehler.ino

// ****************************************************************
// Arduino IDE Tab Esp32 Betriebsstundenzähler Modular
// created: Jens Fleischer, 2020-09-05
// last mod: Jens Fleischer, 2024-03-06
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 1.0.0 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2020 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Betriebsstundenzähler sollte als Tab eingebunden werden.
// #include <LittleFS.h> #include <WebServer.h> müssen im Haupttab aufgerufen werden
// Die Funktionalität des ESP32 Webservers ist erforderlich.
// Der LittleFS Tab ist zum ausführen des Betriebsstundenzähler einzubinden.
// Die Funktion "setupHobbsMeter();" muss im Setup aufgerufen werden.
/**************************************************************************************/

uint32_t totalmin;
uint16_t watt;

void setupHobbsMeter() {
  File file = LittleFS.open(existFolder("/Config") + "/hobbs.json");        // Betriebstunden(minuten) beim Neustart einlesen
  if (file) {
    char buf[file.size()];
    file.readBytes(buf, sizeof buf);
    totalmin = atoi(strtok(buf, "{\":runtime"));
    watt = atoi(strtok(NULL, "\":,wattage"));
    file.close();
  }
  server.on("/hobbs", HTTP_GET, []() {
    uint32_t power;
    if (server.argName(0) == "watt") {
      watt = server.arg(0).toInt();
      toSave();
    }
    if (server.argName(0) == "reset") {
      totalmin = 0;                                                         // Betriebsstundenzähler zurücksetzen
      toSave();
    }
    power = (watt * totalmin) / 6000;
    char buf[34];
    snprintf(buf, sizeof(buf), PSTR("[\"%d,%d\",\"%d\",\"%d,%d\"]"), totalmin / 60, totalmin / 6 % 10, watt, power / 10, power % 10);
    server.send(200, "application/json", buf);
  });
}

void hobbsMeter(const bool &state) {                                        // Aufrufen mit Pin Status
  static uint32_t lastmin, previousMillis[] {0, 0};
  uint32_t currentMillis {millis()};
  if (currentMillis - previousMillis[0] >= 6e4) {
    previousMillis[0] = currentMillis;
    if (state == ACTIVE) totalmin++;                                        // Betriebstundenzähler des Gerätes wird um eine Minute erhöht
  }
  if (currentMillis - previousMillis[1] >= 864e5 && totalmin != lastmin) {  // einmal am Tage Betriebsstunden in Datei schreiben wenn sich der Wert geändert hat
    previousMillis[1] = currentMillis;
    lastmin = totalmin;
    toSave();
  }
}

void toSave() {
  File file = LittleFS.open(existFolder("/Config") + "/hobbs.json", "w");    // Betriebstunden(minuten) speichern
  if (file) {
    file.printf(R"({"runtime":"%u","wattage":"%d"})", totalmin, watt);
    file.close();
  }
}

Ein Taster kann optional angeschlossen werden.

Taster.ino

// ****************************************************************
// Arduino IDE Tab Esp32 Zeitschaltuhr Taster Modular
// created: Jens Fleischer, 2020-09-05
// last mod: Jens Fleischer, 2020-09-05
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// T9 = GPIO 32  Anschluss Taster vom T9 auf GND
// Software: Esp32 Arduino Core 1.0.0 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2020 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Zeitschaltuhr Taster sollte als Tab eingebunden werden.
// Die Funktion "button(pinState);" muss in "timerSwitch();" aufgerufen werden.
/**************************************************************************************/

constexpr uint8_t inputPIN {T9};                    // Pin für Taster einstellen

void button(bool &state) {                          // Aufrufen mit Pin Status
  pinMode(inputPIN, INPUT_PULLUP);                  // oder 10k Pullup-Widerstand von VCC zum inputPIN
  static bool previousStatus {0};
  static uint32_t debounceMillis;
  uint32_t currentMillis {millis()};
  if (currentMillis - debounceMillis >= 50) {       // 50 ms Taster Entprellzeit
    debounceMillis = currentMillis;
    bool currentStatus = digitalRead(inputPIN);
    if (!currentStatus && currentStatus != previousStatus) {
      state = !state;                               // Status toggeln
    }
    previousStatus = currentStatus;
  }
}

Zeitenlogger.ino

// ****************************************************************
// Arduino IDE Tab Esp32 Zeitdatenlogger Modular
// created: Jens Fleischer, 2024-03-02
// last mod: Jens Fleischer, 2024-03-02
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp32
// Software: Esp32 Arduino Core 2.0.6 - 2.0.14
// Getestet auf: ESP32 NodeMCU-32s
/******************************************************************
  Copyright (c) 2024 Jens Fleischer. All rights reserved.

  This file is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This file is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Ereignisdatenspeicher sollte als Tab eingebunden werden.
// #include <LittleFS.h> muss im Haupttab aufgerufen werden
// Der Lokalzeit Tab ist zum ausführen des Zeitdatenlogger erforderlich.
// Der LittleFS Tab ist zum ausführen erforderlich.
/**************************************************************************************/

void timeDataLogger(const bool ACTIVE, const bool &state, const String &customer) {  // Ereignisauslöser
  static bool lastState {!ACTIVE};
  if (state != lastState) {                                                          // Prüft ob sich der Pin Status geändert hat.
    char fileName[18];
    snprintf(fileName, sizeof(fileName), "/%d_%s.csv", 1900 + tm.tm_year, monthShortNames[tm.tm_mon]);
    if (!LittleFS.exists(existFolder("/Data") + fileName)) {                         // Logdatei für den aktuellen Monat anlegen falls nicht vorhanden.
      File f = LittleFS.open(existFolder("/Data") + fileName, "a");
      if (f) {
        f.printf("%s;An;Initiator;Aus;Initiator\n", monthShortNames[tm.tm_mon]);     // Kopfzeile schreiben
      }
      f.close();
    }
    File f = LittleFS.open(existFolder("/Data") + fileName, "a");                    // Die Ereignisdaten für den aktuellen Monat speichern
    if (f) {
      state == ACTIVE ? f.printf("%d.;%s;%s;", tm.tm_mday, localTime(), customer.c_str()) : f.printf("%s;%s;\n", localTime(), customer.c_str());
    }
    f.close();
  }
  lastState = state;                                                                 // Ersetzt den letzten Status durch den aktuellen Status.
}

admin.html

<!DOCTYPE HTML> <!-- For more information visit: https://fipsok.de -->
<html lang="de">
  <head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="style32.css">
	<title>ESP32 Admin</title>
	<SCRIPT>
	  window.addEventListener('load', () => {
		renew(), once();
		document.querySelector('#fs').addEventListener('click', () => {
		  window.location = '/fs.html';
		});
		document.querySelector('#home').addEventListener('click', () => {
		  window.location = '/';
		});
		document.querySelector('#restart').addEventListener('click', () => {
		  if (confirm('Bist du sicher!')) re('restart');
		});
		document.querySelector('#reconnect').addEventListener('click', re.bind(this, 'reconnect'));
		document.querySelector('#hostbutton').addEventListener('click', check.bind(this, document.querySelector('input')));
		var output = document.querySelector('#note');
		async function once(arg1, arg2) {
		  try {
			let resp = await fetch('/admin/once', { method: 'POST', body: arg1});
			let obj = await resp.json();
			output.innerHTML = '';
			output.classList.remove('note');
			document.querySelector('form').reset();
			if (arg1 == undefined) wait = window.setInterval(renew, 1000);
			if (arg2 == 'reconnect') re(arg2);
			document.querySelector('#file').innerHTML = obj['File'];
			document.querySelector('#build').innerHTML = obj['Build'];
			document.querySelector('#sketchsize').innerHTML = obj['SketchSize'];
			document.querySelector('#sketchspace').innerHTML = obj['SketchSpace'];
			document.querySelector('#local').innerHTML = obj['LocalIP'];
			document.querySelector('#host').innerHTML = obj['Hostname'];
			document.querySelector('#ssid').innerHTML = obj['SSID'];
			document.querySelector('#gateway').innerHTML = obj['GatewayIP'];
			document.querySelector('#kanal').innerHTML = obj['Channel'];
			document.querySelector('#mac').innerHTML = obj['MacAddress'];
			document.querySelector('#subnet').innerHTML = obj['SubnetMask'];
			document.querySelector('#bss').innerHTML = obj['BSSID'];
			document.querySelector('#client').innerHTML = obj['ClientIP'];
			document.querySelector('#dns').innerHTML = obj['DnsIP'];
			document.querySelector('#chip').innerHTML = obj['ChipModel'];
			document.querySelector('#reset1').innerHTML = obj['Reset1'];
			document.querySelector('#reset2').innerHTML = obj['Reset2'];
			document.querySelector('#cpufreq').innerHTML = obj['CpuFreqMHz'] + ' MHz';
			document.querySelector('#heapsize').innerHTML = obj['HeapSize'];
			document.querySelector('#freeheap').innerHTML = obj['FreeHeap'];
			document.querySelector('#minfreeheap').innerHTML = obj['MinFreeHeap'];
			document.querySelector('#csize').innerHTML = obj['ChipSize'];
			document.querySelector('#cspeed').innerHTML = obj['ChipSpeed'] + ' MHz';
			document.querySelector('#cmode').innerHTML = obj['ChipMode'];
			document.querySelector('#ide').innerHTML = obj['IdeVersion'].replace(/(\d)(\d)(\d)(\d)/,obj['IdeVersion'][3]!=0 ? '$1.$3.$4' : '$1.$3.');
			document.querySelector('#sdk').innerHTML = obj['SdkVersion'];
		  } catch(err) {
			re();
		  }
		}
		async function renew() {
		  const resp = await fetch('admin/renew');
		  const array = await resp.json();
		  document.querySelector('#runtime').innerHTML = array[0];
		  document.querySelector('#temp').innerHTML = array[1] + ' °C';
		  document.querySelector('#rssi').innerHTML = array[2] + ' dBm';
		}
		function check(inObj) {
		  !inObj.checkValidity() ? (output.innerHTML = inObj.validationMessage, output.classList.add('note')) : (once(inObj.value, 'reconnect'));
		}
		function re(arg) {
		  window.clearInterval(wait);
		  fetch(arg);
		  output.classList.add('note');
		  if (arg == 'restart') {
			output.innerHTML = 'Der Server wird neu gestartet. Die Daten werden in 10 Sekunden neu geladen.';
			setTimeout(once, 10000);
		  } else if (arg == 'reconnect') {
			output.innerHTML = 'Die WiFi Verbindung wird neu gestartet. Daten werden in 5 Sekunden neu geladen.';
			setTimeout(once, 5000);
		  } else {
			output.innerHTML = 'Es ist ein Verbindungfehler aufgetreten. Es wird versucht neu zu verbinden.';
			setTimeout(once, 2000);
		  }
		}
	  });
	</SCRIPT>
  </head>
  <body>
	<h1>ESP32 Admin Page</h1>
	<main>
	  <aside id="left">
		<span>Runtime ESP:</span>
		<span>WiFi RSSI:</span>
		<span>CPU Temperatur:</span>
		<span>Sketch Name:</span>
		<span>Sketch Build:</span>
		<span>Sketch Size:</span>
		<span>Free Sketch Space:</span>
		<span>IP Address:</span>
		<span>Hostname:</span>
		<span>Connected to:</span>
		<span>Gateway IP:</span>
		<span>Channel:</span>
		<span>Mac Address:</span>
		<span>Subnet Mask:</span>
		<span>BSSID:</span>
		<span>Client IP:</span>
		<span>Dns IP:</span>
		<span>Chip Model:</span>
		<span>Reset CPU 1:</span>
		<span>Reset CPU 2:</span>
		<span>CPU Freq:</span>
		<span>Heap Size:</span>
		<span>Free Heap:</span>
		<span>Min Free Heap:</span>
		<span>Flash Size:</span>
		<span>Flash Speed:</span>
		<span>Flash Mode:</span>
		<span>Arduino IDE Version:</span>
		<span>SDK Version:</span>
	  </aside>
	  <aside>
		<span id="runtime">0</span>
		<span id="rssi">0</span>
		<span id="temp">0</span>
		<span id="file">?</span>
		<span id="build">0</span>
		<span id="sketchsize">0</span>
		<span id="sketchspace">0</span>
		<span id="local">0</span>
		<span id="host">?</span>
		<span id="ssid">?</span>
		<span id="gateway">0</span>
		<span id="kanal">0</span>
		<span id="mac">0</span>
		<span id="subnet">0</span>
		<span id="bss">0</span>
		<span id="client">0</span>
		<span id="dns">0</span>
		<span id="chip">?</span>
		<span id="reset1">0</span>
		<span id="reset2">0</span>
		<span id="cpufreq">0</span>
		<span id="heapsize">0</span>
		<span id="freeheap">0</span>
		<span id="minfreeheap">0</span>
		<span id="csize">0</span>
		<span id="cspeed">0</span>
		<span id="cmode">0</span>
		<span id="ide">0</span>
		<span id="sdk">0</span>
	  </aside>
	</main>
	<div>
	  <button class="button" id="fs">Filesystem</button>
	  <button class="button" id="home">Startseite</button>
	</div>
	<div id="note"></div>
	<div>
	  <form><input placeholder=" neuer Hostname" pattern="([A-Za-z0-9\-]{1,32})" title="Es dürfen nur Buchstaben (a-z, A-Z), Ziffern (0-9) und Bindestriche (-) enthalten sein. Maximal 32 Zeichen" required>
		<button class="button" type="button" id="hostbutton">Name Senden</button>
	  </form>
	</div>
	<div>
	  <button class="button" id="reconnect">WiFi Reconnect</button>
	  <button class="button" id="restart">ESP Restart</button>
	</div>
  </body>
</html>
fs.html

<!DOCTYPE HTML> <!-- For more information visit: https://fipsok.de -->
<html lang="de">
  <head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="style32.css">
	<title>Filesystem Manager</title>
	<script>
	  document.addEventListener('DOMContentLoaded', () => {
		list(JSON.parse(localStorage.getItem('sortBy')));
		btn.addEventListener('click', () => {
		  if (!confirm(`Wirklich formatieren? Alle Daten gehen verloren.\nDu musst anschließend fs.html wieder laden.`)) event.preventDefault();
		});
	  });
	  function list(to){
		let myList = document.querySelector('main'), noted = '';
		fetch(`?sort=${to}`).then( (response) => {
          return response.json();
        }).then((json) => {
		  myList.innerHTML = '<nav><input type="radio" id="/" name="group" checked="checked"><label for="/"> &#128193;</label><span id="cr">+&#128193;</nav></span><span id="si"></span>';
		  document.querySelector('form').setAttribute('action', '/upload?f=');
          for (var i = 0; i < json.length - 1; i++) {
		    let dir = '', f = json[i].folder, n = json[i].name;
		    if (f != noted) {
			  noted = f;
			  dir = `<nav><input type="radio" id="${f}" name="group"><label for="${f}"></label> &#128193; ${f} <a href="?delete=/${f}">&#x1f5d1;&#xfe0f;</a></nav>`;
			}
            if (n != '') dir += `<li><a href="${f}/${n}">${n}</a><small> ${json[i].size}</small><a href="${f}/${n}"download="${n}"> Download</a> or<a href="?delete=${f}/${n}"> Delete</a>`;
            myList.insertAdjacentHTML('beforeend', dir);
          }
          myList.insertAdjacentHTML('beforeend', `<li><b id="so">${to ? '&#9660;' : '&#9650;'} LittleFS</b> belegt ${json[i].usedBytes.replace(".00", "")} von ${json[i].totalBytes.replace(".00", "")}`);
          var free = json[i].freeBytes;
		  cr.addEventListener('click', () => {
			document.getElementById('no').classList.toggle('no');
		  });
		  so.addEventListener('click', () => {
			list(to=++to%2);
			localStorage.setItem('sortBy', JSON.stringify(to));
		  });
		  document.addEventListener('change', (e) => {
		    if (e.target.id == 'fs') {
		  	  for (var bytes = 0, i = 0; i < event.target.files.length; i++) bytes += event.target.files[i].size;
              for (var output = `${bytes} Byte`, i = 0, circa = bytes / 1024; circa > 1; circa /= 1024) output = circa.toFixed(2) + [' KB', ' MB', ' GB'][i++];
              if (bytes > free) {
                si.innerHTML = `<li><b> ${output}</b><strong> Ungenügend Speicher frei</strong></li>`;
                up.setAttribute('disabled', 'disabled');
              } 
              else {
			    si.innerHTML = `<li><b>Dateigröße:</b> ${output}</li>`;
                up.removeAttribute('disabled');
              }
			}
            document.querySelectorAll(`input[type=radio]`).forEach(el => { if (el.checked) document.querySelector('form').setAttribute('action', '/upload?f=' + el.id)});
          });
		  document.querySelectorAll('[href^="?delete=/"]').forEach(node => {
            node.addEventListener('click', () => {
	          if (!confirm('Sicher!')) event.preventDefault();
			});
		  });
	    });
      }
	</script>
  </head>
  <body>
	<h2>ESP32 Filesystem Manager</h2>
	<form method="post" enctype="multipart/form-data">
	  <input id="fs" type="file" name="up[]" multiple>
	  <button id="up" disabled>Upload</button>
	</form>
	<form id="no" class="no" method="POST">
	  <input name="new" placeholder="Ordner Name" pattern="[^\x22/%&\\:;]{1,31}" title="Zeichen &#8220; % & / : ; \  sind nicht erlaubt." required="">
	  <button>Create</button>
	</form>
	<main></main>
	<form action="/format" method="POST">
	  <button id="btn">Format LittleFS</button>
	</form>
  </body>
</html>

Die Webseite zur Singel Zeitschaltuhr.

index.html

<!DOCTYPE HTML> <!-- For more information visit: https://fipsok.de -->
<html lang="de">
  <head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="style32.css">
	<title>Timer</title>
	<style>
	  main {
		background: linear-gradient(to right, #666 ,#333 5%, #333 95%, #666);
		padding:1em 1.5em;
		border-radius: 2em;
	  }
	  div button, input, #top, #below, #view, #option{
		background-color: #333;
	  }
	  main, button, input:checked+label {
		color: #15dfdf;
	  }
	  button, svg, time, [name^=bu], #reset, #sun {
		cursor: pointer;
	  }
	  input, #view, #option, #reset {
		border: solid #555;
	  }
	  div:not([id^="st"]) {
		display: flex;
		align-items: center;
	  }
	  div+[type="checkbox"] {
		margin-left: 1em;
	  }
	  div+span {
		display: flex;
		justify-content: space-evenly;
		margin-left: 1.7em;
	  }
	  span {
		padding: 0.5em;
	  }
	  svg {
		width: 3em;
	  }
	  time {
		font-size: 1.4em;
		font-weight: bold;
		text-shadow: 1px 1px 1px #777;
	  }
	  input {
		height: auto;
		width: auto;
		font-size: 3em;
		font-weight: bold;
		color: inherit;
		padding: 0;
	  }
	  label {
		font-style: italic;
		color: #777;
	  }
	  button {
		border: outset #999;
		width: 50%;
		margin: 0;
		box-shadow: none;
	  }
	  button:only-of-type {
		width: 25%;
	  }
	  [name^=bu] {
		width: 2em;
	  }
	  #top {
		justify-content: space-evenly;
		position: sticky;
		top: 0;
		z-index: 1;
	  }
	  #tip {
		position: sticky;
		top: 50%;
		z-index: 2;
		height: 0;
	  }
	  #option {
		align-items: flex-end;
	  }
	  #view, #option {
		position: sticky;
		flex-direction: column;
		top: 4.4em;
		margin-bottom: .3em;
		z-index: 1;
	  }
	  #watt {
		font-size: 1em;
		width: 2.6em;
		text-align: end;
	  }
	  #kwh {
		cursor: default;
		border: solid #f00;
		margin: .5em;
		padding: .3em;
	  }
	  #below {
		position: sticky;
		bottom: .1em;
		padding: .7em 0 .7em 0;
	  }
	  #sun {
		font-size: 2em;
		padding: .5em 0;
	  }
	  .dark {
		opacity: .5;
	  }
	  .edit, .noedit {
		justify-content: center;
		width: 100%;
		background-color: red;
		color: #fff;
		padding: 1em;
		border-radius: .5em;
	  }
	  .edit:after {
		content: 'Eingabe gespeichert';  
	  }
	  .noedit:after {
		content: 'Nur 4 Ziffern 0 - 9 eingeben';
	  }
	  .fix, .greyed {
		color: #666 !important;
	  }
	  .none {
		display: none !important;
	  }
	  @media only screen and (max-width: 600px) {
		input {
		  font-size: 2.2em;
		}
	  }
	</style>
	<script>
	  const d = document;
	  d.addEventListener('DOMContentLoaded', async () => {
		let resp = await fetch('/timer', {method: 'post'});
		let array = await resp.json();
		var buf = '';
		for (var i = 0; i < array.length; i++) {
		  buf += `<div id=st${i}><div><span name=bu>ON</span><input type="time">\u00A0--\u00A0<input type="time"></div><span>`;
		  ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'].forEach(d => {buf += `<input type="checkbox" checked><label>${d} </label>`;});
		  buf += '</span></div>';
		}
		buf += '<div id="below"><button>&#9200; Zeiten Speichern</button><button>-</button></div>';
		d.querySelector('main').insertAdjacentHTML('beforeend', buf);
		buf = '';
		['Morgendämmerung', 'Sonnenaufgang', 'Sonnenuntergang', 'Abenddämmerung'].forEach((s, i) => {
		  buf += `<span>${s} <span id="sl${i}"></span><input type="checkbox" id="sr${i*2}"><label>Aus</label><input type="checkbox" id="sr${i*2+1}"><label>Ein</label></span>`;
		});
		d.querySelector('#option').insertAdjacentHTML('beforeend', buf);
		fill(array);
		renew(), renew('sun'), setInterval(renew, 1000);
		d.querySelector('main').classList.remove('none');
		btn = d.querySelectorAll(`button`);
		btn[0].addEventListener('click', renew.bind(this, 'tog'));
		btn[1].addEventListener('click', save);
		btn[2].addEventListener('click', renew.bind(this, 'fix'));
		node = d.querySelectorAll('[id^=sr]');
		node.forEach(el => {
		  el.addEventListener('change', () => {
			let i = event.target.id.slice(2, 3);
			i%2 == 0 ? node[++i].checked = false : node[--i].checked = false;
			setSun();
			let x = 0;
			node.forEach((el, i) => { if (el.checked) x = x | (1 << i) });
			renew('sun&select=' + x);
		  });
		});
		d.querySelectorAll(`[name=bu]`).forEach(el => {el.addEventListener('click', save)});
		d.querySelector('#reset').addEventListener('click', () => {if (confirm('Bist du sicher!')) hours('?reset=1');});
		d.querySelector('#watt').addEventListener('blur', () => {
		  let inObj = d.querySelector('#watt');
		  !inObj.checkValidity() ? out('noedit') : hours(`?watt=${parseInt(inObj.value)}`);
		});
		d.querySelector('time').addEventListener('click', () => { if (!d.getElementById('view').classList.toggle('none')) hours();});
		d.querySelector('svg').addEventListener('click', () => {window.location = '/fs.html';});
		sun.addEventListener('click', () => {d.getElementById('option').classList.toggle('none')});
	  });
	  function setSun() {
		let check = 0;
		node.forEach(el => { if (el.checked) ++check;});
		check ? sun.classList.remove('dark') : sun.classList.add('dark');
	  }
	  function out(arg) {
		let el = d.querySelector('#info').classList;
		el.add(arg);
		setTimeout(() => {
		  el.remove(arg);
		}, 4e3);
	  }
	  function fill(data) {
		data.forEach((v, i) => {
		  let c = d.querySelector(`#st${i} [name=bu]`);
		  c.textContent = (v[0] % 2 ? 'ON' : 'OFF');
		  d.querySelectorAll(`#st${i} [type=time]`).forEach((el, i) => { el.value = v[2+i]});
		  d.querySelectorAll(`#st${i} [type=checkbox]`).forEach((el, i) => {v[1] & (1 << i) ? el.checked = true : el.checked = false});
		  d.querySelectorAll(`#st${i}, #st${i} label`).forEach(el => {c.textContent == 'ON' ? el.classList.remove('greyed') : el.classList.add('greyed')});
		});
	  }
	  async function save() {
		if (this.type !== 'submit') this.textContent == 'ON' ? this.textContent = 'OFF' : this.textContent = 'ON';
		let form = new FormData(), data = [];
		d.querySelectorAll(`[id^=st]`).forEach(e => {
		  let x = 0, arr = [d.querySelector(`#${e.id} [name=bu]`).textContent == 'ON' ? '1' : '0'];
		  d.querySelectorAll(`#${e.id} [type=checkbox]`).forEach((el, i) => { if (el.checked) x = x | (1 << i) });
		  arr.push(x.toString());
		  d.querySelectorAll(`#${e.id} [type=time]`).forEach((el,i) => {arr.push(el.value != 0 ? el.value : 0)});
		  data.push(arr);
		});  
		form.append('dTime', JSON.stringify(data));	  
		const resp = await fetch('/timer', {method: 'post', body: form});
		resp.ok&&out('edit');
		const json = await resp.json();
		fill(json);
	  }
	  async function renew(arg = 'time') {
		const resp = await fetch(`timer?switch=${arg}`);
		const array = await resp.json();
		if (arg.startsWith('sun')) {
		  resp.ok&&arg.startsWith('sun&')&&out('edit');
		  array[0].forEach((el, i) => { d.getElementById(`sl${i}`).innerHTML = el;});					
		  d.querySelectorAll('[id^=sr]').forEach((el, i) => {array[1] & (1 << i) ? el.checked = true : el.checked = false});
		  setSun();
		}else {
		  d.querySelector('polygon').style.fill = array[0] == 0 ? '#eee' : '#ff0';
		  btn[0].innerHTML = array[0] == 1 ? '&#9995; ON' : '&#9995; OFF';
		  d.querySelector('time').innerHTML = array[1];
		  btn[2].innerHTML = array[2] == 1 ? '&#10006; Auto inaktiv' : '&#9203; Auto aktiv';
		  d.querySelectorAll(`div:not([id="top"]), label`).forEach(el => {array[2] == 0 ? el.classList.remove('fix') : el.classList.add('fix')});
		}
	  }
	  async function hours(arg = '') {
		const resp = await fetch(`hobbs${arg}`);
		resp.ok&&arg.startsWith('?')&&out('edit');
		const data = await resp.json();
		d.querySelector('strong').innerHTML = data[0] + ' h';
		d.getElementById('watt').value = data[1];
		d.getElementById('kwh').innerHTML = data[2] + ' kWh';
	  }
	</script>
  </head>
  <body>
	<main class="none">
	  <div id="top">
		<button>ON</button>	
		<svg viewBox="0 0 12 15">
		  <polygon points="10.421,6.754 6.498,6.75 12.058,2.357 9.734,2.357 1.687,8.436 5.584,8.436 0,14.02"></polygon>
		</svg>
		<time>00:00:00</time>
		<span id="sun" class="dark">
		  &#9728;&#65039;
		</span>
	  </div>
	  <div id="tip"><div id="info"></div></div>
	  <div id="view" class="none">
		<span>Betriebsstunden <strong></strong></span>
		<span>Verbrauch bei <input id="watt" pattern="[0-9]{1,4}"> Watt <span id="kwh"></span></span>
		<span id="reset">&#10060; Zähler zurücksetzen</span>
	  </div>
	  <div id="option" class="none"></div>
	</main>
  </body>
</html>	
style32.css

/*For more information visit: https://fipsok.de*/
body {
	font-family: sans-serif;
	background-color: #a9a9a9;
	display: flex;
	flex-flow: column;
	align-items: center;
}
h1,h2 {
	color: #e1e1e1;
	text-shadow: 2px 2px 2px black;
}
li {
	background-color: #7cfc00;
	list-style-type: none;
	margin-bottom: 10px;
	padding-right: 5px;
	border-top: 3px solid #7cfc00;
	border-bottom: 3px solid #7cfc00;
	box-shadow: 5px 5px 5px #000000b3;
}
li a:first-child, li b {
	background-color: #ff4500;
	font-weight: bold;
	color: white;
	text-decoration: none;
	padding: 0 5px;
	border-top: 3.2px solid #ff4500;
	border-bottom: 3.6px solid #ff4500;
	text-shadow: 2px 2px 1px black;
	cursor:pointer;
}
li strong {
	color: red;
}
input {
	height: 35px;
	font-size: 13px;
}
input:invalid:focus{
	color:red;
}
h1+main {
	display: flex;
}
aside {
	display: flex;
	flex-direction: column;
	padding: 0.2em;
}
#left {
	align-items: flex-end;
	text-shadow: 1px 1px 2px #757474;
}
.note {
	background-color: salmon;
	padding: 0.5em;
	margin-top: 1em;
	text-align: center;
	max-width: 320px;
	border-radius: 0.5em;
}
nav {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
}
.no {
	display: none;
}
#cr {
	font-weight: bold;
	cursor:pointer;
	font-size: 1.5em;
}
#up {
	width: auto; 
}
button {
	width: 130px;
	height: 40px;
	font-size: 16px;
	margin-top: 1em;
	cursor: pointer;
	box-shadow: 5px 5px 5px #000000b3;
}
div button {
	background-color: #adff2f;
}
form [title] {
	background-color: silver;
	font-size: 16px;
	width: 125px;
}
form:nth-of-type(2) {
	margin-bottom: 1em;
}
[name="group"] {
	display: none;
}
[name="group"] + label {
	font-size: 1.5em;
	margin-right: 5px;
}
[name="group"] + label::before {
	content: "\002610";
}	
[name="group"]:checked + label::before {
	content: '\002611\0027A5';
}
3 Kommentare
R. Drechsel ✪ ✪ ✪ 06.06.2022
Hi Fips,

alles gut geschrieben, leider bekomme ich in der Zeitschaltuhr Single (alte Version) weder Automatik eingeschaltet noch verändertet Zeiten gespeichert. Was mache ich falsch?
Im Notfall sende ich dir mein Programm gerne zu, zum Prüfen.

Gruß
Rene

Antwort:
Bitte beachte: Esp32 Arduino Core 1.0.0 - 1.0.4

Gruß Fips
Robert ✪ ✪ ✪ 04.02.2021
Hi Fips,

grosses Lob fuer Deine Arbeit. Da hast Du viel Zeit und Muehe investiert. Ich habe noch selten ein aehnlich vollstaendiges, umfangreiches und durchdachtes Projekt gesehen.
Daumen hoch!

VG Rob


Antwort:
Danke für dein Feedback!

Gruß Fips
J. Konrad ✪ ✪ ✪ 16.01.2021
Hi, funktioniert alles wunderbar.

Was ich nicht ganz checke, ist die Option, wie ich den Verbraucher von wo anders zusätzlich schalten kann.

Ich habe ein Gewächshaus mit Absaugung. Nun möchte ich mit der Zeitschaltuhr diese Absaugung steuern.
Zusätzlich möchte ich die Luftfeuchtigkeit überwachen. Wenn diese einen bestimmten Wert überschreitet, möchte ich die Absaugung so lange im Dauerbetrieb lassen, bis der gewünschte Wert wieder unterschritten wird. Dann soll die Zeitschaltuhr wieder übernehmen.

Das müsste doch mit dem bereits integrierten Schalter funktionieren?

Gruß Joachim

Antwort:
Die "Taster.ino" ist für einen mechanischen Taster geschrieben. Eine anstehende Schaltzeit würde den Zustand ändern wenn die Schaltuhr nicht vorher im Webinterface auf Inaktiv gestellt wird.
Das heißt, die Variablen "relState" und "fixed" müssen für die Zeit der Lüftung geändert werden.

Gruß Fips
Kommentar eintragen

*