From d5eb7e5fa0e131e2c32635142b7e1999a90e0436 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Tue, 30 Jul 2019 14:21:52 +0200 Subject: [PATCH] add delays after mqtt publish (test) --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index fdf869e..152d30f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -418,18 +418,23 @@ void sendValues() { String topic_humidity = String("thomas/sensor/") + ota.getMAC() + String("/humidity"); String topic_pressure = String("thomas/sensor/") + ota.getMAC() + String("/pressure"); mqtt.publish(topic_temperature.c_str(), sensor_readings.temperature, "%.2f"); + delay(10); mqtt.publish(topic_humidity.c_str(), sensor_readings.humidity, "%.2f"); + delay(10); mqtt.publish(topic_pressure.c_str(), sensor_readings.pressure / 100.0F, "%.2f"); + delay(10); } if (bme680_active) { String topic_voc = String("thomas/sensor/") + ota.getMAC() + String("/voc"); mqtt.publish(topic_voc.c_str(), sensor_readings.voc / 1000.0F, "%.2f"); + delay(10); } if (!bme280_active && !bme680_active) { String topic_temperature = String("thomas/sensor/") + ota.getMAC() + String("/temperature"); float esp32_temperature = (temprature_sens_read() - 32) / 1.8; char temperature[8]; sprintf(temperature, "%.2f", esp32_temperature-29.40); mqtt.publish(topic_temperature.c_str(), temperature, strlen(temperature)); + delay(10); } if (uv_active) { @@ -439,6 +444,7 @@ void sendValues() { mqtt.publish(topic_uvi.c_str(), sensor_readings.uvi, "%.2f"); mqtt.publish(topic_uva.c_str(), sensor_readings.uva, "%.2f"); mqtt.publish(topic_uvb.c_str(), sensor_readings.uvb, "%.2f"); + delay(10); } if (sds_active) { @@ -446,6 +452,7 @@ void sendValues() { String topic_pm25 = String("thomas/sensor/") + ota.getMAC() + String("/pm25"); mqtt.publish(topic_pm10.c_str(), sensor_readings.pm10, "%.2f"); mqtt.publish(topic_pm25.c_str(), sensor_readings.pm25, "%.2f"); + delay(10); } }