From 110f454e017d43dde6fea11746dceaba89f54aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Mon, 15 Apr 2024 14:37:53 +0200 Subject: [PATCH] publishing first value --- lib/patrix/sensors/DallasSensor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/patrix/sensors/DallasSensor.h b/lib/patrix/sensors/DallasSensor.h index 6fcc3c9..4181f98 100644 --- a/lib/patrix/sensors/DallasSensor.h +++ b/lib/patrix/sensors/DallasSensor.h @@ -54,7 +54,7 @@ public: const double value = sensors.read(address); const time_t timestamp = sensors.getTimestamp(); const unsigned long millisNow = millis(); - const bool doPublish = !isnan(value) && (abs(lastSentValue - value) >= valueThreshold || millisNow - lastSentMillis >= minIntervalMillis); + const bool doPublish = !isnan(value) && (isnan(lastSentValue) || abs(lastSentValue - value) >= valueThreshold || millisNow - lastSentMillis >= minIntervalMillis); if (doPublish) { lastSentValue = value; lastSentMillis = millisNow;