filter abnormal values
This commit is contained in:
parent
01551bb521
commit
39228eb760
1 changed files with 19 additions and 9 deletions
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue