Documentation
¶
Index ¶
- Variables
- type BatteryConfiguration
- type ClimateConfiguration
- type ClimateControllerConfiguration
- type Components
- type Configuration
- func (c Configuration) BatteryScraper() (collector.Scraper[battery.Metrics], error)
- func (c Configuration) ClimateScraper(ctx context.Context, httpClient *http.Client, logger *slog.Logger) (collector.Scraper[climate.Metrics], any, error)
- func (c Configuration) GridScraper(httpClient *http.Client, logger *slog.Logger) (collector.Scraper[grid.Metrics], error)
- func (c Configuration) SolarScraper(httpClient *http.Client) (collector.Scraper[solar.Metrics], error)
- type GridConfiguration
- type HomeWizardConfiguration
- type SigEnergyConfiguration
- type SlackConfiguration
- type SolarConfiguration
- type SolarEdgeConfiguration
- type SolarStoreConfiguration
- type TadoConfiguration
- type WatchdogConfiguration
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Cmd = cobra.Command{ Use: "server", Short: "Run main server", RunE: func(cmd *cobra.Command, args []string) error { if configFile != nil && *configFile != "" { v.SetConfigFile(*configFile) } else { v.AddConfigPath(".") v.AddConfigPath("/etc/proteus") v.SetConfigName("config") v.SetConfigType("yaml") } if err := v.ReadInConfig(); err != nil { if _, ok := errors.AsType[viper.ConfigFileNotFoundError](err); !ok || (*configFile != "") { return fmt.Errorf("failed to read configuration: %w", err) } } var cfg Configuration if err := v.Unmarshal(&cfg); err != nil { return fmt.Errorf("failed to unmarshal configuration: %w", err) } ctx := cmd.Context() l := cfg.Log.Logger(os.Stderr) deps, err := buildDependencies(ctx, cfg, l) if err != nil { return err } l.Info("server starting", slog.String("version", cmd.Root().Version)) defer l.Info("server stopped") if err = runServerWithDependencies(ctx, deps, prometheus.DefaultRegisterer, cfg, l); errors.Is(err, context.Canceled) { err = nil } return err }, } )
Functions ¶
This section is empty.
Types ¶
type BatteryConfiguration ¶
type ClimateConfiguration ¶
type ClimateConfiguration struct {
Type string `yaml:"type" default:"tado" help:"Climate type"`
Controller ClimateControllerConfiguration `yaml:"controller"`
Interval time.Duration `yaml:"interval" default:"5m" help:"Climate poll interval"`
Enabled bool `yaml:"false" default:"true" help:"Enable Climate collector"`
}
type ClimateControllerConfiguration ¶
type ClimateControllerConfiguration struct {
Slack SlackConfiguration `yaml:"slack"`
Rules string `yaml:"rules" help:"Path to rules file"`
Enabled bool `yaml:"enabled" default:"false" help:"Enable climate controller"`
}
type Components ¶
type Components struct {
HomeWizard HomeWizardConfiguration `yaml:"homewizard" help:"HomeWizard configuration"`
SigEnergy SigEnergyConfiguration `yaml:"sigenergy" help:"SigEnergy configuration"`
SolarEdge SolarEdgeConfiguration `yaml:"solaredge" help:"SolarEdge configuration"`
Tado TadoConfiguration `yaml:"tado" help:"Tadoº configuration"`
}
type Configuration ¶
type Configuration struct {
Components Components `yaml:"components"`
Log configuration.LogConfiguration `yaml:"log"`
Prom configuration.PrometheusConfiguration `yaml:"prom"`
Health configuration.HealthConfiguration `yaml:"health"`
Watchdog WatchdogConfiguration `yaml:"watchdog"`
Grid GridConfiguration `yaml:"grid"`
Battery BatteryConfiguration `yaml:"battery"`
Climate ClimateConfiguration `yaml:"climate"`
Solar SolarConfiguration `yaml:"solar"`
}
func (Configuration) BatteryScraper ¶
func (Configuration) ClimateScraper ¶
func (Configuration) GridScraper ¶
func (Configuration) SolarScraper ¶
type GridConfiguration ¶
type HomeWizardConfiguration ¶
type HomeWizardConfiguration struct {
Addr string `yaml:"addr" help:"HomeWizard address"`
}
type SigEnergyConfiguration ¶
type SigEnergyConfiguration struct {
Addr string `yaml:"addr" help:"SigEnergy address"`
}
type SlackConfiguration ¶
type SolarConfiguration ¶
type SolarConfiguration struct {
Type string `yaml:"type" default:"solaredge" help:"Solar type"`
Store SolarStoreConfiguration `yaml:"store"`
Interval time.Duration `yaml:"interval" default:"5m" help:"Solar poll interval"`
Enabled bool `yaml:"enabled" default:"false" help:"Enable solar collector"`
}
type SolarEdgeConfiguration ¶
type SolarEdgeConfiguration struct {
Key string `yaml:"key" help:"SolarEdge API key"`
}
type SolarStoreConfiguration ¶
type TadoConfiguration ¶
type WatchdogConfiguration ¶
Click to show internal directories.
Click to hide internal directories.