forked from brutella/hap
-
Notifications
You must be signed in to change notification settings - Fork 2
/
cooler.go
46 lines (36 loc) · 1.33 KB
/
cooler.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
package service
import (
"github.com/LUJUNQUAN/hap/characteristic"
)
type Cooler struct {
*S
Active *characteristic.Active
CurrentHeaterCoolerState *characteristic.CurrentHeaterCoolerState
TargetHeaterCoolerState *characteristic.TargetHeaterCoolerState
CurrentTemperature *characteristic.CurrentTemperature
CoolingThresholdTemperature *characteristic.CoolingThresholdTemperature
}
func NewCooler() *Cooler {
s := Cooler{}
s.S = New(TypeHeaterCooler)
s.Active = characteristic.NewActive()
s.AddC(s.Active.C)
s.CurrentHeaterCoolerState = characteristic.NewCurrentHeaterCoolerState()
s.CurrentHeaterCoolerState.ValidVals = []int{
characteristic.CurrentHeaterCoolerStateInactive,
characteristic.CurrentHeaterCoolerStateIdle,
characteristic.CurrentHeaterCoolerStateCooling,
}
s.AddC(s.CurrentHeaterCoolerState.C)
s.TargetHeaterCoolerState = characteristic.NewTargetHeaterCoolerState()
s.TargetHeaterCoolerState.ValidVals = []int{
characteristic.TargetHeaterCoolerStateAuto,
characteristic.TargetHeaterCoolerStateCool,
}
s.AddC(s.TargetHeaterCoolerState.C)
s.CurrentTemperature = characteristic.NewCurrentTemperature()
s.AddC(s.CurrentTemperature.C)
s.CoolingThresholdTemperature = characteristic.NewCoolingThresholdTemperature()
s.AddC(s.CoolingThresholdTemperature.C)
return &s
}