Browse Source

add delays after mqtt publish (test)

ir
Hendrik Langer 5 years ago
parent
commit
d5eb7e5fa0
  1. 7
      src/main.cpp

7
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);
}
}

Loading…
Cancel
Save