bugfix wunderground reporting
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user