Hyundai-Kia-Connect / kia_uvo

A Home Assistant HACS integration that supports Kia Connect(Uvo) and Hyundai Bluelink. The integration supports the EU, Canada and the USA.
MIT License
413 stars 85 forks source link

KeyError: 'vehicleStatus' when calling Force Update for US Hyundai #715

Open Snuffy2 opened 1 year ago

Snuffy2 commented 1 year ago

Region and Brand of car Country: US Car: 2024 Hyundai Palisade

Version of the integration Version: v2.14.0

Describe the bug Getting the error below when calling service: kia_uvo.force_update. This error is also causing Automations that contain it to halt as well.

Debug logs if an error occurred

2023-08-28 18:28:46.165 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Force update failed, falling back to cached: 'vehicleStatus'
Traceback (most recent call last):
  File "/config/custom_components/kia_uvo/coordinator.py", line 126, in _async_update_data
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 108, in check_and_force_update_vehicles
    self.update_vehicle_with_cached_state(vehicle_id)
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 83, in update_vehicle_with_cached_state
    self.api.update_vehicle_with_cached_state(self.token, vehicle)
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py", line 418, in update_vehicle_with_cached_state
    state["vehicleStatus"] = self._get_vehicle_status(token, vehicle, False)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py", line 165, in _get_vehicle_status
    status = dict(response["vehicleStatus"])
                  ~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'vehicleStatus'

Also seeing a similar but slightly different error in the logs as well:

Unexpected error for call_service at pos 1: 'vehicleStatus'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/kia_uvo/services.py", line 49, in async_handle_force_update
    await coordinator.async_force_update_all()
  File "/config/custom_components/kia_uvo/coordinator.py", line 159, in async_force_update_all
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 112, in force_refresh_all_vehicles_states
    self.force_refresh_vehicle_state(vehicle_id)
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 117, in force_refresh_vehicle_state
    self.api.force_refresh_vehicle_state(self.token, vehicle)
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py", line 448, in force_refresh_vehicle_state
    state["vehicleStatus"] = self._get_vehicle_status(token, vehicle, True)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py", line 165, in _get_vehicle_status
    status = dict(response["vehicleStatus"])
                  ~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'vehicleStatus'

Will capture and add Debug logs soon

To Reproduce Call service: kia_uvo.force_update

Snuffy2 commented 1 year ago

It looks like I may be exceeding the remote service request limit, but is there anyway for it to fail more gracefully without crashing the Automation?

De-identified Debug Logs:

2023-08-29 21:43:48.216 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.VehicleManager] hyundai_kia_connect_api - Time differential in seconds: 14035.216855
2023-08-29 21:43:49.187 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - Get Vehicles Response {"enrolledVehicleDetails":[{"packageDetails":[{"assetNumber":"A-S01145611","displayCategory":"Basic||YES","packageId":"8a12873f86e0b60c0186e103a67074d2","term":"240","renewalDate":"20430825000000","packageType":"Basic","startDate":"20230825000000"},{"assetNumber":"A-S01145611","displayCategory":"Advanced||YES","packageId":"8a12904286e0cd110186e105a8d759bc","term":"240","renewalDate":"20430825000000","packageType":"Advanced","startDate":"20230825000000"},{"assetNumber":"A-S01145612","displayCategory":"Map & Multimedia Over-the-Air Updates||NO","packageId":"8a129ce886e0cd190186e109d0794ce5","term":"36","renewalDate":"20260818000000","packageType":"Map & Multimedia Over-the-Air Updates","startDate":"20230825000000"}],"driverDetails":[{"driverAddressDetails":[{"city":"Denver","postalCode":"90210","type":"PRIMARY","region":"CO"}],"driver":{"accountId":"6610373","firstName":"Snuffy2","lastName":"LastName","phonesOptIn":[],"tncId":"24","loginId":"mail@snuffy2.com","preferredDealerCode":"CO111","driverUserProfile":"N","phones":[],"idmId":"TK8I4362","userId":"mail@snuffy2.com","email":"mail@snuffy2.com"}}],"vehicleDetails":{"svrStatus":"NONE","fatcAvailable":"Y","color":"GRAY/BLUE","remoteStartWakeupDays":"seven","enrollmentDate":"20230825","maintSyncCapable":"NO","brandIndicator":"H","deviceStatus":"ENROLLED","mapProvider":"HERE","interiorColor":"NNB","svdDay":"24","accessoryCode":"WAVN 5.0","trim":"CALLIGRAPHY","modelCode":"PALISADE","nadid":"5218677008","ubiCapabilityInd":"N","mit":"7500","regid":"H00005222681VKM8R7DGE3RU650677","vin":"KM8R7DGE3RU650677","blueLink":"Y","waypointInd":"NO","billingInd":"MONTHLY","enrollmentId":"4797124","seatConfigurations":{"seatConfigs":[{"heatingCapable":"YES","ventCapable":"YES","supportedLevels":"2,6,7,8,3,4,5","seatLocationID":"1"},{"heatingCapable":"YES","ventCapable":"YES","supportedLevels":"2,6,7,8,3,4,5","seatLocationID":"2"},{"heatingCapable":"YES","ventCapable":"YES","supportedLevels":"2,6,7,8,3,4,5","seatLocationID":"3"},{"heatingCapable":"YES","ventCapable":"YES","supportedLevels":"2,6,7,8,3,4,5","seatLocationID":"4"}]},"sideMirrorHeatCapable":"YES","ownersuccession":"1","odometer":"509","imat":"7500","nickName":"2024 PALISADE","additionalVehicleDetails":{"temperatureRange":"false","tmuSleepMode":"No","enableHCAModule":"Y","icpParking":0,"remoteLockConsentForRemoteStart":"No","calendarVehicleSyncEnable":"Yes","vehicleModemType":"4G (LX2PE.USA.S5W_M.V010.003.230526)","icpAACapable":"N","productName":"Bluelink+","icpDriveThru":0,"dkType":"2.0-Standard","enableRoadSideAssitanceAAAModule":"Y","idleSpeedinValetAlert":"N","evAlarmOptionInfo":"No","mapOtaAccepted":"N","dkCapable":"Y","combinedHeatSettingsEnable":"N","icpChargingStation":0,"hyundaiHome":"N","wifiHotspotCapable":"Y","tmuSleepInMin":233.86666666666667,"dkEnrolled":"Y","icpAvntCapable":"N","icpFuelStation":0,"remoteLockConsentForRemoteStartCapable":"No","icpCPCapable":"N","enableValetActivate":"Y","energyConsoleCapable":"No","cpoVehicle":"No"},"evStatus":"N","modelYear":"2024","transmissiontype":"AUTO","steeringWheelHeatCapable":"YES","bluelinkEnrolled":true,"vehicleGeneration":"2","rearWindowHeatCapable":"YES","preferredDealerCode":"CO111","hmaModel":"LX2","series":"PALISADE","enrollmentStatus":"ACTIVE","starttype":"BUTTON","enrollmentType":"INDIVIDUAL","userprofilestatus":"Y","sapColorCode":"UB7","bluelinkEnabled":true,"odometerUpdateDate":"20230829144610"},"roleDetails":[{"roleCode":"OWN","roleName":"OWNER"},{"roleCode":"SUB","roleName":"SUBSCRIBER"}],"responseHeaderMap":{}}],"addressDetails":[{"city":"Denver","street":"1 Main Rd","postalCode":"90210","type":"PRIMARY","region":"CO"}],"user":{"accountId":"6604866","firstName":"Wife","lastName":"LastName","phonesOptIn":[{"number":"2125551212","primaryPhoneIndicator":"YES","fccOptIn":"NO","type":"MOBILE"}],"loginId":"WifeLastName@gmail.com","additionalUserDetails":{"userProfileUpdate":"N","timezoneOffset":-4,"billingAccountNumber":"A00914272","appRating":"N","geoLocationConsent":"Y","timezoneAbbr":"MDT","otaAcceptance":"N","telematicsPhoneNumber":"2125551212"},"tncFlag":"N","phones":[{"number":"2125551212","type":"cell","order":1}],"idmId":"0MVMCOAF","userId":"WifeLastName@gmail.com","notificationEmail":"WifeLastName@gmail.com","email":"WifeLastName@gmail.com"}}
2023-08-29 21:43:49.188 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - using API headers: {'content-type': 'application/json;charset=UTF-8', 'accept': 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36', 'host': 'api.telematics.hyundaiusa.com', 'origin': 'https://api.telematics.hyundaiusa.com', 'referer': 'https://api.telematics.hyundaiusa.com/login', 'from': 'SPA', 'to': 'ISS', 'language': '0', 'offset': '-4', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'refresh': 'false', 'encryptFlag': 'false', 'brandIndicator': 'H', 'gen': '2', 'client_id': 'm66129Bb-em93-SPAHYN-bZ91-am4540zp18820', 'clientSecret': 'v558o935-6nne-423i-bcc8', 'username': 'WifeLastName@gmail.com', 'accessToken': 'w6q2T/okx5dKu0YxjaGYtZnseBROS8uAOpspFLtX/rnhBTa+yXu6XvpPsTpQQR+73JKBamye1MTkiIklLwPAhrpdiXFrEnXWjm+rCf85wjswLD8EjEvbHqRfDXFTXDBeDqWaB/RD9MZ4p+MLsSud6XX0UluxpKi5J5Gv9eSxP9VQnKZC2dNtd8gtOu2Qcxz5eU4umuplnWtmsS3xpw+TutmL+5T6Z6KvXdY9uvjqUDkXqTa7ZcyR4V6EHIprLbBompdNOtobGTxOECfAflOTU3vHZYe45+Ra0uG9aImgjwRvYZg2YxzrP1S0vn9sY58yxTZQm+1XYjkh3812+0OydUJG7tuvf25R17k6d0bI3gKjDxDjOc4JPnv3cZu25PzDhU8rOcOxHLgjh429hB2hWSAz1mpaT8gVytWsZZNJThoM4CtTi01LrSx3t7yIUr4plbPkHA2J/RdU47Bv7a4BvIi7SGuuWI+LBQiZ/+QAANrK9aVfEt9nUxe7ddVY82lHpRIY9dkOMlWzZ8+u/tvnhnAJZq3afOjXOAp0SDG2dOhb9RcEomtQppMEX+PldA8xvUMeT/MXuR/hIFA1My5qDto8SNi+WFgcidGMTSnPZPYwLD8EjEvbHqRfDXFTXDBeDqWaB/RD9MZ4p+MLsSud6XnNOwIBGRPyvgcnWkDP9CvUNt9ebxNXHLoEipBdu5OWyzvTzXicFSBSHtilryn8xH+hfiMFYncuaGApP56CTrfdBxeuiuP1lrsrfcEmWCVZqjrtMmJWeStYaqGjoKcBSg__', 'blueLinkServicePin': '5618', 'registrationId': 'H00005222681VKM8R7DGE3RU650677', 'vin': 'KM8R7DGE3RU650677', 'REFRESH': 'true'}
2023-08-29 21:43:49.369 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - get_vehicle_status response {'errorSubCode': 'HT_534', 'systemName': 'HATA', 'functionName': 'remoteVehicleStatus', 'errorSubMessage': 'HATA remoteVehicleStatus service failed while performing the operation RemoteVehicleStatus', 'errorMessage': 'You have exceeded the daily remote service request limit. Your last request was not processed.', 'errorCode': 502, 'serviceName': 'RemoteVehicleStatus'}
2023-08-29 21:43:49.812 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - Get Vehicles Response {"enrolledVehicleDetails":[{"packageDetails":[{"assetNumber":"A-S01145611","displayCategory":"Basic||YES","packageId":"8a12873f86e0b60c0186e103a67074d2","term":"240","renewalDate":"20430825000000","packageType":"Basic","startDate":"20230825000000"},{"assetNumber":"A-S01145611","displayCategory":"Advanced||YES","packageId":"8a12904286e0cd110186e105a8d759bc","term":"240","renewalDate":"20430825000000","packageType":"Advanced","startDate":"20230825000000"},{"assetNumber":"A-S01145612","displayCategory":"Map & Multimedia Over-the-Air Updates||NO","packageId":"8a129ce886e0cd190186e109d0794ce5","term":"36","renewalDate":"20260818000000","packageType":"Map & Multimedia Over-the-Air Updates","startDate":"20230825000000"}],"driverDetails":[{"driverAddressDetails":[{"city":"Denver","postalCode":"90210","type":"PRIMARY","region":"CO"}],"driver":{"accountId":"6610373","firstName":"Snuffy2","lastName":"LastName","phonesOptIn":[],"tncId":"24","loginId":"mail@snuffy2.com","preferredDealerCode":"CO111","driverUserProfile":"N","phones":[],"idmId":"TK8I4362","userId":"mail@snuffy2.com","email":"mail@snuffy2.com"}}],"vehicleDetails":{"svrStatus":"NONE","fatcAvailable":"Y","color":"GRAY/BLUE","remoteStartWakeupDays":"seven","enrollmentDate":"20230825","maintSyncCapable":"NO","brandIndicator":"H","deviceStatus":"ENROLLED","mapProvider":"HERE","interiorColor":"NNB","svdDay":"24","accessoryCode":"WAVN 5.0","trim":"CALLIGRAPHY","modelCode":"PALISADE","nadid":"5218677008","ubiCapabilityInd":"N","mit":"7500","regid":"H00005222681VKM8R7DGE3RU650677","vin":"KM8R7DGE3RU650677","blueLink":"Y","waypointInd":"NO","billingInd":"MONTHLY","enrollmentId":"4797124","seatConfigurations":{"seatConfigs":[{"heatingCapable":"YES","ventCapable":"YES","supportedLevels":"2,6,7,8,3,4,5","seatLocationID":"1"},{"heatingCapable":"YES","ventCapable":"YES","supportedLevels":"2,6,7,8,3,4,5","seatLocationID":"2"},{"heatingCapable":"YES","ventCapable":"YES","supportedLevels":"2,6,7,8,3,4,5","seatLocationID":"3"},{"heatingCapable":"YES","ventCapable":"YES","supportedLevels":"2,6,7,8,3,4,5","seatLocationID":"4"}]},"sideMirrorHeatCapable":"YES","ownersuccession":"1","odometer":"509","imat":"7500","nickName":"2024 PALISADE","additionalVehicleDetails":{"temperatureRange":"false","tmuSleepMode":"No","enableHCAModule":"Y","icpParking":0,"remoteLockConsentForRemoteStart":"No","calendarVehicleSyncEnable":"Yes","vehicleModemType":"4G (LX2PE.USA.S5W_M.V010.003.230526)","icpAACapable":"N","productName":"Bluelink+","icpDriveThru":0,"dkType":"2.0-Standard","enableRoadSideAssitanceAAAModule":"Y","idleSpeedinValetAlert":"N","evAlarmOptionInfo":"No","mapOtaAccepted":"N","dkCapable":"Y","combinedHeatSettingsEnable":"N","icpChargingStation":0,"hyundaiHome":"N","wifiHotspotCapable":"Y","tmuSleepInMin":233.88333333333333,"dkEnrolled":"Y","icpAvntCapable":"N","icpFuelStation":0,"remoteLockConsentForRemoteStartCapable":"No","icpCPCapable":"N","enableValetActivate":"Y","energyConsoleCapable":"No","cpoVehicle":"No"},"evStatus":"N","modelYear":"2024","transmissiontype":"AUTO","steeringWheelHeatCapable":"YES","bluelinkEnrolled":true,"vehicleGeneration":"2","rearWindowHeatCapable":"YES","preferredDealerCode":"CO111","hmaModel":"LX2","series":"PALISADE","enrollmentStatus":"ACTIVE","starttype":"BUTTON","enrollmentType":"INDIVIDUAL","userprofilestatus":"Y","sapColorCode":"UB7","bluelinkEnabled":true,"odometerUpdateDate":"20230829144610"},"roleDetails":[{"roleCode":"OWN","roleName":"OWNER"},{"roleCode":"SUB","roleName":"SUBSCRIBER"}],"responseHeaderMap":{}}],"addressDetails":[{"city":"Denver","street":"1 Main Rd","postalCode":"90210","type":"PRIMARY","region":"CO"}],"user":{"accountId":"6604866","firstName":"Wife","lastName":"LastName","phonesOptIn":[{"number":"2125551212","primaryPhoneIndicator":"YES","fccOptIn":"NO","type":"MOBILE"}],"loginId":"WifeLastName@gmail.com","additionalUserDetails":{"userProfileUpdate":"N","timezoneOffset":-4,"billingAccountNumber":"A00914272","appRating":"N","geoLocationConsent":"Y","timezoneAbbr":"MDT","otaAcceptance":"N","telematicsPhoneNumber":"2125551212"},"tncFlag":"N","phones":[{"number":"2125551212","type":"cell","order":1}],"idmId":"0MVMCOAF","userId":"WifeLastName@gmail.com","notificationEmail":"WifeLastName@gmail.com","email":"WifeLastName@gmail.com"}}
2023-08-29 21:43:49.813 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - using API headers: {'content-type': 'application/json;charset=UTF-8', 'accept': 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36', 'host': 'api.telematics.hyundaiusa.com', 'origin': 'https://api.telematics.hyundaiusa.com', 'referer': 'https://api.telematics.hyundaiusa.com/login', 'from': 'SPA', 'to': 'ISS', 'language': '0', 'offset': '-4', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'refresh': 'false', 'encryptFlag': 'false', 'brandIndicator': 'H', 'gen': '2', 'client_id': 'm66129Bb-em93-SPAHYN-bZ91-am4540zp18820', 'clientSecret': 'v558o935-6nne-423i-bcc8', 'username': 'WifeLastName@gmail.com', 'accessToken': 'w6q2T/okx5dKu0YxjaGYtZnseBROS8uAOpspFLtX/rnhBTa+yXu6XvpPsTpQQR+73JKBamye1MTkiIklLwPAhrpdiXFrEnXWjm+rCf85wjswLD8EjEvbHqRfDXFTXDBeDqWaB/RD9MZ4p+MLsSud6XX0UluxpKi5J5Gv9eSxP9VQnKZC2dNtd8gtOu2Qcxz5eU4umuplnWtmsS3xpw+TutmL+5T6Z6KvXdY9uvjqUDkXqTa7ZcyR4V6EHIprLbBompdNOtobGTxOECfAflOTU3vHZYe45+Ra0uG9aImgjwRvYZg2YxzrP1S0vn9sY58yxTZQm+1XYjkh3812+0OydUJG7tuvf25R17k6d0bI3gKjDxDjOc4JPnv3cZu25PzDhU8rOcOxHLgjh429hB2hWSAz1mpaT8gVytWsZZNJThoM4CtTi01LrSx3t7yIUr4plbPkHA2J/RdU47Bv7a4BvIi7SGuuWI+LBQiZ/+QAANrK9aVfEt9nUxe7ddVY82lHpRIY9dkOMlWzZ8+u/tvnhnAJZq3afOjXOAp0SDG2dOhb9RcEomtQppMEX+PldA8xvUMeT/MXuR/hIFA1My5qDto8SNi+WFgcidGMTSnPZPYwLD8EjEvbHqRfDXFTXDBeDqWaB/RD9MZ4p+MLsSud6XnNOwIBGRPyvgcnWkDP9CvUNt9ebxNXHLoEipBdu5OWyzvTzXicFSBSHtilryn8xH+hfiMFYncuaGApP56CTrfdBxeuiuP1lrsrfcEmWCVZqjrtMmJWeStYaqGjoKcBSg__', 'blueLinkServicePin': '5618', 'registrationId': 'H00005222681VKM8R7DGE3RU650677', 'vin': 'KM8R7DGE3RU650677'}
2023-08-29 21:43:50.388 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - get_vehicle_status response {'hataTID': 'B-nEIx7rQ6Wmwc3VcwgOOQ', 'vehicleStatus': {'dateTime': '2023-08-29T21:49:53Z', 'acc': False, 'fuelLevel': 95, 'defrostStatus': 'false', 'transCond': True, 'doorLockStatus': 'false', 'doorOpen': {'frontRight': 0, 'frontLeft': 0, 'backLeft': 0, 'backRight': 0}, 'washerFluidStatus': False, 'battery': {'powerAutoCutMode': 2, 'batSignalReferenceValue': {'batWarning': 65}, 'batSoc': 92, 'sjbDeliveryMode': 1}, 'seatHeaterVentInfo': {'rlSeatHeatState': 2, 'drvSeatHeatState': 2, 'rrSeatHeatState': 2, 'astSeatHeatState': 2}, 'hazardStatus': 0, 'vehicleLocation': {'coord': {'alt': 0.0, 'lon': -71.14126666666667, 'type': 0, 'lat': 44.02378611}}, 'ign3': False, 'ignitionStatus': 'false', 'lowFuelLight': False, 'sideBackWindowHeat': 0, 'dte': {'unit': 3, 'value': 359.0}, 'engine': False, 'remoteWaitingTimeAlert': {'remoteControlWaitingTime': 168, 'remoteControlAvailable': 1}, 'hoodOpen': False, 'breakOilStatus': False, 'vehicleMovementHis': True, 'airConditionStatus': 'false', 'windowOpen': {'frontRight': 0, 'frontLeft': 0, 'backLeft': 0, 'backRight': 0}, 'smartKeyBatteryWarning': False, 'steerWheelHeat': 0, 'tailLampStatus': 0, 'trunkOpen': False, 'doorLock': False, 'engineRuntime': {'unit': 3, 'value': 901}, 'airCtrlOn': False, 'airTemp': {'unit': 0, 'hvacTempType': 1, 'value': 'LO'}, 'lampWireStatus': {'headLamp': {'rightBifuncLamp': False, 'headLampStatus': False, 'leftLowLamp': False, 'rightHighLamp': False, 'leftBifuncLamp': False, 'leftHighLamp': False, 'rightLowLamp': False}, 'stopLamp': {'rightLamp': False, 'leftLamp': False}, 'turnSignalLamp': {'rightRearLamp': False, 'rightFrontLamp': False, 'leftRearLamp': False, 'leftFrontLamp': False}}, 'sleepModeCheck': True, 'defrost': False, 'tirePressureLamp': {'tirePressureWarningLampRearLeft': 0, 'tirePressureWarningLampFrontLeft': 0, 'tirePressureWarningLampFrontRight': 0, 'tirePressureWarningLampAll': 0, 'tirePressureWarningLampRearRight': 0}, 'trunkOpenStatus': 'false', 'engineOilStatus': False}}
2023-08-29 21:43:50.389 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - update_vehicle_with_cached_state keep Location fallback {'coord': {'alt': 0.0, 'lon': -71.14126666666667, 'type': 0, 'lat': 44.02378611}}
2023-08-29 21:43:50.389 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - update_vehicle_with_cached_state Location fallback {'coord': {'alt': 0.0, 'lon': -71.14126666666667, 'type': 0, 'lat': 44.02378611}}
2023-08-29 21:43:50.389 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - last_updated_at - before 20230829214953
2023-08-29 21:43:50.389 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - last_updated_at - after 2023-08-29 21:49:53+00:00
2023-08-29 21:43:50.390 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - last_updated_at - before None
2023-08-29 21:43:50.390 DEBUG (SyncWorker_36) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - last_updated_at - after 2000-01-01 00:00:00+00:00
2023-08-29 21:43:50.391 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Force update failed, falling back to cached: 'vehicleStatus'
Traceback (most recent call last):
  File "/config/custom_components/kia_uvo/coordinator.py", line 126, in _async_update_data
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 104, in check_and_force_update_vehicles
    self.force_refresh_vehicle_state(vehicle_id)
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 117, in force_refresh_vehicle_state
    self.api.force_refresh_vehicle_state(self.token, vehicle)
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py", line 448, in force_refresh_vehicle_state
    state["vehicleStatus"] = self._get_vehicle_status(token, vehicle, True)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py", line 165, in _get_vehicle_status
    status = dict(response["vehicleStatus"])
                  ~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'vehicleStatus'
2023-08-29 21:43:50.401 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 2.185 seconds (success: True)
synman commented 10 months ago

I suspect you have the same problem I'm experiencing #741

I was looking over the documentation as well and it does not appear US Bluelink supports forced updates.

Beyond the periodic issue reported above, I've been having good results with the normal refresh service.

I've put together some automations that use it in timed loops and am able to track changes such as start/stop/lock/unlock fairly reliably with it.

Just like with the Bluelink app it takes about a minute for the updates to make a roundtrip.

Konstigt commented 4 months ago

I think I see the same but in EU. I have force refresh set to 90 min. I think the version of the integration is v2.24.2.

Found this when troubleshooting why my car is always "away" in Home Assistant.

This error originated from a custom integration.

Logger: custom_components.kia_uvo.coordinator
Source: custom_components/kia_uvo/coordinator.py:126
integration: Hyundai / Kia Connect (documentation, issues)
First occurred: April 26, 2024 at 16:39:08 (25 occurrences)
Last logged: 07:14:38

Force update failed, falling back to cached: Unavailable remote control - Service Temporary Unavailable
Traceback (most recent call last):
  File "/config/custom_components/kia_uvo/coordinator.py", line 126, in _async_update_data
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 106, in check_and_force_update_vehicles
    self.force_refresh_vehicle_state(vehicle_id)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 119, in force_refresh_vehicle_state
    self.api.force_refresh_vehicle_state(self.token, vehicle)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 360, in force_refresh_vehicle_state
    state = self._get_forced_vehicle_state(token, vehicle)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 792, in _get_forced_vehicle_state
    _check_response_for_errors(response)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 126, in _check_response_for_errors
    raise error_code_mapping[response["resCode"]](response["resMsg"])
hyundai_kia_connect_api.exceptions.ServiceTemporaryUnavailable: Unavailable remote control - Service Temporary Unavailable