bugfix wunderground reporting

This commit is contained in:
2026-03-09 09:19:45 +11:00
parent 5b8cad905f
commit c796f1324e
12 changed files with 253 additions and 33 deletions

View File

@@ -2,6 +2,7 @@ package config
import (
"errors"
"fmt"
"os"
"strings"
"time"
@@ -31,6 +32,7 @@ type Config struct {
Latitude float64 `yaml:"latitude"`
Longitude float64 `yaml:"longitude"`
ElevationM float64 `yaml:"elevation_m"`
Timezone string `yaml:"timezone"`
} `yaml:"site"`
Pollers struct {
@@ -105,6 +107,11 @@ func Load(path string) (*Config, error) {
if c.Site.Name == "" {
c.Site.Name = "default"
}
if c.Site.Timezone != "" {
if _, err := time.LoadLocation(c.Site.Timezone); err != nil {
return nil, fmt.Errorf("invalid site timezone %q: %w", c.Site.Timezone, err)
}
}
if c.Pollers.OpenMeteo.Model == "" {
c.Pollers.OpenMeteo.Model = "ecmwf"
}