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

This commit is contained in:
2025-05-30 13:38:14 -04:00
parent f2f1f8380e
commit 2dbab08d08

View File

@ -497,14 +497,13 @@ func (v *Vehicle) GetClimatePresets() {
}
v.client.logger.Debug("subaru climate presets parsed http output", "body", string(tmp.Data))
unescapedJSON, err := strconv.Unquote(string(tmp.Data))
if err != nil {
fmt.Println("Error unquoting:", err)
return
}
re1 := regexp.MustCompile(`([\\]["])`)
result := re1.ReplaceAllString(string(tmp.Data), "")
re2 := regexp.MustCompile(`([\\\\])`)
result = re2.ReplaceAllString(result, "")
var cProfiles []ClimateProfile
err = json.Unmarshal([]byte(unescapedJSON), &cProfiles)
err = json.Unmarshal([]byte(result), &cProfiles)
if err != nil {
v.client.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
}