mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-06 01:15:10 -06:00
add climate service
This commit is contained in:
@@ -7,3 +7,27 @@ type NotifyRequest struct {
|
||||
Title string
|
||||
Data map[string]any
|
||||
}
|
||||
|
||||
type SetTemperatureRequest struct {
|
||||
Temperature float32
|
||||
TargetTempHigh float32
|
||||
TargetTempLow float32
|
||||
HvacMode string
|
||||
}
|
||||
|
||||
func (r *SetTemperatureRequest) ToJSON() map[string]any {
|
||||
m := map[string]any{}
|
||||
if r.Temperature != 0 {
|
||||
m["temperature"] = r.Temperature
|
||||
}
|
||||
if r.TargetTempHigh != 0 {
|
||||
m["target_temp_high"] = r.TargetTempHigh
|
||||
}
|
||||
if r.TargetTempLow != 0 {
|
||||
m["target_temp_low"] = r.TargetTempLow
|
||||
}
|
||||
if r.HvacMode != "" {
|
||||
m["hvac_mode"] = r.HvacMode
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user