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
consts.go
18
consts.go
@ -135,24 +135,24 @@ var features = map[string]string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var troubles = map[string]string{
|
var troubles = map[string]string{
|
||||||
|
"SRS_MIL": "Airbag System",
|
||||||
|
"AWD_MIL": "All-Wheel Drive / Symmetrical Full-Time ",
|
||||||
"ABS_MIL": "Anti-Lock Braking System",
|
"ABS_MIL": "Anti-Lock Braking System",
|
||||||
|
"ISS_MIL": "Auto Start Stop (Idling Stop System)",
|
||||||
"AHBL_MIL": "Automatic Headlight Beam Leveler",
|
"AHBL_MIL": "Automatic Headlight Beam Leveler",
|
||||||
"ATF_MIL": "Automatic Transmission Oil Temperature",
|
"ATF_MIL": "Automatic Transmission Oil Temperature",
|
||||||
"AWD_MIL": "Symmetrical Full-Time AWD",
|
"EBD_MIL": "Brake System / Electronic Brake Force Distribution",
|
||||||
"BSDRCT_MIL": "Blind-Spot Detection",
|
"BSDRCT_MIL": "Blind-Spot Detection",
|
||||||
"CEL_MIL": "Check Engine Light",
|
"CEL_MIL": "Check Engine Light",
|
||||||
"EBD_MIL": "Electronic Brake Force Distribution",
|
|
||||||
"EOL_MIL": "Engine Oil Level",
|
"EOL_MIL": "Engine Oil Level",
|
||||||
"EPAS_MIL": "Electric Power Assisted Steering",
|
|
||||||
"EPB_MIL": "Parking Brake",
|
|
||||||
"ESS_MIL": "EyeSight Exclusive Advanced Driver-Assist System",
|
"ESS_MIL": "EyeSight Exclusive Advanced Driver-Assist System",
|
||||||
"ISS_MIL": "iss",
|
"TEL_MIL": "MySubau Emergency Services",
|
||||||
|
"EPB_MIL": "Parking Brake",
|
||||||
"OPL_MIL": "Oil Pressure",
|
"OPL_MIL": "Oil Pressure",
|
||||||
|
"EPAS_MIL": "Power Steering / Electric Power Assisted Steering",
|
||||||
"RAB_MIL": "Reverse Auto Braking",
|
"RAB_MIL": "Reverse Auto Braking",
|
||||||
"SRH_MIL": "Steering Responsive Headlights",
|
"SRH_MIL": "Steering Responsive Headlights (SRH)",
|
||||||
"SRS_MIL": "Airbag System",
|
"TPMS_MIL": "Tire Pressure",
|
||||||
"TEL_MIL": "telematics",
|
|
||||||
"TPMS_MIL": "tpms",
|
|
||||||
"VDC_MIL": "Vehicle Dynamics Control",
|
"VDC_MIL": "Vehicle Dynamics Control",
|
||||||
"WASH_MIL": "Windshield Washer Fluid Level",
|
"WASH_MIL": "Windshield Washer Fluid Level",
|
||||||
}
|
}
|
||||||
|
44
vehicle.go
44
vehicle.go
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"slices"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -478,23 +479,23 @@ func (v *Vehicle) GetClimatePresets() {
|
|||||||
for _, cp := range cProfiles {
|
for _, cp := range cProfiles {
|
||||||
if v.isEV() && cp.VehicleType == "phev" {
|
if v.isEV() && cp.VehicleType == "phev" {
|
||||||
if _, ok := v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")]; ok {
|
if _, ok := v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")]; ok {
|
||||||
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")] = cp
|
||||||
} else {
|
} else {
|
||||||
if _, ok := v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")]; ok {
|
if _, ok := v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")]; ok {
|
||||||
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")] = cp
|
||||||
} else {
|
} else {
|
||||||
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")] = cp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !v.isEV() && cp.VehicleType == "gas" {
|
if !v.isEV() && cp.VehicleType == "gas" {
|
||||||
if _, ok := v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")]; ok {
|
if _, ok := v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")]; ok {
|
||||||
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")] = cp
|
||||||
} else {
|
} else {
|
||||||
if _, ok := v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")]; ok {
|
if _, ok := v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")]; ok {
|
||||||
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")] = cp
|
||||||
} else {
|
} else {
|
||||||
v.ClimateProfiles[cp.PresetType+cp.Name] = cp
|
v.ClimateProfiles[cp.PresetType+strings.ReplaceAll(cp.Name, " ", "")] = cp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -625,17 +626,9 @@ func (v *Vehicle) GetVehicleStatus() {
|
|||||||
val := reflect.ValueOf(vs)
|
val := reflect.ValueOf(vs)
|
||||||
typeOfS := val.Type()
|
typeOfS := val.Type()
|
||||||
|
|
||||||
|
badValues := []any{"NOT_EQUIPPED", "UNKNOWN", "None", "16383", "65535", "-64", "", 0, float64(0), nil}
|
||||||
for i := 0; i < val.NumField(); i++ {
|
for i := 0; i < val.NumField(); i++ {
|
||||||
if val.Field(i).Interface() == "NOT_EQUIPPED" ||
|
if slices.Contains(badValues, val.Field(i).Interface()) {
|
||||||
val.Field(i).Interface() == "UNKNOWN" ||
|
|
||||||
val.Field(i).Interface() == "None" ||
|
|
||||||
val.Field(i).Interface() == "16383" ||
|
|
||||||
val.Field(i).Interface() == "65535" ||
|
|
||||||
val.Field(i).Interface() == "-64" ||
|
|
||||||
val.Field(i).Interface() == "" ||
|
|
||||||
val.Field(i).Interface() == 0 ||
|
|
||||||
val.Field(i).Interface() == float64(0) ||
|
|
||||||
val.Field(i).Interface() == nil {
|
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
v.client.logger.Debug("parsing a car part", "field", typeOfS.Field(i).Name, "value", val.Field(i).Interface(), "type", val.Field(i).Type())
|
v.client.logger.Debug("parsing a car part", "field", typeOfS.Field(i).Name, "value", val.Field(i).Interface(), "type", val.Field(i).Type())
|
||||||
@ -682,17 +675,9 @@ func (v *Vehicle) GetVehicleCondition() {
|
|||||||
val := reflect.ValueOf(vc)
|
val := reflect.ValueOf(vc)
|
||||||
typeOfS := val.Type()
|
typeOfS := val.Type()
|
||||||
|
|
||||||
|
badValues := []any{"NOT_EQUIPPED", "UNKNOWN", "None", "16383", "65535", "-64", "", 0, float64(0), nil}
|
||||||
for i := 0; i < val.NumField(); i++ {
|
for i := 0; i < val.NumField(); i++ {
|
||||||
if val.Field(i).Interface() == "NOT_EQUIPPED" ||
|
if slices.Contains(badValues, val.Field(i).Interface()) {
|
||||||
val.Field(i).Interface() == "UNKNOWN" ||
|
|
||||||
val.Field(i).Interface() == "None" ||
|
|
||||||
val.Field(i).Interface() == "16383" ||
|
|
||||||
val.Field(i).Interface() == "65535" ||
|
|
||||||
val.Field(i).Interface() == "-64" ||
|
|
||||||
val.Field(i).Interface() == "" ||
|
|
||||||
val.Field(i).Interface() == 0 ||
|
|
||||||
val.Field(i).Interface() == float64(0) ||
|
|
||||||
val.Field(i).Interface() == nil {
|
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
v.client.logger.Debug("parsing a car part", "field", typeOfS.Field(i).Name, "value", val.Field(i).Interface(), "type", val.Field(i).Type())
|
v.client.logger.Debug("parsing a car part", "field", typeOfS.Field(i).Name, "value", val.Field(i).Interface(), "type", val.Field(i).Type())
|
||||||
@ -731,17 +716,18 @@ func (v *Vehicle) GetVehicleHealth() {
|
|||||||
v.client.logger.Error("error while parsing json", "request", "GetVehicleHealth", "error", err.Error())
|
v.client.logger.Error("error while parsing json", "request", "GetVehicleHealth", "error", err.Error())
|
||||||
}
|
}
|
||||||
v.client.logger.Debug("http request output", "request", "GetVehicleHealth", "vehicle health", vh)
|
v.client.logger.Debug("http request output", "request", "GetVehicleHealth", "vehicle health", vh)
|
||||||
// TODO: Loop over all the Vehicle Health Items
|
|
||||||
for i, vhi := range vh.VehicleHealthItems {
|
for i, vhi := range vh.VehicleHealthItems {
|
||||||
v.client.logger.Debug("vehicle health item", "id", i, "item", vhi)
|
v.client.logger.Debug("vehicle health item", "id", i, "item", vhi)
|
||||||
if vhi.IsTrouble {
|
if vhi.IsTrouble {
|
||||||
// if contains(troubles, vhi.FeatureCode) {}
|
if _, ok := troubles[vhi.FeatureCode]; ok {
|
||||||
|
v.client.logger.Debug("found troubled vehicle health item", "id", i, "item", vhi)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFeaturesList .
|
// GetFeaturesList .
|
||||||
|
Reference in New Issue
Block a user