/*
	01.07.2025
	16_HTU_OLED_NTP_WiFi-Manager2_WebServer.ino	
	ESP8266-WiFi-Manager mit MQTT und Webserver
	
*/

// HTML-Seite (minimalistisch)
const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE html>
<html>
<head>
  <title>ESP Sensor Dashboard</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
    body { font-family: Arial; text-align: center; margin: 20px; }
    .data { font-size: 24px; margin: 10px; }
    button { padding: 10px 20px; font-size: 16px; }
  </style>
</head>
<body>
  <h1>ESP Sensor Dashboard</h1>
  <div class="data">Temperatur: <span id="temp">%TEMPERATURE%</span> °C</div>
  <div class="data">Luftfeuchtigkeit: <span id="hum">%HUMIDITY%</span> %</div>
  <div class="data">LED: <span id="led">%LEDSTATE%</span></div>
  <button onclick="toggleLED()">LED Umschalten</button>
  <script>
    function toggleLED() {
      fetch("/led").then(response => {
        document.getElementById("led").innerText = 
          document.getElementById("led").innerText === "AN" ? "AUS" : "AN";
      });
    }
    // Auto-Update alle 5 Sekunden
    setInterval(() => {
      fetch("/data").then(response => response.json())
        .then(data => {
          document.getElementById("temp").innerText = data.temp;
          document.getElementById("hum").innerText = data.hum;
        });
    }, 5000);
  </script>
</body>
</html>
)rawliteral";

