]> git.giacomolli.uk - onehouse/blob - driver/alamo/reported_control.go
Poll and command shared Alamo thermostats
[onehouse] / driver / alamo / reported_control.go
1 package alamo
2
3 type reportedControl struct {
4 Settings controlSettings `json:"settings"`
5 CurrentTemperature float64 `json:"current_temperature"`
6 FloorTemperature float64 `json:"floor_temperature"`
7 Action string `json:"action"`
8 Locked bool `json:"locked"`
9 }
10
11 func newReportedControl(state State) reportedControl {
12 mode := "off"
13 action := "off"
14
15 if state.Power {
16 mode = "heat"
17 action = "idle"
18 if state.Active {
19 action = "heating"
20 }
21 }
22
23 return reportedControl{
24 Settings: controlSettings{
25 Mode: mode,
26 TargetTemperature: state.TargetTemperature,
27 },
28 CurrentTemperature: state.CurrentTemperature,
29 FloorTemperature: state.FloorTemperature,
30 Action: action,
31 Locked: state.Locked,
32 }
33 }