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

Many times a day, the intergration fails to get info, state: unavailable #946

Open Dinges28 opened 1 day ago

Dinges28 commented 1 day 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 EU / NL Version of the integration 2.27.0

Describe the bug A clear and concise description of what the bug is. A lot of times a day, I see all the entities of the car become unavailable, after a refresh or force refresh or waiting half an hour, all entities become available again Debug logs if an error occurred

2024-10-07 10:42:35.415 ERROR (MainThread) [custom_components.kia_uvo.coordinator] 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 "/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 127, 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 123, in update_geocoded_location
    vehicle.geocode = None
    ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/Vehicle.py", line 316, in geocode
    self._geocode_name = value[0]
                         ~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/kia_uvo/coordinator.py", line 136, 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 123, in update_geocoded_location
    vehicle.geocode = None
    ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hyundai_kia_connect_api/Vehicle.py", line 316, in geocode
    self._geocode_name = value[0]
                         ~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

home-assistant_kia_uvo_2024-10-07T14-04-20.184Z.log

To Reproduce wait....

Expected behavior entities stay filled, or become updated

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

Additional context

cdnninja commented 22 hours ago

Do you have it set to use email for geocode?

Dinges28 commented 22 hours ago

Do you have it set to use email for geocode?

No, it stated optional, should I?

cdnninja commented 22 hours ago

Give it a go and please let me know if it solves it.

We do need to fix the code to not crash when the geocode doesn't work but I suspect it's rate limited.

Dinges28 commented 22 hours ago

I Enabled it... lets wait and see ;-)