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
398 stars 84 forks source link

Two cars - One Account - Force update failed, falling back to cached: 'vehicleStatus' #741

Open synman opened 8 months ago

synman commented 8 months ago

Please check Services, Known Bug / Issues and Troubleshooting over here first: https://github.com/fuatakgun/kia_uvo/blob/master/README.md Region and Brand of car US 2019 Sonata 2020 Palisade

Version of the integration main

Describe the bug all sensors go "unknown and the above message shows up in my log.

Logger: custom_components.kia_uvo.coordinator
Source: custom_components/kia_uvo/coordinator.py:126 
Integration: Hyundai / Kia Connect ([documentation](https://github.com/fuatakgun/kia_uvo), [issues](https://github.com/fuatakgun/kia_uvo/issues)) 
First occurred: November 7, 2023 at 8:51:29 PM (19 occurrences) 
Last logged: 5:24:58 PM

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 105, 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 118, 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 449, 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 166, in _get_vehicle_status
    status = dict(response["vehicleStatus"])
                  ~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'vehicleStatus'

followed by

This error originated from a custom integration.

Logger: custom_components.kia_uvo.coordinator
Source: helpers/update_coordinator.py:322 
Integration: Hyundai / Kia Connect (documentation, issues) 
First occurred: 5:26:39 PM (1 occurrences) 
Last logged: 5:26:39 PM

Error fetching kia_uvo data: Error communicating with API: 'enrolledVehicleDetails'

To Reproduce This happened today immediately after executing two automations I threw together that lock the doors on one of my cars, starts it with climate and the second automation powers the car back down.

I also noticed last night right after putting the automations together that I quickly blew through all of my available requests for the day apparently. I noticed an error in the bluelink app telling me that I exceeded this threshold. such a shame too because the bluelink subscription I far from cheap after your 24 month trial ends.

Anyway, many hours later today I tried out my automations again and after they ran successfully everything went dark.

Expected behavior don't get locked out

Screenshots If applicable, add screenshots to help explain your problem.

Additional context

synman commented 8 months ago

A few more details.... looks like just dumb luck that I caught it going dark immediately after running an automation. This dropout appears to be happening regularly... I'm guessing every time it tries to force update.

Screenshot 2023-11-08 at 6 08 56 PM Screenshot 2023-11-08 at 6 18 06 PM
cdnninja commented 8 months ago

Could you enable debug log and post the response of the command that caused the failure?

synman commented 8 months ago

here's what I've got:

Screenshot 2023-11-11 at 8 17 01 PM
2023-11-11 14:03:48.573 DEBUG (SyncWorker_8) [hyundai_kia_connect_api.VehicleManager] hyundai_kia_connect_api - Refresh token expired
2023-11-11 14:03:48.935 DEBUG (SyncWorker_8) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - Sign In Response {"access_token":"**REMOVED**","refresh_token":"**REMOVED**","expires_in":"1799","username":"**REMOVED**"}
2023-11-11 14:03:48.936 DEBUG (SyncWorker_8) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - Access Token Value **REMOVED**
2023-11-11 14:03:48.936 DEBUG (SyncWorker_8) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - Refresh Token Value **REMOVED**
2023-11-11 14:03:48.937 DEBUG (SyncWorker_0) [hyundai_kia_connect_api.VehicleManager] hyundai_kia_connect_api - Time differential in seconds: 25209.936988
2023-11-11 14:04:37.112 DEBUG (SyncWorker_0) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - Get Vehicles Response {"errorSubCode":"BLD_504_3","systemName":"BLODS","functionName":"TM_OHTHU001","errorMessage":"Your request is taking longer than normal to respond, please restart the app and try again. If this continues to occur call 855-2BlueLink (1-855-225-8354) for assistance.","errorCode":504,"serviceName":"TM_OHTHU001"}
2023-11-11 14:04:53.289 DEBUG (SyncWorker_11) [hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - Get Vehicles Response {"errorSubCode":"BLD_504_3","systemName":"BLODS","functionName":"TM_OHTHU001","errorMessage":"Your request is taking longer than normal to respond, please restart the app and try again. If this continues to occur call 855-2BlueLink (1-855-225-8354) for assistance.","errorCode":504,"serviceName":"TM_OHTHU001"}
2023-11-11 14:04:53.289 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Error fetching kia_uvo data: Error communicating with API: 'enrolledVehicleDetails'
cdnninja commented 8 months ago

Thank you. I assume native app is working for both cars with refreshing data?

synman commented 8 months ago

yup... I don't leave it open though :) and the majority of the time this awesome integration has no problems either.