filter abnormal values

This commit is contained in:
Cedric Girard 2019-07-31 21:37:31 +02:00
parent 01551bb521
commit 39228eb760
Signed by: X-dark
GPG key ID: E7D0E125DB9519E4

View file

@ -143,17 +143,27 @@ void readBaseline() {
void sendMetrics() {
String message = "# ESP32 Env monitor Prometheus metrics\n\n";
float temperature = temp;
float humidity = hum;
float pressure = pres;
if (temperature < 100) {
message += "# HELP env_temperature The temperature in " + String(tempUnit == BME280::TempUnit_Celsius ? 'C' :'F') + "\n";
message += "# TYPE env_temperature gauge\n";
message += "env_temperature " + String(temp) + "\n\n";
message += "env_temperature " + String(temperature) + "\n\n";
}
if (pressure < 2000) {
message += "# HELP env_pressure The pressure in " + String(presUnit) + "\n";
message += "# TYPE env_pressure gauge\n";
message += "env_pressure " + String(pres) + "\n\n";
message += "env_pressure " + String(pressure) + "\n\n";
}
if (humidity < 100){
message += "# HELP env_humidity The humidity in %\n";
message += "# TYPE env_humidity gauge\n";
message += "env_humidity " + String(hum) + "\n\n";
message += "env_humidity " + String(humidity) + "\n\n";
}
message += "# HELP env_tvoc The TVOC in ppb\n";
message += "# TYPE env_tvoc gauge\n";