diff --git a/data/firmware.bin b/data/firmware.bin
index ef1153b..1d9b269 100644
Binary files a/data/firmware.bin and b/data/firmware.bin differ
diff --git a/data/settings.html b/data/settings.html
index a9547ab..029fbd4 100644
--- a/data/settings.html
+++ b/data/settings.html
@@ -208,6 +208,13 @@
>
🔄 Update durchführen
+
@@ -560,6 +567,23 @@
}
}
+ // MQTT Message publish function
+ function updateButtons() {
+ if (confirm("Update Buttons?")) {
+ fetch("/api/updateButtons", {
+ method: "GET"
+ })
+ .then((response) => {
+ if (response.status === 200) {
+ showMessage("Buttons führen das Update erfolgreich aus!", "success");
+ } else {
+ showMessage("Fehler beim Senden der MQTT Message", "error");
+ }
+ })
+ .catch((error) => showMessage("Verbindungsfehler beim MQTT Publish", "error"));
+ }
+}
+
function updateWifiButtonAccess(licenseLevel) {
const wifiSubmitBtn = document.getElementById("wifiSubmitBtn");
const wifiForm = document.getElementById("wifiForm");
diff --git a/src/communication.h b/src/communication.h
index 1ce6180..aea9d36 100644
--- a/src/communication.h
+++ b/src/communication.h
@@ -225,7 +225,7 @@ void setupMqttServer() {
}
else if (strncmp(topic, "heartbeat/alive/", 16) == 0) {
handleHeartbeatTopic(topic, payload);
-}
+ }
updateStatusLED(3);
});
diff --git a/src/webserverrouter.h b/src/webserverrouter.h
index 57f37e1..a586f1d 100644
--- a/src/webserverrouter.h
+++ b/src/webserverrouter.h
@@ -1,5 +1,8 @@
#pragma once
#include
+
+void sendMQTTMessage(const char * topic, const char * message);
+
#include "master.h"
#include
#include
@@ -7,9 +10,9 @@
#include
#include
-
#include
#include
+#include "communication.h"
AsyncWebServer server(80);
AsyncWebSocket ws("/ws");
@@ -32,13 +35,13 @@ void setupRoutes(){
request->send(SPIFFS, "/rfid.html", "text/html");
});
- server.on("/button.bin", HTTP_GET, [](AsyncWebServerRequest *request) {
- if (SPIFFS.exists("/button.bin")) {
- request->send(SPIFFS, "/button.bin", "application/octet-stream");
- Serial.println("Firmware file served: /button.bin");
+ server.on("/firmware.bin", HTTP_GET, [](AsyncWebServerRequest *request) {
+ if (SPIFFS.exists("/firmware.bin")) {
+ request->send(SPIFFS, "/firmware.bin", "application/octet-stream");
+ Serial.println("Firmware file served: /firmware.bin");
} else {
request->send(404, "application/json", "{\"error\":\"File not found\"}");
- Serial.println("Firmware file not found: /button.bin");
+ Serial.println("Firmware file not found: /firmware.bin");
}
});
@@ -253,6 +256,16 @@ server.on("/api/set-location", HTTP_POST, [](AsyncWebServerRequest *request) {
request->send(200, "application/json", result);
});
+
+server.on("/api/updateButtons", HTTP_GET, [](AsyncWebServerRequest *request){
+ Serial.println("/api/updateButtons called");
+
+ // MQTT publish on aquacross/update/flag with raw payload "1"
+ sendMQTTMessage("aquacross/update/flag", "1");
+ Serial.println("MQTT published: aquacross/update/flag -> 1");
+ request->send(200, "application/json", "{\"success\":true}");
+});
+
// Statische Dateien
server.serveStatic("/", SPIFFS, "/");
@@ -280,4 +293,4 @@ void pushUpdateToFrontend(const String &message) {
void loopWebSocket() {
ws.cleanupClients(); // Clean up disconnected clients
-}
\ No newline at end of file
+}