Updated config file and config struct
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s

This commit is contained in:
2025-05-27 22:52:02 -04:00
parent c00d0d4abf
commit ea31ffb651
5 changed files with 266 additions and 659 deletions

View File

@ -35,67 +35,6 @@ var parts = map[string]map[string][]string{
},
}
// {
// "success": true,
// "errorCode": null,
// "dataName": "vehicle",
// "data": {
// "customer": {
// "sessionCustomer": null,
// "email": null,
// "firstName": null,
// "lastName": null,
// "zip": null,
// "oemCustId": null,
// "phone": null
// },
// "stolenVehicle": false,
// "vehicleName": "Subaru Outback LXT",
// "features": ["ATF_MIL","11.6MMAN","ABS_MIL","CEL_MIL","ACCS","RCC","REARBRK","TEL_MIL","VDC_MIL","TPMS_MIL","WASH_MIL","BSDRCT_MIL","OPL_MIL","EYESIGHT","RAB_MIL","SRS_MIL","ESS_MIL","RESCC","EOL_MIL","BSD","EBD_MIL","EPB_MIL","RES","RHSF","AWD_MIL","NAV_TOMTOM","ISS_MIL","RPOIA","EPAS_MIL","RPOI","AHBL_MIL","SRH_MIL","g2"],
// "vin": "4S4BTGND8L3137058",
// "modelYear": "2020",
// "modelCode": "LDJ",
// "engineSize": 2.4,
// "nickname": "Subaru Outback LXT",
// "vehicleKey": 3832950,
// "active": true,
// "licensePlate": "8KV8",
// "licensePlateState": "NJ",
// "email": null,
// "firstName": null,
// "lastName": null,
// "subscriptionFeatures": ["REMOTE","SAFETY","Retail"],
// "accessLevel": -1,
// "zip": null,
// "oemCustId": "CRM-631-HQN48K",
// "vehicleMileage": null,
// "phone": null,
// "userOemCustId": "CRM-631-HQN48K",
// "subscriptionStatus": "ACTIVE",
// "authorizedVehicle": false,
// "preferredDealer": null,
// "cachedStateCode": "NJ",
// "subscriptionPlans": [],
// "needMileagePrompt": false,
// "phev": null,
// "remoteServicePinExist": true,
// "needEmergencyContactPrompt": false,
// "vehicleGeoPosition": {
// "latitude": 40.70018,
// "longitude": -74.40139,
// "speed": null,
// "heading": null,
// "timestamp": 1642538410000
// },
// "extDescrip": "Abyss Blue Pearl",
// "intDescrip": "Gray",
// "modelName": "Outback",
// "transCode": "CVT",
// "provisioned": true,
// "timeZone": "America/New_York"
// }
// }
// Vehicle .
type Vehicle struct {
CarId int64
@ -251,49 +190,14 @@ func (v *Vehicle) String() string {
}
// Lock .
// Send command to lock doors.
// Sends a command to lock doors.
func (v *Vehicle) Lock() {
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640454085449_20_@NGTP",
// "success": false,
// "cancelled": false,
// "remoteServiceType": "lock",
// "remoteServiceState": "started",
// "subState": null,
// "errorCode": null,
// "result": null,
// "updateTime": 1640454085000,
// "vin": "4S4BTGND8L3137058"
// }
// }
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640454085449_20_@NGTP",
// "success": true,
// "cancelled": false,
// "remoteServiceType": "lock",
// "remoteServiceState": "finished",
// "subState": null,
// "errorCode": "null:null",
// "result": null,
// "updateTime": 1640454091000,
// "vin": "4S4BTGND8L3137058"
// }
// }
if v.getRemoteOptionsStatus() {
v.selectVehicle()
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin,
"pin": v.client.credentials.PIN,
"forceKeyInCar": "false"}
reqURL := MOBILE_API_VERSION + urlToGen(apiURLs["API_LOCK"], v.getAPIGen())
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
@ -306,47 +210,12 @@ func (v *Vehicle) Lock() {
// Unlock .
// Send command to unlock doors.
func (v *Vehicle) Unlock() {
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640539133289_19_@NGTP",
// "success": false,
// "cancelled": false,
// "remoteServiceType": "unlock",
// "remoteServiceState": "started",
// "subState": null,
// "errorCode": null,
// "result": null,
// "updateTime": 1640539133000,
// "vin": "4S4BTGND8L3137058"
// }
// }
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640539133289_19_@NGTP",
// "success": true,
// "cancelled": false,
// "remoteServiceType": "unlock",
// "remoteServiceState": "finished",
// "subState": null,
// "errorCode": "null:null",
// "result": null,
// "updateTime": 1640539140000,
// "vin": "4S4BTGND8L3137058"
// }
// }
if v.getRemoteOptionsStatus() {
v.selectVehicle()
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin,
"pin": v.client.credentials.PIN,
"unlockDoorType": "ALL_DOORS_CMD"} // FRONT_LEFT_DOOR_CMD | ALL_DOORS_CMD
reqURL := MOBILE_API_VERSION + urlToGen(apiURLs["API_UNLOCK"], v.getAPIGen())
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
@ -382,50 +251,15 @@ func (v *Vehicle) Unlock() {
// await asyncio.sleep(2)
}
// EngineOn .
// Send command to start engine and set climate control.
// EngineStart .
// Sends a command to start engine and set climate control.
func (v *Vehicle) EngineStart() {
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640456287656_22_@NGTP",
// "success": false,
// "cancelled": false,
// "remoteServiceType": "engineStart",
// "remoteServiceState": "started",
// "subState": null,
// "errorCode": null,
// "result": null,
// "updateTime": 1640456287000,
// "vin": "4S4BTGND8L3137058"
// }
// }
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640456287656_22_@NGTP",
// "success": true,
// "cancelled": false,
// "remoteServiceType": "engineStart",
// "remoteServiceState": "finished",
// "subState": null,
// "errorCode": "null:null",
// "result": null,
// "updateTime": 1640456302000,
// "vin": "4S4BTGND8L3137058"
// }
// }
if v.getRemoteOptionsStatus() {
v.selectVehicle()
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin,
"pin": v.client.credentials.PIN,
"horn": "true",
"climateSettings": "climateSettings", // climateSettings
"climateZoneFrontTemp": "65", // 60-86
@ -447,50 +281,15 @@ func (v *Vehicle) EngineStart() {
}
}
// EngineOff .
// Send command to stop engine.
// EngineStop .
// Sends a command to stop engine.
func (v *Vehicle) EngineStop() {
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640456318773_23_@NGTP",
// "success": false,
// "cancelled": false,
// "remoteServiceType": "engineStop",
// "remoteServiceState": "started",
// "subState": null,
// "errorCode": null,
// "result": null,
// "updateTime": null,
// "vin": "4S4BTGND8L3137058"
// }
// }
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640456318773_23_@NGTP",
// "success": true,
// "cancelled": false,
// "remoteServiceType": "engineStop",
// "remoteServiceState": "finished",
// "subState": null,
// "errorCode": "null:null",
// "result": null,
// "updateTime": 1640456321000,
// "vin": "4S4BTGND8L3137058"
// }
// }
if v.getRemoteOptionsStatus() {
v.selectVehicle()
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin}
"pin": v.client.credentials.PIN}
reqURL := MOBILE_API_VERSION + apiURLs["API_G2_REMOTE_ENGINE_STOP"]
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
v.client.execute(reqURL, POST, params, pollingURL, true)
@ -500,49 +299,14 @@ func (v *Vehicle) EngineStop() {
}
// LightsStart .
// Send command to flash lights.
// Sends a command to flash lights.
func (v *Vehicle) LightsStart() {
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640457256003_21_@NGTP",
// "success": false,
// "cancelled": false,
// "remoteServiceType": "lightsOnly",
// "remoteServiceState": "started",
// "subState": null,
// "errorCode": null,
// "result": null,
// "updateTime": 1640457256000,
// "vin": "4S4BTGND8L3137058"
// }
// }
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640457256003_21_@NGTP",
// "success": true,
// "cancelled": false,
// "remoteServiceType": "lightsOnly",
// "remoteServiceState": "finished",
// "subState": null,
// "errorCode": "null:null",
// "result": null,
// "updateTime": 1640457262000,
// "vin": "4S4BTGND8L3137058"
// }
// }
if v.getRemoteOptionsStatus() {
v.selectVehicle()
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin}
"pin": v.client.credentials.PIN}
reqURL := MOBILE_API_VERSION + urlToGen(apiURLs["API_LIGHTS"], v.getAPIGen())
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
if v.getAPIGen() == FEATURE_G1_TELEMATICS {
@ -555,49 +319,14 @@ func (v *Vehicle) LightsStart() {
}
// LightsStop .
// Send command to stop flash lights.
// Sends a command to stop flash lights.
func (v *Vehicle) LightsStop() {
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640457280857_47_@NGTP",
// "success": false,
// "cancelled": false,
// "remoteServiceType": "lightsOnly",
// "remoteServiceState": "stopping",
// "subState": null,
// "errorCode": "null:null",
// "result": null,
// "updateTime": 1640457262000,
// "vin": "4S4BTGND8L3137058"
// }
// }
// {
// "success": true,
// "errorCode": null,
// "dataName": "remoteServiceStatus",
// "data": {
// "serviceRequestId": "4S4BTGND8L3137058_1640457280857_47_@NGTP",
// "success": true,
// "cancelled": false,
// "remoteServiceType": "lightsOnly",
// "remoteServiceState": "finished",
// "subState": null,
// "errorCode": "null:null",
// "result": null,
// "updateTime": 1640457280000,
// "vin": "4S4BTGND8L3137058"
// }
// }
if v.getRemoteOptionsStatus() {
v.selectVehicle()
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin}
"pin": v.client.credentials.PIN}
reqURL := MOBILE_API_VERSION + urlToGen(apiURLs["API_LIGHTS_STOP"], v.getAPIGen())
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
if v.getAPIGen() == FEATURE_G1_TELEMATICS {
@ -617,7 +346,7 @@ func (v *Vehicle) HornStart() {
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin}
"pin": v.client.credentials.PIN}
reqURL := MOBILE_API_VERSION + urlToGen(apiURLs["API_HORN_LIGHTS"], v.getAPIGen())
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
if v.getAPIGen() == FEATURE_G1_TELEMATICS {
@ -637,7 +366,7 @@ func (v *Vehicle) HornStop() {
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin}
"pin": v.client.credentials.PIN}
reqURL := MOBILE_API_VERSION + urlToGen(apiURLs["API_HORN_LIGHTS_STOP"], v.getAPIGen())
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
if v.getAPIGen() == FEATURE_G1_TELEMATICS {
@ -691,7 +420,7 @@ func (v *Vehicle) ChargeOn() {
params := map[string]string{
"delay": "0",
"vin": v.Vin,
"pin": v.client.credentials.pin}
"pin": v.client.credentials.PIN}
reqURL := MOBILE_API_VERSION + apiURLs["API_EV_CHARGE_NOW"]
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
v.client.execute(reqURL, POST, params, pollingURL, true)
@ -746,7 +475,7 @@ func (v *Vehicle) GetLocation(force bool) {
pollingURL := MOBILE_API_VERSION + apiURLs["API_G2_LOCATE_STATUS"]
params := map[string]string{
"vin": v.Vin,
"pin": v.client.credentials.pin}
"pin": v.client.credentials.PIN}
if v.getAPIGen() == FEATURE_G1_TELEMATICS {
reqURL = MOBILE_API_VERSION + apiURLs["API_G1_LOCATE_UPDATE"]
pollingURL = MOBILE_API_VERSION + apiURLs["API_G1_LOCATE_STATUS"]
@ -779,7 +508,7 @@ func (v *Vehicle) GetLocation(force bool) {
v.selectVehicle()
params := map[string]string{
"vin": v.Vin,
"pin": v.client.credentials.pin}
"pin": v.client.credentials.PIN}
reqURL := MOBILE_API_VERSION + urlToGen(apiURLs["API_LOCATE"], v.getAPIGen())
v.client.execute(reqURL, GET, params, "", false)
}
@ -790,14 +519,14 @@ func (v *Vehicle) GetClimateQuickPresets() {
if v.getRemoteOptionsStatus() {
// params := map[string]string{
// "vin": v.Vin,
// "pin": v.Client.credentials.pin}
// "pin": v.Client.credentials.PIN}
v.selectVehicle()
reqURL := MOBILE_API_VERSION + apiURLs["API_G2_FETCH_RES_QUICK_START_SETTINGS"]
resp := v.client.execute(reqURL, GET, map[string]string{}, "", false)
respParsed, err := gabs.ParseJSON(resp)
if err != nil {
panic(err)
v.client.log.Error("error which parsing json", "request", "GetClimateQuickPresets", "error", err.Error())
}
v.client.log.Debug("CLIMATE SETTINGS OUTPUT", "body", respParsed)
@ -826,9 +555,10 @@ func (v *Vehicle) GetClimatePresets() {
v.selectVehicle()
reqURL := MOBILE_API_VERSION + apiURLs["API_G2_FETCH_RES_SUBARU_PRESETS"]
resp := v.client.execute(reqURL, GET, map[string]string{}, "", false)
respParsed, err := gabs.ParseJSON(resp)
if err != nil {
panic(err)
v.client.log.Error("error which parsing json", "request", "GetClimatePresets", "error", err.Error())
}
// ONLY FOR THAT REQUEST BECAUSE OF API SENDS BACK ESCAPED DATA IN DATA FIELD
@ -856,9 +586,10 @@ func (v *Vehicle) GetClimateUserPresets() {
v.selectVehicle()
reqURL := MOBILE_API_VERSION + apiURLs["API_G2_FETCH_RES_USER_PRESETS"]
resp := v.client.execute(reqURL, GET, map[string]string{}, "", false)
respParsed, err := gabs.ParseJSON(resp)
if err != nil {
panic(err)
v.client.log.Error("error which parsing json", "request", "GetClimateUserPresets", "error", err.Error())
}
v.client.log.Debug("CLIMATE USER SETTINGS OUTPUT", "body", respParsed)
@ -904,7 +635,7 @@ func (v *Vehicle) GetVehicleStatus() {
if v.client.isResponseSuccessfull(resp) {
respParsed, err := gabs.ParseJSON(resp)
if err != nil {
v.client.log.Error("error which parsing json", "error", err.Error())
v.client.log.Error("error which parsing json", "request", "GetVehicleStatus", "error", err.Error())
}
vSta := VehicleStatus{}
@ -919,9 +650,7 @@ func (v *Vehicle) GetVehicleStatus() {
v.DistanceToEmpty.Kilometers = vSta.DistanceToEmptyFuelKilometers
v.DistanceToEmpty.Miles10s = vSta.DistanceToEmptyFuelMiles10s
v.DistanceToEmpty.Kilometers10s = vSta.DistanceToEmptyFuelKilometers10s
if vSta.RemainingFuelPercent >= 0 && vSta.RemainingFuelPercent <= 100 {
v.DistanceToEmpty.Percentage = vSta.RemainingFuelPercent
}
v.DistanceToEmpty.Percentage = vSta.RemainingFuelPercent
v.FuelConsumptionAvg.MPG = float64(vSta.AvgFuelConsumptionMpg)
v.FuelConsumptionAvg.LP100Km = float64(vSta.AvgFuelConsumptionLitersPer100Kilometers)
@ -1047,7 +776,7 @@ func (v *Vehicle) GetVehicleStatus() {
// }
}
// GetVehicleStatus .
// GetVehicleCondition .
func (v *Vehicle) GetVehicleCondition() {
v.selectVehicle()
reqURL := MOBILE_API_VERSION + urlToGen(apiURLs["API_CONDITION"], v.getAPIGen())
@ -1056,7 +785,7 @@ func (v *Vehicle) GetVehicleCondition() {
if v.client.isResponseSuccessfull(resp) {
respParsed, err := gabs.ParseJSON(resp)
if err != nil {
v.client.log.Error("error which parsing json", "error", err.Error())
v.client.log.Error("error which parsing json", "request", "GetVehicleCondition", "error", err.Error())
}
re := regexp.MustCompile(`[A-Z][^A-Z]*`)
@ -1166,7 +895,7 @@ func (v *Vehicle) GetVehicleHealth() {
if v.client.isResponseSuccessfull(resp) {
_, err := gabs.ParseJSON(resp)
if err != nil {
v.client.log.Error("error which parsing json", "error", err.Error())
v.client.log.Error("error which parsing json", "request", "GetVehicleHealth", "error", err.Error())
}
// TODO:
}