controllers

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Zones map[string][]RuleConfiguration `yaml:"zones"`
	Home  []RuleConfiguration            `yaml:"home"`
}

func LoadRules

func LoadRules(path string) (Configuration, error)

type Controllers

type Controllers struct {
	// contains filtered or unexported fields
}

func NewControllers

func NewControllers(cfg Configuration, subscriber pubsub.Subscriber[collector.Update], tadoClient TadoClient, n notifier.Notifier, logger *slog.Logger) (*Controllers, error)

NewControllers creates a new Controllers instance, with the home & zone controllers required by the Configuration.

func (*Controllers) IsHealthy

func (c *Controllers) IsHealthy(ctx context.Context) error

func (*Controllers) ReportTasks

func (c *Controllers) ReportTasks() []string

func (*Controllers) Run

func (c *Controllers) Run(ctx context.Context) error

type Results

type Results []result

func ValidateHomeRule

func ValidateHomeRule(script io.Reader, actionOnly bool) (Results, error)

func ValidateZoneRule

func ValidateZoneRule(script io.Reader, actionOnly bool) (Results, error)

func (Results) WriteTo

func (r Results) WriteTo(w io.Writer) (int64, error)

type RuleConfiguration

type RuleConfiguration struct {
	Script ScriptConfig `yaml:"script"`
	Name   string       `yaml:"name"`
	Users  []string     `yaml:"users,omitempty"`
}

type ScriptConfig

type ScriptConfig struct {
	Packaged string `yaml:"packaged,omitempty"`
	Text     string `yaml:"text,omitempty"`
	Path     string `yaml:"path,omitempty"`
}

type TadoClient

type TadoClient interface {
	SetZoneOverlayWithResponse(ctx context.Context, homeId tado.HomeId, zoneId tado.ZoneId, body tado.SetZoneOverlayJSONRequestBody, reqEditors ...tado.RequestEditorFn) (*tado.SetZoneOverlayResponse, error)
	DeleteZoneOverlayWithResponse(ctx context.Context, homeId tado.HomeId, zoneId tado.ZoneId, reqEditors ...tado.RequestEditorFn) (*tado.DeleteZoneOverlayResponse, error)
	DeletePresenceLockWithResponse(ctx context.Context, homeId tado.HomeId, reqEditors ...tado.RequestEditorFn) (*tado.DeletePresenceLockResponse, error)
	SetPresenceLockWithResponse(ctx context.Context, homeId tado.HomeId, body tado.SetPresenceLockJSONRequestBody, reqEditors ...tado.RequestEditorFn) (*tado.SetPresenceLockResponse, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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