More changes
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 24s

This commit is contained in:
2025-05-30 12:39:23 -04:00
parent 421b80523d
commit 193a60d1f1

View File

@ -486,26 +486,19 @@ func (v *Vehicle) GetClimatePresets() {
v.client.logger.Debug("subaru climate presets http output", "body", resp)
tmp := struct {
Success bool `json:"success"`
ErrorCode string `json:"errorCode"`
DataName string `json:"dataName"`
Data json.RawMessage `json:"data"`
Success bool `json:"success"`
ErrorCode string `json:"errorCode"`
DataName string `json:"dataName"`
Data []ClimateProfile `json:"data"`
}{}
err := json.Unmarshal(resp, &tmp)
if err != nil {
v.client.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
}
v.client.logger.Debug("subaru climate presets parsed http output", "body", string(tmp.Data))
v.client.logger.Debug("subaru climate presets parsed http output", "body", tmp)
var cProfiles []ClimateProfile
err = json.Unmarshal([]byte(tmp.Data), &cProfiles)
if err != nil {
v.client.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
}
v.client.logger.Debug("subaru climate presets parsed http output", "body", cProfiles)
if len(cProfiles) > 0 {
for _, cp := range cProfiles {
if len(tmp.Data) > 0 {
for _, cp := range tmp.Data {
if v.isEV() && cp.VehicleType == "phev" {
if _, ok := v.ClimateProfiles[cp.PresetType+cp.Name]; ok {
v.ClimateProfiles[cp.PresetType+cp.Name] = cp