|
@ -170,6 +170,23 @@ void sendValues() { |
|
|
mqtt.publish(topic_uvi.c_str(), uvi, sizeof(uvb)); |
|
|
mqtt.publish(topic_uvi.c_str(), uvi, sizeof(uvb)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (sds_active) { |
|
|
|
|
|
PmResult pm = sds.readPm(); |
|
|
|
|
|
if (pm.isOk()) { |
|
|
|
|
|
String topic_pm10 = String("thomas/sensor/") + ota.getMAC() + String("/pm10"); |
|
|
|
|
|
char pm10[10]; sprintf(pm10, "%.2f", pm.pm10); |
|
|
|
|
|
String topic_pm25 = String("thomas/sensor/") + ota.getMAC() + String("/pm25"); |
|
|
|
|
|
char pm25[10]; sprintf(pm25, "%.2f", pm.pm25); |
|
|
|
|
|
mqtt.publish(topic_pm10.c_str(), pm10, sizeof(pm10)); |
|
|
|
|
|
mqtt.publish(topic_pm25.c_str(), pm25, sizeof(pm25)); |
|
|
|
|
|
|
|
|
|
|
|
// if you want to just print the measured values, you can use toString() method as well
|
|
|
|
|
|
Serial.println(pm.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|