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
421 stars 85 forks source link

Hyundai USA: Config Not Ready: Error communicating with API: Expecting value: line 1 column 1 (char 0) #880

Open henrybauer opened 4 months ago

henrybauer commented 4 months ago

Region and Brand of car Hyundai USA Ioniq 6

Version of the integration 2.24.2

Describe the bug Integration won't start, saying: "Config Not Ready: Error communicating with API: Expecting value: line 1 column 1 (char 0)"

hyundai

Debug logs if an error occurred

Logger: hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA Source: /usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py:224 First occurred: 6:04:11 PM (1 occurrences) Last logged: 6:04:11 PM

hyundai_kia_connect_api - Unable to get vehicle location: {'errorSubCode': 'GEN', 'systemName': 'HATA', 'functionName': 'findMyCar', 'errorSubMessage': 'HATA findMyCar service failed while performing the operation FindMyCar', 'errorMessage': "We're sorry, but we could not complete your request. Please try again later.", 'errorCode': 502, 'serviceName': 'FindMyCar'}

shacklockj commented 4 months ago

I have been having this same issue with the integration since late April. It will sometime reload fine and will work for a couple of hours before reporting that the setup fails. It will be good to get to the bottom of what is causing this as my configuration has not changed since I added the integration over 8 months ago.

Not sure if this is of help to understand what is happening: 2024-05-08 12:44:40.723 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Error fetching kia_uvo data: Error communicating with API: Expecting value: line 1 column 1 (char 0) 2024-05-08 13:29:50.110 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Error fetching kia_uvo data: Error communicating with API: Expecting value: line 1 column 1 (char 0) 2024-05-08 13:44:55.172 ERROR (MainThread) [custom_components.kia_uvo.coordinator] 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_mappingresponse["resCode"] hyundai_kia_connect_api.exceptions.ServiceTemporaryUnavailable: Unavailable remote control - Service Temporary Unavailable 2024-05-08 14:15:05.716 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Error fetching kia_uvo data: Error communicating with API: Expecting value: line 1 column 1 (char 0)

jsuanet commented 4 months ago

Also after upgrade to version v2024.2.4 this error still exists.

florianoverkamp commented 4 months ago

Looks similar to what's happening here. Ioniq 5 in Europe. Running integration v2.24.4 on core 2024.5.4.

It will try to restart, and sometimes it works just fine (i.e. it magically sometimes works and sometimes doesn't). I'm guessing Hyundai is returning an error or something we're not expecting, and the integration isn't prepared to gracefully handle that.

Debug log: 2024-05-22 16:49:38.967 DEBUG (SyncWorker_8) [hyundai_kia_connect_api.KiaUvoApiEU] KiaUvoApiEU: after daily_stats: [DailyDrivingStats(date=datetime.datetime(2024, 5, 22, 0, 0), total_consumed=42428, engine_consumption=39918, climate_consumption=710, onboard_electronics_consumption=1800, battery_care_consumption=0, regenerated_energy=11547, distance=290), DailyDrivingStats(date=datetime.datetime(2024, 5, 18, 0, 0), total_consumed=1003, engine_consumption=719, climate_consumption=114, onboard_electronics_consumption=170, battery_care_consumption=0, regenerated_energy=754, distance=8), DailyDrivingStats(date=datetime.datetime(2024, 5, 17, 0, 0), total_consumed=4036, engine_consumption=3395, climate_consumption=241, onboard_electronics_consumption=400, battery_care_consumption=0, regenerated_energy=2090, distance=29), DailyDrivingStats(date=datetime.datetime(2024, 5, 16, 0, 0), total_consumed=1923, engine_consumption=1239, climate_consumption=334, onboard_electronics_consumption=350, battery_care_consumption=0, regenerated_energy=1278, distance=13), DailyDrivingStats(date=datetime.datetime(2024, 5, 12, 0, 0), total_consumed=18376, engine_consumption=17659, climate_consumption=157, onboard_electronics_consumption=560, battery_care_consumption=0, regenerated_energy=2873, distance=110), DailyDrivingStats(date=datetime.datetime(2024, 5, 11, 0, 0), total_consumed=39279, engine_consumption=37824, climate_consumption=355, onboard_electronics_consumption=1100, battery_care_consumption=0, regenerated_energy=4759, distance=258), DailyDrivingStats(date=datetime.datetime(2024, 5, 8, 0, 0), total_consumed=1882, engine_consumption=1333, climate_consumption=219, onboard_electronics_consumption=330, battery_care_consumption=0, regenerated_energy=1095, distance=13), DailyDrivingStats(date=datetime.datetime(2024, 5, 7, 0, 0), total_consumed=1132, engine_consumption=879, climate_consumption=63, onboard_electronics_consumption=190, battery_care_consumption=0, regenerated_energy=932, distance=9), DailyDrivingStats(date=datetime.datetime(2024, 5, 6, 0, 0), total_consumed=2112, engine_consumption=1211, climate_consumption=361, onboard_electronics_consumption=540, battery_care_consumption=0, regenerated_energy=799, distance=11), DailyDrivingStats(date=datetime.datetime(2024, 5, 4, 0, 0), total_consumed=4532, engine_consumption=4081, climate_consumption=151, onboard_electronics_consumption=300, battery_care_consumption=0, regenerated_energy=1851, distance=31), DailyDrivingStats(date=datetime.datetime(2024, 5, 3, 0, 0), total_consumed=863, engine_consumption=462, climate_consumption=221, onboard_electronics_consumption=180, battery_care_consumption=0, regenerated_energy=516, distance=4), DailyDrivingStats(date=datetime.datetime(2024, 5, 2, 0, 0), total_consumed=3403, engine_consumption=2700, climate_consumption=203, onboard_electronics_consumption=500, battery_care_consumption=0, regenerated_energy=2765, distance=28), DailyDrivingStats(date=datetime.datetime(2024, 5, 1, 0, 0), total_consumed=3819, engine_consumption=3358, climate_consumption=131, onboard_electronics_consumption=330, battery_care_consumption=0, regenerated_energy=2160, distance=30), DailyDrivingStats(date=datetime.datetime(2024, 4, 30, 0, 0), total_consumed=3589, engine_consumption=3128, climate_consumption=1, onboard_electronics_consumption=460, battery_care_consumption=0, regenerated_energy=2274, distance=24), DailyDrivingStats(date=datetime.datetime(2024, 4, 29, 0, 0), total_consumed=8186, engine_consumption=7216, climate_consumption=0, onboard_electronics_consumption=970, battery_care_consumption=0, regenerated_energy=5357, distance=47), DailyDrivingStats(date=datetime.datetime(2024, 4, 27, 0, 0), total_consumed=30, engine_consumption=0, climate_consumption=0, onboard_electronics_consumption=30, battery_care_consumption=0, regenerated_energy=0, distance=0)] 2024-05-22 16:49:41.459 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Error fetching kia_uvo data: Error communicating with API: Expecting value: line 1 column 1 (char 0) 2024-05-22 16:49:41.459 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 3.648 seconds (success: False)

adman234 commented 4 months ago

I am also having the same issue with a 2019 ioniq EV. I hope it can be fixed! Thanks

andregreven commented 4 months ago

Same here, Europe, Hyunday KONA. Works every now and then. Geocoded location off for a few kilometers

ianwood commented 4 months ago

Same. After reboot. Integration failed. Dropped integration and re-added it and works again.

USA. Kia EV6.

thkrmr commented 3 months ago

Same error, essentially seeing in debug logs

hyundai_kia_connect_api - Sign In Response: {'errId': 'a7925234-3e3b-4d25-a1e1-87e1e22959dc', 'errCode': '4003', 'errMsg': 'Invalid values'} 2024-06-07 23:32:46.426 DEBUG (SyncWorker_15) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - get_authorization_code_with_redirect_url failed

slusaro2 commented 3 months ago

Same error Kona Europe

raczgy commented 3 months ago

Same error, Kia EV6 & Ceed It is strange that the integration sometimes works and sometimes not:(

jamesbmarshall commented 3 months ago

I am experiencing this issue. If I manually reload the integration it will work for a short period before failing again.

matthewcky2k commented 3 months ago

I have a similar issue `This error originated from a custom integration.

Logger: custom_components.kia_uvo.coordinator Source: helpers/update_coordinator.py:347 integration: Hyundai / Kia Connect (documentation, issues) First occurred: 7:38:35 AM (2 occurrences) Last logged: 9:46:51 AM

Error fetching kia_uvo data: Error communicating with API: Expecting value: line 1 column 1 (char 0)`

robyholmes commented 3 months ago

Has anyone found the best way of avoiding this issue? I have automatic updates turned off and I just trigger a manual force update when plugging the car in, and at the start and end of charging. However it can still fail randomly requiring me to manually restart the integration multiple times to try and get it back working.

It seems to fall over at least once every 3 force updates.

rmunroe commented 3 months ago

Same here. USA, 2020 Kia Telluride

arimers commented 3 months ago

For me, this error was shown in the integration status after enabling the "Enable Geolocation Entity using OpenStreetMap" option. The logs indicated: hyundai_kia_connect_api - get vehicle location rate limit exceeded. It's possible there are multiple causes of this error, but after I disabled that option the integration works again.

With debug logging enabled, the server response was: {'errorSubCode': 'HT_534', 'systemName': 'HATA', 'functionName': 'findMyCar', 'errorSubMessage': 'HATA findMyCar service failed while performing the operation FindMyCar', 'errorMessage': 'You have exceeded the daily remote service request limit. Your last request was not processed.', 'errorCode': 502, 'serviceName': 'FindMyCar'}

matthewcky2k commented 3 months ago

For me disabling geocode location fixes this problem.

robyholmes commented 3 months ago

Yes thank you @arimers for spotting this. Can't believe I missed that in the logs.

Disabled Geocode, restarted the integration and other than failing once, so far it's worked perfectly. Not sure if a HA restart also helped it after I disabled the maps option or not.

cdnninja commented 2 months ago

I added some debug logs. Could someone update to the "master" version via service call. Enable debug logs and then when this occurs look for the two debug log statements I added:

https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/commit/867b24540916d237ac6b8b1de230fa75df35311c

I want to know if

  1. the first one is a valid URL. Copying a pasting it into a browser should work. In theory it has lat long in it.
  2. The second debug statement if it contains display_name and address.
jsuanet commented 2 months ago

Hi I updated to the master version, but I don't see the extra debugging information.

This is the logging I get.

This error originated from a custom integration.

Logger: custom_components.kia_uvo.coordinator Source: helpers/update_coordinator.py:344 integration: Kia Uvo / Hyundai Bluelink (documentation, issues) First occurred: 13:16:06 (1 occurrences) Last logged: 13:16:06

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 115, 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 115, 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)

cdnninja commented 2 months ago

Make sure to view logs not just errors.

Schrolli91 commented 2 months ago

For me disabling geocode location fixes this problem.

Thats true for me too - disabling the geocoding, will fix the data loss

cdnninja commented 1 month ago

I put a potential fix in for this.

Schrolli91 commented 1 month ago

Activated geocoding again and try to reload the integration - reloading failed! Version: 2.26.5

Force update failed, falling back to cached: 

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 "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/ApiImpl.py", line 120, 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 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 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 123, in update_geocoded_location
    vehicle.geocode = None
    ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/Vehicle.py", line 266, in geocode
    self._geocode_name = value[0]
                         ~~~~~^^^
TypeError: 'NoneType' object is not subscriptable
andregreven commented 1 month ago

Forgot to mention earlier: my connection (Hyundai - EU) is working flawlessly again last couple of weeks. Geolocation active.