forked from brutella/hc
/
thermostat.go
48 lines (37 loc) · 1.44 KB
/
thermostat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package model
type HeatCoolModeType byte
const (
HeatCoolModeOff HeatCoolModeType = 0x00
HeatCoolModeHeat HeatCoolModeType = 0x01
HeatCoolModeCool HeatCoolModeType = 0x02
HeatCoolModeAuto HeatCoolModeType = 0x03
)
// A Thermostat is a Thermometer but additionally lets you change the target temperature
// and mode (heating, cooling, auto).
//
// TODO(brutella): The HAP protocol defines additional optional properties (heating- and
// cooling threshold, current and target relative humidity), which are not implemented yet.
// The humidity values are currently defined in the Hygrometer interface, which is not
// implemented yet.
type Thermostat interface {
Thermometer
// SetTargetTemperature sets the target temperature
SetTargetTemperature(float64)
// TargetTemperature returns the target temperature
TargetTemperature() float64
// SetMode sets the current mode
// HeatCoolModeAuto is ignored because the current mode cannot be auto
SetMode(HeatCoolModeType)
// Mode returns the current mode
Mode() HeatCoolModeType
// SetTargetMode sets the target mode
SetTargetMode(HeatCoolModeType)
// TargetMode returns the target mode
TargetMode() HeatCoolModeType
// OnTargetTempChange calls the argument function when the thermostat's
// target temperature is changed
OnTargetTempChange(func(float64))
// OnTargetModeChange calls the argument function when the thermostat's
// target mode is changed
OnTargetModeChange(func(HeatCoolModeType))
}