add barometric pressure

This commit is contained in:
2026-02-02 16:10:29 +11:00
parent 6f9eee5dc0
commit 08bd117eb8
7 changed files with 146 additions and 62 deletions

View File

@@ -33,6 +33,7 @@ type WUUpload struct {
RainLastHourMM float64
DailyRainMM float64
PressureHPA *float64
DateUTC string // "now" recommended
}
@@ -63,6 +64,11 @@ func (c *WundergroundClient) Upload(ctx context.Context, u WUUpload) (string, er
// UV index
q.Set("UV", fmt.Sprintf("%.2f", u.UVI))
// Barometric pressure (inHg)
if u.PressureHPA != nil {
q.Set("baromin", fmt.Sprintf("%.4f", hPaToInHg(*u.PressureHPA)))
}
// NOTE: your WS90 payload provides light in lux, not W/m^2.
// WU expects solarradiation in W/m^2, so we omit it unless you add a conversion/actual sensor field.
if u.SolarWm2 != nil {
@@ -110,3 +116,6 @@ func (c *WundergroundClient) Upload(ctx context.Context, u WUUpload) (string, er
func cToF(c float64) float64 { return (c * 9.0 / 5.0) + 32.0 }
func msToMph(ms float64) float64 { return ms * 2.2369362920544 }
func mmToIn(mm float64) float64 { return mm / 25.4 }
func hPaToInHg(hpa float64) float64 {
return hpa * 0.0295299830714
}