controller

package
v0.0.0-...-5657e6c Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidEvent  = errors.New("invalid event")
	ErrEventNotFound = errors.New("event not found")
)
View Source
var DataDir string

Functions

This section is empty.

Types

type Action

type Action uint8
const (
	Off Action = iota
	On
	SetTarget
	IncreaseTarget
	DecreaseTarget
)

func (Action) MarshalText

func (a Action) MarshalText() ([]byte, error)

func (Action) String

func (i Action) String() string

func (*Action) UnmarshalText

func (a *Action) UnmarshalText(data []byte) error

type Controller

type Controller struct {
	SensorsByName map[string]sensor.Sensor
	SensorsByID   map[string]sensor.Sensor
	Zones         map[string]*Zone
}

func New

func New() *Controller

func (*Controller) AddSensor

func (c *Controller) AddSensor(name string, s sensor.Sensor)

func (*Controller) AddZone

func (c *Controller) AddZone(z *Zone)

func (*Controller) Setup

func (c *Controller) Setup(cfg *config.Config) error

type Event

type Event struct {
	Time        units.TimeOfDay   `json:"time"`
	Action      Action            `json:"action"`
	ThermAction *ThermostatAction `json:"therm_action,omitempty"`
}

func (Event) NextOccurance

func (e Event) NextOccurance() time.Time

func (Event) String

func (e Event) String() string

func (Event) Valid

func (e Event) Valid() bool

type EventHandler

type EventHandler interface {
	AddEvent(Event) error
	ReplaceEvent(units.TimeOfDay, Event) error
	RemoveEvent(units.TimeOfDay) error
	FindEvent(units.TimeOfDay) (Event, bool)
	ReadEvents() []Event
	NextEvent() *Event

	Boost(time.Duration)
	CancelBoost()
	Boosted() bool
}

func NewEventHandler

func NewEventHandler(s scheduler.Scheduler, demand func(Event)) EventHandler

type ThermostatAction

type ThermostatAction struct {
	Action Action            `json:"action"`
	Param  units.Temperature `json:"param"`
}

func (ThermostatAction) Apply

func (ThermostatAction) String

func (ta ThermostatAction) String() string

type Zone

type Zone struct {
	ID         string
	Scheduler  scheduler.Scheduler
	Thermostat thermostat.Thermostat
	EventHandler
	// contains filtered or unexported fields
}

func NewZone

func NewZone(id string, out output.Output) *Zone

func (*Zone) Active

func (z *Zone) Active() bool

func (*Zone) Restore

func (z *Zone) Restore() error

func (*Zone) SDemand

func (z *Zone) SDemand() bool

func (*Zone) Save

func (z *Zone) Save() error

func (*Zone) SetupThermostat

func (z *Zone) SetupThermostat(source sensor.Sensor, initialTarget units.Temperature)

func (*Zone) TDemand

func (z *Zone) TDemand() bool

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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