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() {
|
void sendMetrics() {
|
||||||
String message = "# ESP32 Env monitor Prometheus metrics\n\n";
|
String message = "# ESP32 Env monitor Prometheus metrics\n\n";
|
||||||
|
|
||||||
message += "# HELP env_temperature The temperature in " + String(tempUnit == BME280::TempUnit_Celsius ? 'C' :'F') + "\n";
|
float temperature = temp;
|
||||||
message += "# TYPE env_temperature gauge\n";
|
float humidity = hum;
|
||||||
message += "env_temperature " + String(temp) + "\n\n";
|
float pressure = pres;
|
||||||
|
|
||||||
message += "# HELP env_pressure The pressure in " + String(presUnit) + "\n";
|
if (temperature < 100) {
|
||||||
message += "# TYPE env_pressure gauge\n";
|
message += "# HELP env_temperature The temperature in " + String(tempUnit == BME280::TempUnit_Celsius ? 'C' :'F') + "\n";
|
||||||
message += "env_pressure " + String(pres) + "\n\n";
|
message += "# TYPE env_temperature gauge\n";
|
||||||
|
message += "env_temperature " + String(temperature) + "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
message += "# HELP env_humidity The humidity in %\n";
|
if (pressure < 2000) {
|
||||||
message += "# TYPE env_humidity gauge\n";
|
message += "# HELP env_pressure The pressure in " + String(presUnit) + "\n";
|
||||||
message += "env_humidity " + String(hum) + "\n\n";
|
message += "# TYPE env_pressure gauge\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(humidity) + "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
message += "# HELP env_tvoc The TVOC in ppb\n";
|
message += "# HELP env_tvoc The TVOC in ppb\n";
|
||||||
message += "# TYPE env_tvoc gauge\n";
|
message += "# TYPE env_tvoc gauge\n";
|
||||||
|
|
Loading…
Reference in a new issue