fix(db): filter random value
Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
@@ -146,13 +146,19 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If CO2PPM value is present and over 1000000000 delete the field
|
// If CO2PPM value is present and over 1,000,000,000 delete the field, it's calibration value
|
||||||
values := dp.GetValues()
|
values := dp.GetValues()
|
||||||
if values.CO2PPM > 1000000000 {
|
if values.CO2PPM > 1000000000 {
|
||||||
log.Printf("[Main] Warning: CO2PPM value %d is over threshold, setting to 0\n", values.CO2PPM)
|
log.Printf("[Main] Warning: CO2PPM value %d is calibrating, setting to 0\n", values.CO2PPM)
|
||||||
values.CO2PPM = 0
|
values.CO2PPM = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Still too high value, something wrong, dropping datapoint
|
||||||
|
if values.CO2PPM > 10000 {
|
||||||
|
log.Printf("[Main] Error: CO2PPM value %d is over threshold, dropping Datapoint\n", values.CO2PPM)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
translatedDp := provenceMeasurement.CreateDataPoint(influxTags, values, dp.Timestamp())
|
translatedDp := provenceMeasurement.CreateDataPoint(influxTags, values, dp.Timestamp())
|
||||||
|
|
||||||
if err := influxGateway.AddDatapoint(&translatedDp); err != nil {
|
if err := influxGateway.AddDatapoint(&translatedDp); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user