|
@ -503,16 +503,16 @@ void sendValues() { |
|
|
String topic_temperature = String("thomas/sensor/") + ota.getMAC() + String("/temperature"); |
|
|
String topic_temperature = String("thomas/sensor/") + ota.getMAC() + String("/temperature"); |
|
|
String topic_humidity = String("thomas/sensor/") + ota.getMAC() + String("/humidity"); |
|
|
String topic_humidity = String("thomas/sensor/") + ota.getMAC() + String("/humidity"); |
|
|
String topic_pressure = String("thomas/sensor/") + ota.getMAC() + String("/pressure"); |
|
|
String topic_pressure = String("thomas/sensor/") + ota.getMAC() + String("/pressure"); |
|
|
mqtt.publish(topic_temperature.c_str(), sensor_readings.temperature, "%.2f"); |
|
|
mqtt.publishf(topic_temperature.c_str(), "%.2f", sensor_readings.temperature); |
|
|
delay(10); |
|
|
delay(10); |
|
|
mqtt.publish(topic_humidity.c_str(), sensor_readings.humidity, "%.2f"); |
|
|
mqtt.publishf(topic_humidity.c_str(), "%.2f", sensor_readings.humidity); |
|
|
delay(10); |
|
|
delay(10); |
|
|
mqtt.publish(topic_pressure.c_str(), sensor_readings.pressure, "%.2f"); |
|
|
mqtt.publishf(topic_pressure.c_str(), "%.2f", sensor_readings.pressure); |
|
|
delay(10); |
|
|
delay(10); |
|
|
} |
|
|
} |
|
|
if (bme680_active) { |
|
|
if (bme680_active) { |
|
|
String topic_voc = String("thomas/sensor/") + ota.getMAC() + String("/voc"); |
|
|
String topic_voc = String("thomas/sensor/") + ota.getMAC() + String("/voc"); |
|
|
mqtt.publish(topic_voc.c_str(), sensor_readings.voc / 1000.0F, "%.2f"); |
|
|
mqtt.publishf(topic_voc.c_str(), "%.2f", sensor_readings.voc / 1000.0F); |
|
|
delay(10); |
|
|
delay(10); |
|
|
} |
|
|
} |
|
|
if (!bme280_active && !bme680_active) { |
|
|
if (!bme280_active && !bme680_active) { |
|
@ -527,35 +527,35 @@ void sendValues() { |
|
|
String topic_uvi = String("thomas/sensor/") + ota.getMAC() + String("/uvi"); |
|
|
String topic_uvi = String("thomas/sensor/") + ota.getMAC() + String("/uvi"); |
|
|
String topic_uva = String("thomas/sensor/") + ota.getMAC() + String("/uva"); |
|
|
String topic_uva = String("thomas/sensor/") + ota.getMAC() + String("/uva"); |
|
|
String topic_uvb = String("thomas/sensor/") + ota.getMAC() + String("/uvb"); |
|
|
String topic_uvb = String("thomas/sensor/") + ota.getMAC() + String("/uvb"); |
|
|
mqtt.publish(topic_uvi.c_str(), sensor_readings.uvi, "%.2f"); |
|
|
mqtt.publishf(topic_uvi.c_str(), "%.2f", sensor_readings.uvi); |
|
|
mqtt.publish(topic_uva.c_str(), sensor_readings.uva, "%.2f"); |
|
|
mqtt.publishf(topic_uva.c_str(), "%.2f", sensor_readings.uva); |
|
|
mqtt.publish(topic_uvb.c_str(), sensor_readings.uvb, "%.2f"); |
|
|
mqtt.publishf(topic_uvb.c_str(), "%.2f", sensor_readings.uvb); |
|
|
delay(10); |
|
|
delay(10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (light_active) { |
|
|
if (light_active) { |
|
|
String topic_lux = String("thomas/sensor/") + ota.getMAC() + String("/lux"); |
|
|
String topic_lux = String("thomas/sensor/") + ota.getMAC() + String("/lux"); |
|
|
mqtt.publish(topic_lux.c_str(), sensor_readings.lux, "%.2f"); |
|
|
mqtt.publishf(topic_lux.c_str(), "%.2f", sensor_readings.lux); |
|
|
delay(10); |
|
|
delay(10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (sds_active) { |
|
|
if (sds_active) { |
|
|
String topic_pm10 = String("thomas/sensor/") + ota.getMAC() + String("/pm10"); |
|
|
String topic_pm10 = String("thomas/sensor/") + ota.getMAC() + String("/pm10"); |
|
|
String topic_pm25 = String("thomas/sensor/") + ota.getMAC() + String("/pm25"); |
|
|
String topic_pm25 = String("thomas/sensor/") + ota.getMAC() + String("/pm25"); |
|
|
mqtt.publish(topic_pm10.c_str(), sensor_readings.pm10, "%.2f"); |
|
|
mqtt.publishf(topic_pm10.c_str(), "%.2f", sensor_readings.pm10); |
|
|
mqtt.publish(topic_pm25.c_str(), sensor_readings.pm25, "%.2f"); |
|
|
mqtt.publishf(topic_pm25.c_str(), "%.2f", sensor_readings.pm25); |
|
|
delay(10); |
|
|
delay(10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
String topic_battery = String("thomas/sensor/") + ota.getMAC() + String("/battery"); |
|
|
String topic_battery = String("thomas/sensor/") + ota.getMAC() + String("/battery"); |
|
|
mqtt.publish(topic_battery.c_str(), (sensor_readings.battery/4096.0)*2*3.42, "%.2f"); |
|
|
mqtt.publishf(topic_battery.c_str(), "%.2f", (sensor_readings.battery/4096.0)*2*3.42); |
|
|
delay(10); |
|
|
delay(10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
String topic_rssi = String("thomas/sensor/") + ota.getMAC() + String("/rssi"); |
|
|
String topic_rssi = String("thomas/sensor/") + ota.getMAC() + String("/rssi"); |
|
|
mqtt.publish(topic_rssi.c_str(), sensor_readings.rssi, "%d"); |
|
|
mqtt.publishf(topic_rssi.c_str(), "%d", sensor_readings.rssi); |
|
|
delay(10); |
|
|
delay(10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|