Add more vehicle samples and tests
This commit is contained in:
parent
7ea1e9617c
commit
c90ea468bf
7 changed files with 5951 additions and 1 deletions
1445
vehicle/audi/samples/status.json
Normal file
1445
vehicle/audi/samples/status.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -89,6 +89,9 @@ var _ api.VehicleOdometer = (*Provider)(nil)
|
|||
func (v *Provider) Odometer() (float64, error) {
|
||||
res, err := v.statusG()
|
||||
if res, ok := res.(Status); err == nil && ok {
|
||||
if res.Data.MaintenanceStatus == nil {
|
||||
return 0, api.ErrNotAvailable
|
||||
}
|
||||
return float64(res.Data.MaintenanceStatus.MileageKm), nil
|
||||
}
|
||||
|
||||
|
|
|
|||
474
vehicle/id/samples/status2.json
Normal file
474
vehicle/id/samples/status2.json
Normal file
|
|
@ -0,0 +1,474 @@
|
|||
{
|
||||
"data": {
|
||||
"accessStatus": {
|
||||
"overallStatus": "safe",
|
||||
"carCapturedTimestamp": "2021-09-04T16:59:11Z",
|
||||
"doors": [
|
||||
{
|
||||
"name": "bonnet",
|
||||
"status": [
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "frontLeft",
|
||||
"status": [
|
||||
"locked",
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "frontRight",
|
||||
"status": [
|
||||
"locked",
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rearLeft",
|
||||
"status": [
|
||||
"locked",
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rearRight",
|
||||
"status": [
|
||||
"locked",
|
||||
"closed"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "trunk",
|
||||
"status": [
|
||||
"locked",
|
||||
"closed"
|
||||
]
|
||||
}
|
||||
],
|
||||
"windows": [
|
||||
{
|
||||
"name": "frontLeft",
|
||||
"status": [
|
||||
"unsupported"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "frontRight",
|
||||
"status": [
|
||||
"unsupported"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rearLeft",
|
||||
"status": [
|
||||
"unsupported"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rearRight",
|
||||
"status": [
|
||||
"unsupported"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "roofCover",
|
||||
"status": [
|
||||
"unsupported"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sunRoof",
|
||||
"status": [
|
||||
"unsupported"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"batteryStatus": {
|
||||
"carCapturedTimestamp": "2021-09-04T16:58:08Z",
|
||||
"currentSOC_pct": 86,
|
||||
"cruisingRangeElectric_km": 224
|
||||
},
|
||||
"chargingStatus": {
|
||||
"carCapturedTimestamp": "2021-09-04T16:58:08Z",
|
||||
"remainingChargingTimeToComplete_min": 10,
|
||||
"chargingState": "off",
|
||||
"chargeMode": "invalid"
|
||||
},
|
||||
"chargingSettings": {
|
||||
"carCapturedTimestamp": "2021-02-24T15:38:44Z",
|
||||
"maxChargeCurrentAC": "maximum"
|
||||
},
|
||||
"plugStatus": {
|
||||
"carCapturedTimestamp": "2021-09-04T16:58:40Z",
|
||||
"plugConnectionState": "disconnected",
|
||||
"plugLockState": "locked"
|
||||
},
|
||||
"climatisationStatus": {
|
||||
"carCapturedTimestamp": "2021-09-04T16:58:05Z",
|
||||
"remainingClimatisationTime_min": 0,
|
||||
"climatisationState": "off"
|
||||
},
|
||||
"climatisationSettings": {
|
||||
"carCapturedTimestamp": "2021-08-26T20:28:20Z",
|
||||
"targetTemperature_K": 295,
|
||||
"targetTemperature_C": 22,
|
||||
"climatisationWithoutExternalPower": true
|
||||
},
|
||||
"windowHeatingStatus": {
|
||||
"carCapturedTimestamp": "2021-09-04T16:58:10Z",
|
||||
"windowHeatingStatus": [
|
||||
{
|
||||
"windowLocation": "front",
|
||||
"windowHeatingState": "off"
|
||||
},
|
||||
{
|
||||
"windowLocation": "rear",
|
||||
"windowHeatingState": "off"
|
||||
}
|
||||
]
|
||||
},
|
||||
"lightsStatus": {
|
||||
"carCapturedTimestamp": "2021-09-04T16:59:11Z",
|
||||
"lights": [
|
||||
{
|
||||
"name": "right",
|
||||
"status": "off"
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"status": "off"
|
||||
}
|
||||
]
|
||||
},
|
||||
"maintenanceStatus": {
|
||||
"carCapturedTimestamp": "2021-09-04T14:59:10Z",
|
||||
"inspectionDue_days": 333,
|
||||
"inspectionDue_km": 28600,
|
||||
"mileage_km": 30952,
|
||||
"oilServiceDue_days": 0,
|
||||
"oilServiceDue_km": 0
|
||||
},
|
||||
"rangeStatus": {
|
||||
"carCapturedTimestamp": "2021-09-04T16:58:08Z",
|
||||
"carType": "electric",
|
||||
"primaryEngine": {
|
||||
"type": "electric",
|
||||
"currentSOC_pct": 86,
|
||||
"remainingRange_km": 224
|
||||
},
|
||||
"totalRange_km": 224
|
||||
},
|
||||
"capabilityStatus": {
|
||||
"capabilities": [
|
||||
{
|
||||
"id": "access",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "charging",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "climatisation",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "cubicNetwork",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "cubicNetworkConsumption",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "dealerAppointment",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "digitalKey",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "emergencyCalling",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "fuelStatus",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "geofence",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "googleEarth",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "hybridRadio",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "informationCall",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "mapUpdate",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "measurements",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "news",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "onlineSpeech",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "parkingInformation",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "parkingPosition",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "roadsideAssistant",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "routing",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "speedAlert",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "state",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "theftWarning",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistoryAntiTheftAlert",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistoryAntiTheftAlertDelete",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistoryDigitalKey",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistoryGeofence",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistoryGeofenceDelete",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistoryHonkFlash",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistoryLockUnlock",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistorySpeedAlert",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "transactionHistorySpeedAlertDelete",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "tripStatistics",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleHealth",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleHealthArchive",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleHealthInspection",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleHealthSettings",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleHealthTrigger",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleHealthWakeUp",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleHealthWarnings",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleLights",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleWakeUp",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "vehicleWakeUpTrigger",
|
||||
"expirationDate": "2023-02-11T09:35:00Z",
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "weatherInformation",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
},
|
||||
{
|
||||
"id": "webRadio",
|
||||
"status": [
|
||||
1008
|
||||
],
|
||||
"userDisablingAllowed": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"chargeMode": {
|
||||
"code": 4104,
|
||||
"message": "The vehicle does not support the requested operation",
|
||||
"group": 4,
|
||||
"info": "Looks like your service has expired. Please update your service subscription."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ type Status struct {
|
|||
RangeStatus `json:"rangeStatus"`
|
||||
ClimatisationSettings `json:"climatisationSettings"`
|
||||
ClimatisationStatus `json:"climatisationStatus"` // may be temporarily not available
|
||||
MaintenanceStatus `json:"maintenanceStatus"`
|
||||
*MaintenanceStatus `json:"maintenanceStatus"` // optional
|
||||
}
|
||||
Error map[string]Error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,22 @@ func TestStatus(t *testing.T) {
|
|||
if v := status.Data.ChargingStatus.RemainingChargingTimeToCompleteMin; v != 120 {
|
||||
t.Error("invalid RemainingChargingTimeToCompleteMin", v)
|
||||
}
|
||||
|
||||
if status.Data.MaintenanceStatus != nil {
|
||||
t.Error("unexpected MaintenanceStatus")
|
||||
}
|
||||
}
|
||||
|
||||
//go:embed samples/status2.json
|
||||
var data2 []byte
|
||||
|
||||
func TestStatus2(t *testing.T) {
|
||||
var status Status
|
||||
if err := json.Unmarshal(data2, &status); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if status.Data.MaintenanceStatus == nil || status.Data.MaintenanceStatus.MileageKm == 0 {
|
||||
t.Error("invalid MaintenanceStatus.MileageKm")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2009
vehicle/vw/samples/rolesrights_egolf.json
Normal file
2009
vehicle/vw/samples/rolesrights_egolf.json
Normal file
File diff suppressed because it is too large
Load diff
2001
vehicle/vw/samples/rolesrights_q55.json
Normal file
2001
vehicle/vw/samples/rolesrights_q55.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue