package alamo type reportedControl struct { Settings controlSettings `json:"settings"` CurrentTemperature float64 `json:"current_temperature"` FloorTemperature float64 `json:"floor_temperature"` Action string `json:"action"` Locked bool `json:"locked"` } func newReportedControl(state State) reportedControl { mode := "off" action := "off" if state.Power { mode = "heat" action = "idle" if state.Active { action = "heating" } } return reportedControl{ Settings: controlSettings{ Mode: mode, TargetTemperature: state.TargetTemperature, }, CurrentTemperature: state.CurrentTemperature, FloorTemperature: state.FloorTemperature, Action: action, Locked: state.Locked, } }