|
|
@ -197,17 +197,13 @@ void sendValues() { |
|
|
|
String topic_temperature = String("thomas/sensor/") + ota.getMAC() + String("/temperature"); |
|
|
|
String topic_humidity = String("thomas/sensor/") + ota.getMAC() + String("/humidity"); |
|
|
|
String topic_pressure = String("thomas/sensor/") + ota.getMAC() + String("/pressure"); |
|
|
|
char temperature[8]; sprintf(temperature, "%.2f", sensor_readings.temperature); |
|
|
|
char humidity[7]; sprintf(humidity, "%.2f", sensor_readings.humidity); |
|
|
|
char pressure[8]; sprintf(pressure, "%.2f", sensor_readings.pressure / 100.0F); |
|
|
|
mqtt.publish(topic_temperature.c_str(), temperature, strlen(temperature)); |
|
|
|
mqtt.publish(topic_humidity.c_str(), humidity, strlen(humidity)); |
|
|
|
mqtt.publish(topic_pressure.c_str(), pressure, strlen(pressure)); |
|
|
|
mqtt.publish(topic_temperature.c_str(), sensor_readings.temperature, "%.2f"); |
|
|
|
mqtt.publish(topic_humidity.c_str(), sensor_readings.humidity, "%.2f"); |
|
|
|
mqtt.publish(topic_pressure.c_str(), sensor_readings.pressure / 100.0F, "%.2f"); |
|
|
|
} |
|
|
|
if (bme680_active) { |
|
|
|
String topic_voc = String("thomas/sensor/") + ota.getMAC() + String("/voc"); |
|
|
|
char voc[12]; sprintf(voc, "%.2f", sensor_readings.voc / 1000.0F); |
|
|
|
mqtt.publish(topic_voc.c_str(), voc, strlen(voc)); |
|
|
|
mqtt.publish(topic_voc.c_str(), sensor_readings.voc / 1000.0F, "%.2f"); |
|
|
|
} |
|
|
|
if (!bme280_active && !bme680_active) { |
|
|
|
String topic_temperature = String("thomas/sensor/") + ota.getMAC() + String("/temperature"); |
|
|
@ -220,21 +216,16 @@ void sendValues() { |
|
|
|
String topic_uvi = String("thomas/sensor/") + ota.getMAC() + String("/uvi"); |
|
|
|
String topic_uva = String("thomas/sensor/") + ota.getMAC() + String("/uva"); |
|
|
|
String topic_uvb = String("thomas/sensor/") + ota.getMAC() + String("/uvb"); |
|
|
|
char uvi[10]; sprintf(uvi, "%.2f", sensor_readings.uvi); |
|
|
|
char uva[10]; sprintf(uva, "%.2f", sensor_readings.uva); |
|
|
|
char uvb[10]; sprintf(uvb, "%.2f", sensor_readings.uvb); |
|
|
|
mqtt.publish(topic_uvi.c_str(), uvi, strlen(uvi)); |
|
|
|
mqtt.publish(topic_uva.c_str(), uva, strlen(uva)); |
|
|
|
mqtt.publish(topic_uvb.c_str(), uvb, strlen(uvb)); |
|
|
|
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"); |
|
|
|
} |
|
|
|
|
|
|
|
if (sds_active) { |
|
|
|
String topic_pm10 = String("thomas/sensor/") + ota.getMAC() + String("/pm10"); |
|
|
|
char pm10[10]; sprintf(pm10, "%.2f", sensor_readings.pm10); |
|
|
|
String topic_pm25 = String("thomas/sensor/") + ota.getMAC() + String("/pm25"); |
|
|
|
char pm25[10]; sprintf(pm25, "%.2f", sensor_readings.pm25); |
|
|
|
mqtt.publish(topic_pm10.c_str(), pm10, strlen(pm10)); |
|
|
|
mqtt.publish(topic_pm25.c_str(), pm25, strlen(pm25)); |
|
|
|
mqtt.publish(topic_pm10.c_str(), sensor_readings.pm10, "%.2f"); |
|
|
|
mqtt.publish(topic_pm25.c_str(), sensor_readings.pm25, "%.2f"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|