A new way to trimm
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s

This commit is contained in:
2025-05-29 23:32:54 -04:00
parent 3734003b70
commit 9d16051385

View File

@ -482,11 +482,15 @@ func (v *Vehicle) GetClimatePresets() {
v.client.logger.Debug("subaru climate presets http output", "body", resp)
tmp := strings.Replace(string(resp), `\\\"`, `"`, -1)
tmp = strings.Replace(tmp, `}\",\"{`, `},{`, -1)
tmp = strings.Replace(tmp, `[\"{`, `[{`, -1)
tmp = strings.Replace(tmp, ` }\"]`, `}]`, -1)
tmp = strings.Replace(tmp, `\"`, `"`, -1)
tmp := strings.ReplaceAll(string(resp), `\\\"`, `"`)
v.client.logger.Debug("subaru climate presets after trimming #1", "body", tmp)
tmp = strings.ReplaceAll(tmp, `}\",\"{`, `},{`)
v.client.logger.Debug("subaru climate presets after trimming #2", "body", tmp)
tmp = strings.ReplaceAll(tmp, `[\"{`, `[{`)
v.client.logger.Debug("subaru climate presets after trimming #3", "body", tmp)
tmp = strings.ReplaceAll(tmp, ` }\"]`, `}]`)
v.client.logger.Debug("subaru climate presets after trimming #4", "body", tmp)
tmp = strings.ReplaceAll(tmp, `\"`, `"`)
v.client.logger.Debug("subaru climate presets after trimming", "body", tmp)