Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface {
Perform(a aha) error
}
Action is one operation on the home automation system.
type Applier ¶
type Applier interface {
// Apply performs the changes necessary to transition from src to target configuration. If the target plan
// could be realized, it returns an error. If the plan was applied successfully, it returns null.
Apply(src, target *Plan) error
}
Applier defines the interface to apply a plan to the AHA system.
func AhaAPIApplier ¶
func AhaAPIApplier(f aha) Applier
AhaAPIApplier is an Applier that performs changes to the AHA system via the HTTP API.
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter allows exporting of a Plan.
func ExporterTo ¶
ExporterTo creates an Exporter, which writes to the given io.Writer.
type Plan ¶
type Plan struct {
Switches []Switch // The power switches.
Thermostats []Thermostat // The HKR devices.
}
Plan represents the data model of an absolute state of the fritz smart home.
func ConvertDevicelist ¶
func ConvertDevicelist(l *fritz.Devicelist) *Plan
ConvertDevicelist converts a fritz.Devicelist to a Plan.
type Planner ¶
Planner represents an execution planner, returning actions to transition from a src to a target state.
func TargetBasedPlanner ¶
func TargetBasedPlanner(scf switchCommandFactory, tcf thermostatCommandFactory) Planner
TargetBasedPlanner creates a Planner that only focuses on target state. Devices in the source state that are not referenced in the target will be left untouched.
type Switch ¶
type Switch struct {
Name string // Name of the switch.
State bool // On (true) or off (false).
// contains filtered or unexported fields
}
Switch represents the state of a switch.
type Thermostat ¶
type Thermostat struct {
Name string // Name of the device.
Temperature float64 // The temperature in °C.
// contains filtered or unexported fields
}
Thermostat represents the state of a HKR device.