More changes
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 22s
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 22s
This commit is contained in:
71
vehicle.go
71
vehicle.go
@ -504,49 +504,36 @@ func (v *Vehicle) GetClimatePresets() {
|
|||||||
v.client.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
|
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)
|
v.client.logger.Debug("subaru climate presets parsed http output", "body", cProfiles)
|
||||||
// respParsed, err := gabs.ParseJSON([]byte(resp))
|
|
||||||
// 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", respParsed)
|
|
||||||
|
|
||||||
// tmp1 := strings.ReplaceAll(string(resp), "\\\\"", "\"")
|
if len(cProfiles) > 0 {
|
||||||
// v.client.logger.Debug("subaru climate presets after trimming #1", "body", tmp1)
|
for _, cp := range cProfiles {
|
||||||
// tmp2 := strings.ReplaceAll(tmp1, `}\",\"{`, `},{`)
|
if v.isEV() && cp.VehicleType == "phev" {
|
||||||
// v.client.logger.Debug("subaru climate presets after trimming #2", "body", tmp2)
|
if _, ok := v.ClimateProfiles[cp.PresetType+cp.Name]; ok {
|
||||||
// tmp3 := strings.ReplaceAll(tmp2, `[\"{`, `[{`)
|
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
||||||
// v.client.logger.Debug("subaru climate presets after trimming #3", "body", tmp3)
|
} else {
|
||||||
// tmp4 := strings.ReplaceAll(tmp3, ` }\"]`, `}]`)
|
if _, ok := v.ClimateProfiles[cp.PresetType+cp.Name]; ok {
|
||||||
// v.client.logger.Debug("subaru climate presets after trimming #4", "body", tmp4)
|
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
||||||
// tmp5 := strings.ReplaceAll(tmp4, `\"`, `"`)
|
} else {
|
||||||
|
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
||||||
// v.client.logger.Debug("subaru climate presets before trimming", "body", respParsed)
|
}
|
||||||
|
}
|
||||||
// // ONLY FOR THAT REQUEST BECAUSE OF API SENDS BACK ESCAPING DATA IN DATA FIELD
|
}
|
||||||
// data, ok := respParsed.Path("data").Data().(string)
|
if !v.isEV() && cp.VehicleType == "gas" {
|
||||||
// if !ok {
|
if _, ok := v.ClimateProfiles[cp.PresetType+cp.Name]; ok {
|
||||||
// v.client.logger.Error("error while parsing data json", "request", "GetClimatePresets", "error", err.Error())
|
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
||||||
// }
|
} else {
|
||||||
|
if _, ok := v.ClimateProfiles[cp.PresetType+cp.Name]; ok {
|
||||||
// var cProfiles []ClimateProfile
|
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
||||||
// err = json.Unmarshal([]byte(data), &cProfiles)
|
} else {
|
||||||
// if err != nil {
|
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
||||||
// v.client.logger.Error("error while parsing climate subaru presets json", "request", "GetClimatePresets", "error", err.Error())
|
}
|
||||||
// }
|
}
|
||||||
// v.client.logger.Debug("climate subaru presets", "data", data)
|
}
|
||||||
|
}
|
||||||
// if len(cProfiles) > 0 {
|
} else {
|
||||||
// for _, cp := range cProfiles {
|
v.client.logger.Debug("didn't find any climate quick presets")
|
||||||
// if _, ok := v.ClimateProfiles[cp.PresetType+cp.Name]; ok {
|
}
|
||||||
// v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
v.Updated = time.Now()
|
||||||
// } else {
|
|
||||||
// v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// v.client.logger.Debug("didn't find any climate subaru presets")
|
|
||||||
// }
|
|
||||||
// v.Updated = time.Now()
|
|
||||||
} else {
|
} else {
|
||||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user