Changed the way of naming climate profiles
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s
This commit is contained in:
21
vehicle.go
21
vehicle.go
@ -458,11 +458,6 @@ func (v *Vehicle) GetClimatePresets() {
|
||||
reqURL := MOBILE_API_VERSION + apiURLs["API_G2_FETCH_RES_SUBARU_PRESETS"]
|
||||
resp := v.client.execute(reqURL, GET, map[string]string{}, "", false)
|
||||
|
||||
// var r Response
|
||||
// err := json.Unmarshal(resp, &r)
|
||||
// if err != nil {
|
||||
// v.client.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
|
||||
// }
|
||||
if r, ok := v.client.parseResponse(resp); ok {
|
||||
|
||||
re1 := regexp.MustCompile(`\"`)
|
||||
@ -479,7 +474,7 @@ func (v *Vehicle) GetClimatePresets() {
|
||||
if len(cProfiles) > 0 {
|
||||
for _, cp := range cProfiles {
|
||||
re := regexp.MustCompile(`([A-Z])`)
|
||||
cpn := re.ReplaceAllString(cp.PresetType, "_$1") + "_" + strings.ReplaceAll(cp.Name, " ", "_")
|
||||
cpn := strings.ToLower(re.ReplaceAllString(cp.PresetType, "_$1") + "_" + strings.ReplaceAll(cp.Name, " ", "_"))
|
||||
|
||||
if v.isEV() && cp.VehicleType == "phev" {
|
||||
if _, ok := v.ClimateProfiles[cpn]; ok {
|
||||
@ -523,11 +518,6 @@ func (v *Vehicle) GetClimateQuickPresets() {
|
||||
resp := v.client.execute(reqURL, GET, map[string]string{}, "", false)
|
||||
// v.client.logger.Debug("http request output", "request", "GetClimateQuickPresets", "body", resp)
|
||||
|
||||
// var r Response
|
||||
// err := json.Unmarshal(resp, &r)
|
||||
// if err != nil {
|
||||
// v.client.logger.Error("error while parsing json", "request", "GetClimateQuickPresets", "error", err.Error())
|
||||
// }
|
||||
if r, ok := v.client.parseResponse(resp); ok {
|
||||
|
||||
re1 := regexp.MustCompile(`\"`)
|
||||
@ -542,7 +532,7 @@ func (v *Vehicle) GetClimateQuickPresets() {
|
||||
}
|
||||
|
||||
re := regexp.MustCompile(`([A-Z])`)
|
||||
cpn := re.ReplaceAllString(cp.PresetType, "_$1") + "_quick_" + strings.ReplaceAll(cp.Name, " ", "_")
|
||||
cpn := strings.ToLower("quick_" + re.ReplaceAllString(cp.PresetType, "_$1") + "_" + strings.ReplaceAll(cp.Name, " ", "_"))
|
||||
|
||||
if _, ok := v.ClimateProfiles[cpn]; ok {
|
||||
v.ClimateProfiles[cpn] = cp
|
||||
@ -563,11 +553,6 @@ func (v *Vehicle) GetClimateUserPresets() {
|
||||
reqURL := MOBILE_API_VERSION + apiURLs["API_G2_FETCH_RES_USER_PRESETS"]
|
||||
resp := v.client.execute(reqURL, GET, map[string]string{}, "", false)
|
||||
|
||||
// var r Response
|
||||
// err := json.Unmarshal(resp, &r)
|
||||
// if err != nil {
|
||||
// v.client.logger.Error("error while parsing json", "request", "GetClimateUserPresets", "error", err.Error())
|
||||
// }
|
||||
if r, ok := v.client.parseResponse(resp); ok {
|
||||
|
||||
re1 := regexp.MustCompile(`\"`)
|
||||
@ -584,7 +569,7 @@ func (v *Vehicle) GetClimateUserPresets() {
|
||||
if len(cProfiles) > 0 {
|
||||
for _, cp := range cProfiles {
|
||||
re := regexp.MustCompile(`([A-Z])`)
|
||||
cpn := re.ReplaceAllString(cp.PresetType, "_$1") + "_" + strings.ReplaceAll(cp.Name, " ", "_")
|
||||
cpn := strings.ToLower(re.ReplaceAllString(cp.PresetType, "_$1") + "_" + strings.ReplaceAll(cp.Name, " ", "_"))
|
||||
|
||||
if _, ok := v.ClimateProfiles[cpn]; ok {
|
||||
v.ClimateProfiles[cpn] = cp
|
||||
|
Reference in New Issue
Block a user