Closed jakecolman closed 2 years ago
I'm not sure why the api is saying your mileage is 0, but that is why the next service is being populated with an invalid value. As for the mileage according to the response you provided the server is saying as of yesterday your vehicle's mileage is 0
"mileage":"0","mileageSyncDate":"20211229212654"
I don't see anyway to fix this given the limitations of the US Kia api :(
Odd. The phone app reports the mileage correctly. I wonder if there is a separate API that the app uses that is not made public for anyone else to use.
On Thu, Dec 30, 2021 at 12:47 PM Brendan Dahl @.***> wrote:
I'm not sure why the api is saying your mileage is 0, but that is why the next service is being populated with an invalid value. As for the mileage according to the response you provided the server is saying as of yesterday your vehicle's mileage is 0
"mileage":"0","mileageSyncDate":"20211229212654"
I don't see anyway to fix this given the limitations of the US Kia api :(
— Reply to this email directly, view it on GitHub https://github.com/dahlb/ha_kia_hyundai/issues/48#issuecomment-1003124847, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADL7RIU64NF4U2NBGNQGINDUTSLJRANCNFSM5K73ZZQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
I wonder if this is related to https://github.com/dahlb/ha_kia_hyundai/issues/47 I just updated from 4.x to the latest Kia Connect 5.1.0 and checked the traffic for my vehicle and it is still not doing any extra api calls for mileage. Sorry if there is another API call to map I can't find it with my available kia account.
I have a similar issue. My mileage is showing correct, but my last service and next service do not calculate correctly. I have not reached my first service interval, and there is no logic to detect this.
My last service date shows 96,000 which makes sense according to the below code which just tacks on the odometer reading to the maintenance array and sorts it.
Perhaps a better approach would be to check where vehicle.odometer_value
was in the array, and then if it's first, output "NA" or 0 or something.
Also, instead of next service value, I think it would be more meaningfull to show 'miles until next service'. In my raw data, this is already computed for my vehicle as nextServiceMile
and would be fairly trivial to add.
Here is a snippet from my RAW data and what I would expect to see in HA
"nextServiceMile": 5980,
"maintenanceSchedule": [
2020.0,
8000,
16000,
24000,
32000,
40000,
48000,
56000,
64000,
72000,
80000,
88000,
96000
]
},```
Odometer: 2020
Last Service: NA
Next Service Interval: 8000
Miles until next service: 5980
Region and Brand of car US / Kia Niro
Describe the bug The following sensors have incorrect data: "Niro Odometer" shows 0.0 mi "Niro Last Services" shows 125,000 mi
Debug logs if an error occurred 2021-12-30 09:55:11 DEBUG (MainThread) [kia_hyundai_api.us_kia] response text:{"status":{"statusCode":0,"errorType":0,"errorCode":0,"errorMessage":"Success with response body"},"payload":{"vehicleSummary":[{"vin":"KNDCC3LC7L5428408","vehicleIdentifier":"428408","modelName":"NIRO","modelYear":"2020","nickName":"Niro","generation":2,"extColorCode":"C3U","trim":"TOURING","imagePath":{"imageName":"2020-niro-touring-c3u.png","imagePath":"/content/dam/kia/us/owners/image/vehicle-app/2020/niro/touring/","imageType":"1","imageSize":{"length":"100","width":"100","uom":0}},"enrollmentStatus":0,"fatcAvailable":0,"telematicsUnit":1,"fuelType":3,"colorName":"DEEP CERULEAN","activationType":2,"mileage":"0","dealerCode":"PA004","mobileStore":[{"osType":0,"downloadURL":"https://itunes.apple.com/us/app/kia-access-with-uvo-link/id1280548773?mt=8","image":{"imageName":"iosImage.png","imagePath":"/content/dam/kia/us/owners/image/common/app/","imageType":"2","imageSize":{"length":"100","width":"100","uom":0}}},{"osType":1,"downloadURL":"https://play.google.com/store/apps/details?id=com.myuvo.link","image":{"imageName":"androidImage.png","imagePath":"/content/dam/kia/us/owners/image/common/app/","imageType":"2","imageSize":{"length":"100","width":"100","uom":0}}}],"supportedApp":{"appType":"5","appImage":{"imageName":"uvo-app.png","imagePath":"/content/dam/kia/us/owners/image/common/app/access/","imageType":"2","imageSize":{"length":"100","width":"100","uom":0}}},"licensePlate":"","psi":"","supportAdditionalDriver":0,"customerType":1,"projectCode":"DEHEV","headUnitDesc":"DAV2","provStatus":"4","enrollmentSuppressionType":0,"vehicleKey":"0b49316b-c6d3-4d1a-aa54-494c89850124"}]}} 2021-12-30 09:55:11 DEBUG (MainThread) [custom_components.ha_kia_hyundai] first update start 2021-12-30 09:55:11 DEBUG (MainThread) [kia_hyundai_api.us_kia] sending https://api.owners.kia.com/apigw/v1/cmm/gvi request with {'vehicleConfigReq': {'airTempRange': '0', 'maintenance': '1', 'seatHeatCoolOption': '1', 'vehicle': '1', 'vehicleFeature': '1'}, 'vehicleInfoReq': {'drivingActivty': '0', 'dtc': '0', 'enrollment': '0', 'functionalCards': '0', 'location': '1', 'vehicleStatus': '1', 'weather': '0'}, 'vinKey': ['0b49316b-c6d3-4d1a-aa54-494c89850124']} 2021-12-30 09:55:11 DEBUG (MainThread) [kia_hyundai_api.us_kia] response headers:<CIMultiDictProxy('Server': 'KMA', 'Date': 'Thu, 30 Dec 2021 14:55:11 GMT', 'Content-Length': '4678', 'Content-Type': 'application/json', 'Xid': 'd051a429-654e-4463-843d-5bdc1d126698')> 2021-12-30 09:55:11 DEBUG (MainThread) [kia_hyundai_api.us_kia] response text:{"status":{"statusCode":0,"errorType":0,"errorCode":0,"errorMessage":"Success with response body"},"payload":{"vehicleInfoList":[{"vinKey":"0b49316b-c6d3-4d1a-aa54-494c89850124","vehicleConfig":{"vehicleDetail":{"vehicle":{"vin":"KNDCC3LC7L5428408","trim":{"modelYear":"2020","salesModelCode":"G4262","optionGroupCode":"010","modelName":"NIRO","factoryCode":"G5","projectCode":"DEHEV","trimName":"TOURING","driveType":"0","transmissionType":"1","ivrCategory":"5","btSeriesCode":"G"},"telematics":1,"mileage":"0","mileageSyncDate":"20211229212654","exteriorColor":"DEEP CERULEAN","exteriorColorCode":"C3U","fuelType":3,"invDealerCode":"PA004","testVehicle":"0","supportedApps":[{"appType":"0"},{"appType":"5","appImage":{"imageName":"uvo-app.png","imagePath":"/content/dam/kia/us/owners/image/common/app/access/","imageType":"2","imageSize":{"length":"100","width":"100","uom":0}}}],"activationType":2},"images":[{"imageName":"2020-niro-touring-c3u.png","imagePath":"/content/dam/kia/us/owners/image/vehicle-app/2020/niro/touring/","imageType":"1","imageSize":{"length":"100","width":"100","uom":0}}],"device":{"launchType":"0","swVersion":"DEPE_HEV.USA.D2V.002.001.191207","telematics":{"generation":"3","platform":"1","tmsCenter":"1","billing":true},"versionNum":"GASOLINE","headUnitType":"2","hdRadio":"X40HAF","ampType":"NA","modem":{"meid":"352756079211901","mdn":"6574342729","iccid":"89148000005952739845"},"headUnitName":"daudio1","bluetoothRef":"19","headUnitDesc":"DAV2"}},"maintenance":{"nextServiceMile":5803.83,"maintenanceSchedule":[7500,15000,22500,30000,37500,45000,52500,60000,67500,75000,82500,90000,97500,105000,112500]},"vehicleFeature":{"remoteFeature":{"lock":"1","unlock":"1","start":"3","stop":"1","scheduleCount":"2","inVehicleSchedule":"1","heatedSteeringWheel":"1","heatedSideMirror":"1","heatedRearWindow":"1","heatedSeat":"0","ventSeat":"0","alarm":"1","hornlight":"1","panic":"1","doorSecurity":"1","engineIdleTime":"1","separateHeatedAccessories":"0","windowSafety":"0"},"chargeFeature":{"batteryChargeType":"0","chargeEndPct":"0","immediateCharge":"0","cancelCharge":"0","evRange":"0","scheduleCount":"0","inVehicleSchedule":"0","offPeakType":"0","scheduleType":"0","chargeLevel":"0","scheduleConfig":"0","fatcWithCharge":"0"},"alertFeature":{"geofenceType":{"geofence":"1","entryCount":"5","exitCount":"1","inVehicleConfig":"0","minRadius":"1","maxRadius":"10","minHeight":"1","maxHeight":"10","minWidth":"1","maxWidth":"10","uom":"0"},"curfewType":{"curfew":"1","curfewCount":"21","inVehicleConfig":"0"},"speedType":{"speed":"1","speedCount":"21","inVehicleConfig":"0"},"valetType":{"valet":"1","valetParkingMode":"0","defaultRadius":"1","defaultRadiusUnit":"3","defaultInterval":"5","defaultIntervalUnit":"3","inVehicleConfig":"0"}},"vrmFeature":{"autoDTC":"1","scheduledDTC":"1","backgroundDTC":"1","manualDTC":"1","healthReport":"0","drivingScore":"1","gasRange":"1","evRange":"0","trip":"1"},"locationFeature":{"gpsStreaming":"0","location":"1","poi":"1","poiCount":"25","push2Vehicle":"1","wayPoint":"1","mapType":"1","surroundView":"0","svr":"1"},"userSettingFeature":{"usmType":"0","calendar":"0","valetParkingMode":"0","wifiHotSpot":"0","otaSupport":"0","digitalKeyOption":"0"}},"heatVentSeat":{},"billingPeriod":{"freeTrial":{"value":12,"unit":0},"freeTrialExtension":{"value":12,"unit":1},"servicePeriod":{"value":60,"unit":1}}},"lastVehicleInfo":{"vehicleNickName":"Niro","preferredDealer":"PA004","licensePlate":"","psi":"","customerType":1,"vehicleStatusRpt":{"statusType":"2","reportDate":{"utc":"20211230145511","offset":-8},"vehicleStatus":{"climate":{"airCtrl":false,"defrost":false,"airTemp":{"value":"75","unit":1},"heatingAccessory":{"steeringWheel":0,"sideMirror":0,"rearWindow":0}},"engine":false,"doorLock":true,"doorStatus":{"frontLeft":0,"frontRight":0,"backLeft":0,"backRight":0,"trunk":0,"hood":0},"lowFuelLight":false,"ign3":false,"transCond":true,"distanceToEmpty":{"value":410,"unit":3},"tirePressure":{"all":0,"frontLeft":0,"frontRight":0,"rearLeft":0,"rearRight":0},"dateTime":{"utc":"20211230145511","offset":-8},"syncDate":{"utc":"20211230122654","offset":-8},"batteryStatus":{"stateOfCharge":100,"sensorStatus":0,"deliveryMode":0},"sleepMode":true,"lampWireStatus":{"headLamp":{},"stopLamp":{},"turnSignalLamp":{}},"windowStatus":{},"engineOilStatus":false,"vehicleMovementHis":true,"engineRuntime":{"value":12,"unit":1},"valetParkingMode":0}},"location":{"coord":{"lat":40.008689,"lon":-75.243305,"alt":64.9,"type":0,"altdo":0},"head":177,"speed":{"value":0,"unit":1},"accuracy":{"hdop":0,"pdop":1},"syncDate":{"utc":"20211230122654","offset":-8}},"financed":true,"financeRegistered":false,"linkStatus":0}}]}} 2021-12-30 09:55:13 WARNING (MainThread) [custom_components.ha_kia_hyundai.vehicle] Location name lookup failed:Service timed out 2021-12-30 09:55:13 DEBUG (MainThread) [custom_components.ha_kia_hyundai.vehicle] Finished fetching Vehicle 428408 data in 2.076 seconds (success: True) 2021-12-30 09:55:13 DEBUG (MainThread) [custom_components.ha_kia_hyundai] first update finished
Additional context I included the complete log for the first fetch of vehicle data after restarting HA. This should provide all the data you need to populate the sensors.