From 0d63c7cc4b8f23a443771dfb447a9d8e5790fc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Thu, 16 Jan 2025 16:29:19 +0100 Subject: [PATCH] adapted index.html to reflect websocket changes --- src/patrix/INDEX_HTML.cpp | 96 +++++++++++++++++++++++--------------- src/patrix/sensor/Dallas.h | 6 +-- src/patrix/sensor/Value.h | 3 +- 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/src/patrix/INDEX_HTML.cpp b/src/patrix/INDEX_HTML.cpp index c54e6e5..0afe6f3 100644 --- a/src/patrix/INDEX_HTML.cpp +++ b/src/patrix/INDEX_HTML.cpp @@ -8,6 +8,20 @@ const char *INDEX_HTML = R"( -

+

 
 
 
diff --git a/src/patrix/sensor/Dallas.h b/src/patrix/sensor/Dallas.h
index fd29037..3180da2 100644
--- a/src/patrix/sensor/Dallas.h
+++ b/src/patrix/sensor/Dallas.h
@@ -1,9 +1,9 @@
 #ifndef DALLAS_H
 #define DALLAS_H
 
-#include "../log.h"
-#include "OneWire.h"
 #include "DallasTemperature.h"
+#include "OneWire.h"
+#include "../log.h"
 
 #define DALLAS_INTERVAL_MILLISECONDS    2000
 
@@ -42,7 +42,7 @@ public:
       const auto count = sensors.getDeviceCount();
       if (count != 0) {
         uint64_t address;
-        for (int index = 0; index < count; ++index) {
+        for (auto index = 0; index < count; ++index) {
           sensors.getAddress(reinterpret_cast(&address), index);
           info("Dallas %d/%d 0x%016llX = %5.1f^C", index + 1, count, address, sensors.getTempC(reinterpret_cast(&address)));
         }
diff --git a/src/patrix/sensor/Value.h b/src/patrix/sensor/Value.h
index 8434bdd..4da24aa 100644
--- a/src/patrix/sensor/Value.h
+++ b/src/patrix/sensor/Value.h
@@ -58,8 +58,9 @@ public:
     const auto dueToTime = sentInterval != 0 && sentInterval != now / overdueSeconds;
     const auto changed = dueToNAN || dueToThreshold || dueToTime;
     if (changed) {
+      info("%s = %f", name.c_str(), currentValue);
       mqttPublish(name + "/retain", String(currentValue), RETAIN);
-      websocketSendAll(toJson(false));
+      websocketSendAll(toJson(true));
       sentValue = currentValue;
       sentInterval = now / overdueSeconds;
     }