feat(db): remove CO2PPM data over 1'000'000'000
Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
@@ -143,7 +143,15 @@ func main() {
|
||||
{Subject: "room", Content: room},
|
||||
{Subject: "node", Content: nodeID},
|
||||
}
|
||||
translatedDp := provenceMeasurement.CreateDataPoint(influxTags, dp.GetValues(), dp.Timestamp())
|
||||
|
||||
// If CO2PPM value is present and over 1000000000 delete the field
|
||||
values := dp.GetValues()
|
||||
if values.CO2PPM > 1000000000 {
|
||||
log.Printf("[Main] Warning: CO2PPM value %d is over threshold, setting to 0\n", values.CO2PPM)
|
||||
values.CO2PPM = 0
|
||||
}
|
||||
|
||||
translatedDp := provenceMeasurement.CreateDataPoint(influxTags, values, dp.Timestamp())
|
||||
|
||||
if err := influxGateway.AddDatapoint(&translatedDp); err != nil {
|
||||
log.Printf("[Main] Error adding datapoint to influx: %v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user