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
450 stars 89 forks source link

Force updated failed #929

Closed cjsmns closed 3 weeks ago

cjsmns commented 2 months ago

Region and Brand of car Australia Hyundai Palisade 2024 Calligraphy

Version of the integration 2.26.6

Describe the bug I've had an ongoing issue that was related to another bug post here that I cannot find, but I took a chance a fully deleted the integration and reinstalled it. Good news is I can now setup the integration. The issue is that it gives an error when loading, and it keeps trying and giving the same error.

Logger: custom_components.kia_uvo.coordinator
Source: custom_components/kia_uvo/coordinator.py:126
integration: Hyundai / Kia Connect ([documentation](https://github.com/Hyundai-Kia-Connect/kia_uvo), [issues](https://github.com/Hyundai-Kia-Connect/kia_uvo/issues))
First occurred: 4:52:35 PM (5 occurrences)
Last logged: 4:58:09 PM

Force update failed, falling back to cached: 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 115, in check_and_force_update_vehicles self.update_vehicle_with_cached_state(vehicle_id) File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 90, in update_vehicle_with_cached_state self.api.update_vehicle_with_cached_state(self.token, vehicle) File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiAU.py", line 259, in update_vehicle_with_cached_state self._update_vehicle_drive_info(vehicle, state) ^^^^^ UnboundLocalError: cannot access local variable 'state' where it is not associated with a value
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 115, in check_and_force_update_vehicles
    self.update_vehicle_with_cached_state(vehicle_id)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 90, in update_vehicle_with_cached_state
    self.api.update_vehicle_with_cached_state(self.token, vehicle)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiAU.py", line 259, in update_vehicle_with_cached_state
    self._update_vehicle_drive_info(vehicle, state)
                                             ^^^^^
UnboundLocalError: cannot access local variable 'state' where it is not associated with a value

A second error shows up in the logs as well...

Logger: custom_components.kia_uvo.coordinator
Source: custom_components/kia_uvo/coordinator.py:135
integration: Hyundai / Kia Connect ([documentation](https://github.com/Hyundai-Kia-Connect/kia_uvo), [issues](https://github.com/Hyundai-Kia-Connect/kia_uvo/issues))
First occurred: 4:52:36 PM (5 occurrences)
Last logged: 4:58:10 PM

Cached update failed: 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 115, in check_and_force_update_vehicles self.update_vehicle_with_cached_state(vehicle_id) File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 90, in update_vehicle_with_cached_state self.api.update_vehicle_with_cached_state(self.token, vehicle) File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiAU.py", line 259, in update_vehicle_with_cached_state self._update_vehicle_drive_info(vehicle, state) ^^^^^ UnboundLocalError: cannot access local variable 'state' where it is not associated with a value During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/kia_uvo/coordinator.py", line 135, 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 85, in update_all_vehicles_with_cached_state self.update_vehicle_with_cached_state(vehicle_id) File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 90, in update_vehicle_with_cached_state self.api.update_vehicle_with_cached_state(self.token, vehicle) File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiAU.py", line 259, in update_vehicle_with_cached_state self._update_vehicle_drive_info(vehicle, state) ^^^^^ UnboundLocalError: cannot access local variable 'state' where it is not associated with a value
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 115, in check_and_force_update_vehicles
    self.update_vehicle_with_cached_state(vehicle_id)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 90, in update_vehicle_with_cached_state
    self.api.update_vehicle_with_cached_state(self.token, vehicle)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiAU.py", line 259, in update_vehicle_with_cached_state
    self._update_vehicle_drive_info(vehicle, state)
                                             ^^^^^
UnboundLocalError: cannot access local variable 'state' where it is not associated with a value

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/kia_uvo/coordinator.py", line 135, 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 85, in update_all_vehicles_with_cached_state
    self.update_vehicle_with_cached_state(vehicle_id)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 90, in update_vehicle_with_cached_state
    self.api.update_vehicle_with_cached_state(self.token, vehicle)
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/KiaUvoApiAU.py", line 259, in update_vehicle_with_cached_state
    self._update_vehicle_drive_info(vehicle, state)
                                             ^^^^^
UnboundLocalError: cannot access local variable 'state' where it is not associated with a value

From what I can see, it looks like it's failing to get the data about the car, and then falls back to a cached copy of the data, but as this is the first run, that fails too as there is no cached data.

Happy to provide any further information if needed.

icouper commented 2 months ago

Having the same errors. Started showing up in the logs this morning.

cdnninja commented 2 months ago

Does the native app show car data?

zadigre commented 2 months ago

I have the same issue. and the native app is not working. I’m still receiving notifications about my car (finished charging)… but refreshing the app is not working; I get an error saying « We apologize, but your request could not be processed. Please try again later. » Thud it looks like Hyundai’s server is down.

cjsmns commented 2 months ago

Does the native app show car data?

Yes, the Bluelink app is working fine.

zadigre commented 2 months ago

The native app wasn’t working for me. It started working a few hours ago… and now the integration is working fine

icouper commented 2 months ago

Does the native app show car data?

Seems like it must have been an issue on Hyundai's side. App wasn't working when I tried yesterday but it is back up now and the integration is back.

I'll keep in mind to check that first next time. Thanks!

cjsmns commented 2 months ago

The issue has not been resolved for me. Please reopen it. I’m not sure what everyone else is doing but their issues were related to an issue with the Hyundai servers and the app not working.The app is working perfectly fine for me. I have deleted the integration and set it up again and I’m still getting the same errors. This issue is ongoing. On 17 Sep 2024, at 4:39 am, cdnninja @.***> wrote: Closed #929 as completed.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

cdnninja commented 2 months ago

Please provide debug logs.

icouper commented 2 months ago

Are you able to force a refresh of the car data in the app? For me it initially looked correct but then I noted the last refresh time was multiple days ago and attempting to fresh showed the error mentioned by another above.

cjsmns commented 2 months ago

Please provide debug logs.

I've uploaded the data logs to pastbin. I hope it's ok. It's rather long.

https://pastebin.com/J1i5q0y0

Are you able to force a refresh of the car data in the app?

Not at the moment. I've updated to iOS 18 and Hyundai Bluelink app says my iPhone is jailbroken. 😂

zadigre commented 2 months ago

Not at the moment. I've updated to iOS 18 and Hyundai Bluelink app says my iPhone is jailbroken. 😂

something must be wrong on you phone… I’ve been running iOS 18 since the first beta and I never had this message

steps56 commented 2 months ago

https://github.com/Hyundai-Kia-Connect/kia_uvo/issues/931#issuecomment-2357282578

cjsmns commented 2 months ago

something must be wrong on you phone… I’ve been running iOS 18 since the first beta and I never had this message

It's an issue with the Bluelink Australia app. New update today fixed it.

Are you able to force a refresh of the car data in the app? For me it initially looked correct but then I noted the last refresh time was multiple days ago and attempting to fresh showed the error mentioned by another above.

I've just refreshed the data in the app. All working as expected in the app.

I've also removed the integration and reinstalled it and still getting the same error.

931 (comment)

I don't even have the integration loaded properly to be able to use a force update button. It just fails to load.

brave_1OYHjps3tc

cjsmns commented 3 weeks ago

Any further updates or clues as to what this issue might be? I'm running the latest version 2.28.0 as of this comment.

Still having the same issues.

cdnninja commented 3 weeks ago

Does your car have trip data in the native app?

cdnninja commented 3 weeks ago

I may have found the issue in the code. If so I'm shocked this isn't more widespread.

cdnninja commented 3 weeks ago

https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/665

cdnninja commented 3 weeks ago

Please try the latest release.

cjsmns commented 3 weeks ago

That seems to have fixed it. 🎉

Thanks for looking into it.