30 lines
769 B
HTML
30 lines
769 B
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>ESP Kontrolle</title>
|
|
</head>
|
|
<body>
|
|
<h1>ESP Live-Daten</h1>
|
|
<div id="status">Warte auf Daten...</div>
|
|
<br>
|
|
<input id="befehl" type="text" placeholder="z.B. LED ON" />
|
|
<button onclick="senden()">Senden</button>
|
|
|
|
<script src="https://cdn.socket.io/4.6.1/socket.io.min.js"></script>
|
|
<script>
|
|
const socket = io();
|
|
|
|
socket.on("esp_update", (data) => {
|
|
document.getElementById("status").innerText =
|
|
`${data.topic}: ${data.payload}`;
|
|
});
|
|
|
|
function senden() {
|
|
const val = document.getElementById("befehl").value;
|
|
socket.emit("send_to_esp", val);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|