sensor mqtt json name

This commit is contained in:
Patrick Haßel 2024-04-12 13:28:36 +02:00
parent d64b731cb1
commit 013ccc67b0
2 changed files with 4 additions and 4 deletions

View File

@ -56,7 +56,7 @@ public:
if (sensors.isConverted()) { if (sensors.isConverted()) {
const double value = sensors.read(address); const double value = sensors.read(address);
const time_t timestamp = sensors.getTimestamp(); const time_t timestamp = sensors.getTimestamp();
const unsigned long millisNow=millis(); const unsigned long millisNow = millis();
const bool doPublish = !isnan(value) && (abs(lastSentValue - value) >= valueThreshold || millisNow - lastSentMillis >= minIntervalMillis); const bool doPublish = !isnan(value) && (abs(lastSentValue - value) >= valueThreshold || millisNow - lastSentMillis >= minIntervalMillis);
if (doPublish) { if (doPublish) {
lastSentValue = value; lastSentValue = value;

View File

@ -21,7 +21,7 @@
Dallas dallas(SENSOR_GPIO); Dallas dallas(SENSOR_GPIO);
DallasSensor sensor(dallas, 0x3D0417C1D740FF28, "sensor", 0.1, 5, 60 * 1000); DallasSensor sensor(dallas, 0x3D0417C1D740FF28, "temperatur.ist", 0.1, 5, 60 * 1000);
ArduPID pid; ArduPID pid;
@ -77,12 +77,12 @@ void patrixLoop() {
lastDebug = now; lastDebug = now;
int heaterPercent = (int) round(100.0 * heaterPWM / CONTROL_PWM_MAX); int heaterPercent = (int) round(100.0 * heaterPWM / CONTROL_PWM_MAX);
debug( debug(
"p: %.12f | i: %.12f | d: %.12f | current: %5.2f | target: %5.2f | heater: %3d%% | %s", "p: %.12f | i: %.12f | d: %.12f | dst: %4.1f^C | cur: %5.2f^C | heat: %3d%% | %s",
proportional == 0 ? NAN : proportional, proportional == 0 ? NAN : proportional,
integral == 0 ? NAN : integral, integral == 0 ? NAN : integral,
derivative == 0 ? NAN : derivative, derivative == 0 ? NAN : derivative,
temperatureCurrent,
temperatureTarget, temperatureTarget,
temperatureCurrent,
heaterPercent, heaterPercent,
emergencyStr emergencyStr
); );