app

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BacnetConfig

type BacnetConfig struct {
	Enabled        bool          `koanf:"enabled" json:"enabled" yaml:"enabled"`
	Addr           string        `koanf:"addr" json:"addr" yaml:"addr"`
	SyncInterval   time.Duration `koanf:"sync_interval" json:"sync_interval" yaml:"sync_interval"`
	DeviceInstance int           `koanf:"device_instance" json:"device_instance" yaml:"device_instance"`
}

type Config

type Config struct {
	DeviceID string `koanf:"device_id" json:"device_id" yaml:"device_id"`

	// Convenience keys:
	// If Controller is set, only that controller is enabled (http|mqtt|modbus).
	// If Addr is set alongside Controller, it is copied to the chosen controller's addr.
	Controller string `koanf:"controller" json:"controller" yaml:"controller"`
	Addr       string `koanf:"addr" json:"addr" yaml:"addr"`

	Controllers struct {
		HTTP   HTTPConfig   `koanf:"http" json:"http" yaml:"http"`
		MQTT   MQTTConfig   `koanf:"mqtt" json:"mqtt" yaml:"mqtt"`
		MODBUS Modbusconfig `koanf:"modbus" json:"modbus" yaml:"modbus"`
		BACNET BacnetConfig `koanf:"bacnet" json:"bacnet" yaml:"bacnet"`
		KNX    KNXConfig    `koanf:"knx" json:"knx" yaml:"knx"`
	} `koanf:"controllers" json:"controllers" yaml:"controllers"`

	Thermostat ThermostatConfig      `koanf:"thermostat" json:"thermostat" yaml:"thermostat"`
	Regulator  RegulatorConfig       `koanf:"regulator" json:"regulator" yaml:"regulator"`
	HeatLoss   HeatLossConfig        `koanf:"heat_loss" json:"heat_loss" yaml:"heat_loss"`
	Weather    WeatherProviderConfig `koanf:"weather_provider" json:"weather_provider" yaml:"weather_provider"`
	Logging    logging.Config        `koanf:"logging" json:"logging" yaml:"logging"`
}

func LoadConfig

func LoadConfig(path string) (Config, error)

func (Config) HeatLossParams

func (c Config) HeatLossParams() (thermostat.HeatLossSimulatorParams, error)

func (Config) RegulatorParams

func (c Config) RegulatorParams() (thermostat.PIDRegulatorParams, error)

func (Config) Snapshot

func (c Config) Snapshot() (thermostat.Snapshot, error)

func (Config) WeatherProvider added in v0.9.0

func (c Config) WeatherProvider(logger *slog.Logger) (thermostat.WeatherProvider, error)

WeatherProvider builds the provider selected by weather_provider.type.

type HTTPConfig

type HTTPConfig struct {
	Enabled bool   `koanf:"enabled" json:"enabled" yaml:"enabled"`
	Addr    string `koanf:"addr" json:"addr" yaml:"addr"`
}

type HeatLossConfig

type HeatLossConfig struct {
	Coefficient        float64 `koanf:"coefficient" json:"coefficient" yaml:"coefficient"`
	OutdoorTemperature float64 `koanf:"outdoor_temperature" json:"outdoor_temperature" yaml:"outdoor_temperature"`
}

type KNXConfig

type KNXConfig struct {
	Enabled         bool          `koanf:"enabled" json:"enabled" yaml:"enabled"`
	Addr            string        `koanf:"addr" json:"addr" yaml:"addr"`
	PublishInterval time.Duration `koanf:"publish_interval" json:"publish_interval" yaml:"publish_interval"`
	GAMain          int           `koanf:"ga_main" json:"ga_main" yaml:"ga_main"`
	GAMiddle        int           `koanf:"ga_middle" json:"ga_middle" yaml:"ga_middle"`
}

type MQTTConfig

type MQTTConfig struct {
	Enabled         bool          `koanf:"enabled" json:"enabled" yaml:"enabled"`
	Addr            string        `koanf:"addr" json:"addr" yaml:"addr"`
	ClientID        string        `koanf:"client_id" json:"client_id" yaml:"client_id"`
	BaseTopic       string        `koanf:"base_topic" json:"base_topic" yaml:"base_topic"`
	QoS             byte          `koanf:"qos" json:"qos" yaml:"qos"`
	RetainSnapshot  bool          `koanf:"retain_snapshot" json:"retain_snapshot" yaml:"retain_snapshot"`
	PublishMode     string        `koanf:"publish_mode" json:"publish_mode" yaml:"publish_mode"`
	PublishInterval time.Duration `koanf:"publish_interval" json:"publish_interval" yaml:"publish_interval"`
	Username        string        `koanf:"username" json:"username" yaml:"username"`
	Password        string        `koanf:"password" json:"password" yaml:"password"`
}

type Modbusconfig

type Modbusconfig struct {
	Enabled       bool          `koanf:"enabled" json:"enabled" yaml:"enabled"`
	Addr          string        `koanf:"addr" json:"addr" yaml:"addr"`
	UnitID        byte          `koanf:"unit_id" json:"unit_id" yaml:"unit_id"`
	SyncInterval  time.Duration `koanf:"sync_interval" json:"sync_interval" yaml:"sync_interval"`
	RegisterCount int           `koanf:"register_count" json:"register_count" yaml:"register_count"` // 1 or 2 (registers per float value)
}

type OpenMeteoWeatherConfig added in v0.9.0

type OpenMeteoWeatherConfig struct {
	Latitude  float64 `koanf:"latitude" json:"latitude" yaml:"latitude"`
	Longitude float64 `koanf:"longitude" json:"longitude" yaml:"longitude"`
}

type RegulatorConfig

type RegulatorConfig struct {
	Interval             time.Duration `koanf:"interval" json:"interval" yaml:"interval"`
	Kp                   float64       `koanf:"kp" json:"kp" yaml:"kp"`
	Ki                   float64       `koanf:"ki" json:"ki" yaml:"ki"`
	Kd                   float64       `koanf:"kd" json:"kd" yaml:"kd"`
	TargetHysteresis     float64       `koanf:"target_hysteresis" json:"target_hysteresis" yaml:"target_hysteresis"`
	ModeChangeHysteresis float64       `koanf:"mode_change_hysteresis" json:"mode_change_hysteresis" yaml:"mode_change_hysteresis"`
}

type StaticWeatherConfig added in v0.9.0

type StaticWeatherConfig struct {
	// Falls back to heat_loss.outdoor_temperature when nil.
	OutdoorTemperature *float64 `koanf:"outdoor_temperature" json:"outdoor_temperature" yaml:"outdoor_temperature"`
}

type ThermostatConfig

type ThermostatConfig struct {
	Enabled            *bool    `koanf:"enabled" json:"enabled" yaml:"enabled"`
	AmbientTemperature *float64 `koanf:"ambient_temperature" json:"ambient_temperature" yaml:"ambient_temperature"`

	Setpoint    *float64 `koanf:"temperature_setpoint" json:"temperature_setpoint" yaml:"temperature_setpoint"`
	SetpointMin *float64 `koanf:"temperature_setpoint_min" json:"temperature_setpoint_min" yaml:"temperature_setpoint_min"`
	SetpointMax *float64 `koanf:"temperature_setpoint_max" json:"temperature_setpoint_max" yaml:"temperature_setpoint_max"`

	Mode     *string `koanf:"mode" json:"mode" yaml:"mode"`                // "heat" | "cool" | "fan" | "auto"
	FanSpeed *string `koanf:"fan_speed" json:"fan_speed" yaml:"fan_speed"` // "auto" | "low" | "medium" | "high"

	FaultCode *int `koanf:"fault_code" json:"fault_code" yaml:"fault_code"`
}

type WeatherProviderConfig added in v0.9.0

type WeatherProviderConfig struct {
	Type            string        `koanf:"type" json:"type" yaml:"type"` // static | open-meteo
	RefreshInterval time.Duration `koanf:"refresh_interval" json:"refresh_interval" yaml:"refresh_interval"`

	Static    StaticWeatherConfig    `koanf:"static" json:"static" yaml:"static"`
	OpenMeteo OpenMeteoWeatherConfig `koanf:"open_meteo" json:"open_meteo" yaml:"open_meteo"`
}

Jump to

Keyboard shortcuts

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