config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 10 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 ButtonConfig added in v1.4.0

type ButtonConfig struct {
	Name    string          `yaml:"name"`
	Command []string        `yaml:"command"`
	Timeout time.Duration   `yaml:"timeout"`
	HA      *HAButtonConfig `yaml:"ha,omitempty"`
}

type Config

type Config struct {
	Log     LogConfig               `yaml:"log"`
	MQTT    MQTTConfig              `yaml:"mqtt"`
	Agent   AgentConfig             `yaml:"agent"`
	Sensors map[string]SensorConfig `yaml:"sensors"`
	Buttons map[string]ButtonConfig `yaml:"buttons"`
}

func LoadAndValidate

func LoadAndValidate(path string) (Config, error)

func LoadConfig

func LoadConfig(path string) (Config, error)

type HAButtonConfig added in v1.4.0

type HAButtonConfig struct {
	Icon string `yaml:"icon,omitempty"`
}

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 LogBatchConfig added in v1.3.0

type LogBatchConfig struct {
	MaxItems int           `yaml:"max_items"`
	MaxWait  time.Duration `yaml:"max_wait"`
}

type LogConfig added in v1.3.0

type LogConfig struct {
	Level string    `yaml:"level"`
	Sinks []LogSink `yaml:"sinks"`
}

type LogSink added in v1.3.0

type LogSink struct {
	Type string `yaml:"type"`
	Name string `yaml:"name"`

	Level string `yaml:"level"`

	Addr string `yaml:"addr"`

	URL     string            `yaml:"url"`
	Method  string            `yaml:"method"`
	Timeout time.Duration     `yaml:"timeout"`
	Headers map[string]string `yaml:"headers"`

	Codec string `yaml:"codec"`

	QueueSize int             `yaml:"queue_size"`
	Batch     *LogBatchConfig `yaml:"batch,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