Ignore invalid temp

This commit is contained in:
Ryan McGuire 2025-01-28 19:41:57 -05:00
parent ce0ef7d291
commit 3d3492a283

View File

@ -15,13 +15,19 @@ func (u *WeatherUpdate) Enrich(weatherStations ...*config.WeatherStation) {
return
}
// Clear invalid measurements
// Clear invalid measurements, would be better if these weren't
// sent when sensor was out of range.
// TODO: This should probably just be done for all fields where
// the value is -9999
if u.BaromAbsoluteIn != nil && *u.BaromAbsoluteIn < 20 {
u.BaromAbsoluteIn = nil
}
if u.BaromRelativeIn != nil && *u.BaromRelativeIn < 20 {
u.BaromRelativeIn = nil
}
if u.TempIndoorF != nil && *u.TempIndoorF < -1000 {
u.TempIndoorF = nil
}
// Calculate Wind Chill
if u.WindChillF == nil && u.TempOutdoorF != nil && u.WindSpeedMPH != nil {