More changes
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 25s
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 25s
This commit is contained in:
18
vehicle.go
18
vehicle.go
@ -518,26 +518,20 @@ func (v *Vehicle) GetClimateQuickPresets() {
|
||||
|
||||
// re1 := regexp.MustCompile(`\"`)
|
||||
// result := re1.ReplaceAllString(string(tmp.Data), "")
|
||||
re := regexp.MustCompile(`\\\\`)
|
||||
re := regexp.MustCompile(`\\`)
|
||||
result := re.ReplaceAllString(string(tmp.Data), ``) // \u0022
|
||||
v.client.logger.Debug("quick climate preset after trimming", "request", "GetClimateQuickPresets", "body", result)
|
||||
|
||||
var cProfiles []ClimateProfile
|
||||
err = json.Unmarshal([]byte(result), &cProfiles)
|
||||
var cProfile ClimateProfile
|
||||
err = json.Unmarshal([]byte(result), &cProfile)
|
||||
if err != nil {
|
||||
v.client.logger.Error("error while parsing climate quick presets json", "request", "GetClimateQuickPresets", "error", err.Error())
|
||||
}
|
||||
|
||||
if len(cProfiles) > 0 {
|
||||
for _, cp := range cProfiles {
|
||||
if _, ok := v.ClimateProfiles[cp.PresetType+cp.Name]; ok {
|
||||
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
||||
} else {
|
||||
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
||||
}
|
||||
}
|
||||
if _, ok := v.ClimateProfiles[cProfile.PresetType+cProfile.Name]; ok {
|
||||
v.ClimateProfiles[cProfile.PresetType+cProfile.Name] = cProfile
|
||||
} else {
|
||||
v.client.logger.Debug("didn't find any climate quick presets")
|
||||
v.ClimateProfiles[cProfile.PresetType+cProfile.Name] = cProfile
|
||||
}
|
||||
v.Updated = time.Now()
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user