config

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExampleYAML string

Functions

func SaveExample

func SaveExample(path string) error

func ValidateConfig

func ValidateConfig(cfg Config) error

Types

type AgentConfig

type AgentConfig struct {
	DeviceID     string `yaml:"device_id"`
	DeviceName   string `yaml:"device_name"`
	Manufacturer string `yaml:"manufacturer"`
	Model        string `yaml:"model"`
}

type Config

type Config struct {
	MQTT    MQTTConfig              `yaml:"mqtt"`
	Agent   AgentConfig             `yaml:"agent"`
	Sensors map[string]SensorConfig `yaml:"sensors"`
}

func LoadAndValidate

func LoadAndValidate(path string) (Config, error)

func LoadConfig

func LoadConfig(path string) (Config, error)

type HASensorConfig

type HASensorConfig struct {
	Icon        string `yaml:"icon,omitempty"`
	Unit        string `yaml:"unit,omitempty"`
	DeviceClass string `yaml:"device_class,omitempty"`
	StateClass  string `yaml:"state_class,omitempty"`
}

type MQTTConfig

type MQTTConfig struct {
	Host            string        `yaml:"host"`
	Port            int           `yaml:"port"`
	Username        string        `yaml:"username"`
	Password        string        `yaml:"password"`
	ClientID        string        `yaml:"client_id"`
	DiscoveryPrefix string        `yaml:"discovery_prefix"`
	StatePrefix     string        `yaml:"state_prefix"`
	DefaultInterval time.Duration `yaml:"default_interval"`
}

type SensorConfig

type SensorConfig struct {
	Name          string          `yaml:"name"`
	Interval      time.Duration   `yaml:"interval"`
	IncludeMounts []string        `yaml:"include_mounts,omitempty"`
	HA            *HASensorConfig `yaml:"ha,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL