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

Error fetching kia_uvo data: Error communicating with API #914

Closed CDAutomate closed 3 weeks ago

CDAutomate commented 1 month 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 Canada, Kia

Version of the integration 2.26.1

Describe the bug A clear and concise description of what the bug is.

Logger: custom_components.kia_uvo.coordinator Source: helpers/update_coordinator.py:344 integration: Hyundai / Kia Connect (documentation, issues) First occurred: July 28, 2024 at 10:43:29 AM (3 occurrences) Last logged: 7:47:10 AM Error fetching kia_uvo data: Error communicating with API: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 974, in json return complexjson.loads(self.text, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/init.py", line 514, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 386, in decode obj, end = self.raw_decode(s) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 416, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: 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 113, 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 92, in update_vehicle_with_cached_state self.api.update_geocoded_location( File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/ApiImpl.py", line 118, in update_geocoded_location response = response.json() ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/kia_uvo/coordinator.py", line 132, 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 92, in update_vehicle_with_cached_state self.api.update_geocoded_location( File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/ApiImpl.py", line 118, in update_geocoded_location response = response.json() ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Outlined here: https://github.com/fuatakgun/kia_uvo/blob/master/README.md

To Reproduce Initialize Integration

Expected behavior Integration initializes successfully and provides data

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

Additional context

cdnninja commented 1 month ago

Enable debug logs and post them.

stephenmhall commented 1 month ago

Not working for me either, logs showing hyundai_kia_connect_api.exceptions.RateLimitingError: Exceeds number of requests - Exceeds Number of Requests. Maybe they have changed the amount allowed down?

cdnninja commented 1 month ago

That's a different error.

CDAutomate commented 1 month ago

HyundaiKiaConnectDebugLog.txt

rmunroe commented 1 month ago

Any updates to this issue or known workarounds?

cdnninja commented 1 month ago

It's a duplicate issue but one work around is disable geo location. More debug statements need to be added to see what is going wrong.

theriaultjulien commented 3 weeks ago

I have a similar issue, I get this error in Home Assistant after adding the integration: Failed setup, will retry: Config Not Ready: Error communicating with API: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 974, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/__init__.py", line 514, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 386, in decode obj, end = self.raw_decode(s) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 416, in raw_decode return...

In DEBUG logs I can see that my credentials are fine and the API seems to be working: 2024-08-14 21:42:16.929 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Sign In Response {"responseHeader":{"responseCode":0,"responseDesc":"Success"},"result":

And I can see it gets info on my car: 2024-08-14 21:42:17.137 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Get Vehicles Response {"responseHeader":{"responseCode":0,"responseDesc":"Success"},"result":{"vehicles":[{"vehicleId":"I//VimX+uagOj9lPXpY7aw==","nickName":"Niro","modelCode":"TOW5ZHZ7ZHH532","modelName":"Niro","modelYear":"2024","fuelKindCode":"E","trim":"","engine":"","exteriorColor":"SWP","dtcCount":0,"subscriptionStatus":"A","subscriptionEndDate":"20270808","mileageForNextService":11707.3,"daysForNextService":"20250211","overviewMessage":"","defaultVehicle":true,"enrollmentStatus":"4","genType":"G3","valetParkingModeOn":1,"mainBatteryType":0,"isBasicPackage":false,"isWarrantyExpired":"0","vin":"9012"}]}}

Right after this there's this line: 2024-08-14 21:42:17.615 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 1.192 seconds (success: False)

Here's the complete log file: home-assistant_2024-08-15T01-58-13.448Z.log

Geo location is disabled by default.

cdnninja commented 3 weeks ago

I tried to improve some logging. Could you update to latest and see if logs have more detail?

theriaultjulien commented 3 weeks ago

I updated to latest and tried again, here are the logs home-assistant_2024-08-15T03-16-24.482Z.log

Edit: now the error message in Home Assistant is this: Failed setup, will retry: Config Not Ready: Expecting value: line 1 column 1 (char 0)

cdnninja commented 3 weeks ago

What version is this just to confirm?

theriaultjulien commented 3 weeks ago

v.2.26.2 image

Idk if this info is useful, but my home-assistant installation is brand new, I just created a HA VM just to try this integration out, I don't have any other custom integrations or anything.

cdnninja commented 3 weeks ago

Please try latest and report back with logs.

theriaultjulien commented 3 weeks ago

Hi, updated to latest (2.26.4) and retried, here are the logs, now there's much more stuff! home-assistant_2024-08-16T17-51-12.526Z.log

cdnninja commented 3 weeks ago

This is a different issue from OP. Does a "force update" work from the native app?

theriaultjulien commented 3 weeks ago

Okay. Should I open another issue then?

You mean on the Kia Connect app, do a refresh? It doesn't work, it refreshes like every 6-8 hours. That's why I wanted to try this integration, their app sucks and does not update at all.

cdnninja commented 3 weeks ago

The integration is failing for you because the native api is failing. Is your car outside within cell service?

theriaultjulien commented 3 weeks ago

I see... Yes the car is parked outside, plugged in and in a city with good cell service. Could it be a problem with the car then? Should I talk to my dealership? lol getting off track sorry

cdnninja commented 3 weeks ago

If the native app fails when you click that update button yes talk to manufacturer. No need to talk to them about the integration as the product they make doesn't work.

cdnninja commented 3 weeks ago

Keep this integration disabled while you do that in case it's maxing out calls.

theriaultjulien commented 3 weeks ago

Thanks for your help I will check with my dealership.

cdnninja commented 3 weeks ago

As the OP hasn't returned I am going to close this for now. The comment from OP is also duplicate to other thread. @theriaultjulien if you have more questions please open a new issue.