Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Dinges28 opened this issue Oct 7, 2024 · 6 comments
Open

Comments

@Dinges28
Copy link

Dinges28 commented Oct 7, 2024

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
Copy link
Collaborator

cdnninja commented Oct 7, 2024

Do you have it set to use email for geocode?

@Dinges28
Copy link
Author

Dinges28 commented Oct 7, 2024

Do you have it set to use email for geocode?

No, it stated optional, should I?

@cdnninja
Copy link
Collaborator

cdnninja commented Oct 7, 2024

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
Copy link
Author

Dinges28 commented Oct 7, 2024

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

@Dinges28
Copy link
Author

Dinges28 commented Oct 9, 2024

Up till now... It looks promising. just had 1 occasion, but that could have been an error on my side.
Will wait till the end of today. Else it was the geocode error.

btw; While having you on the "line", probably you know this.
My cars location is only updated on the moment of being parked and locked for 10 minutes or so.. I only see the parking locations in the history of the location.
Is this default behavior? And can I automate it that if it receives "engine state: on" to force update every 15 minutes or so? Or something more smart?

@cdnninja
Copy link
Collaborator

The car only reports to the server based on its logic. Separately we query the server at the interval set in config. Certain commands force the car to wake up but that consumed 12v battery and isn't great. If you like you can use automations to trigger the logic you are looking for but may have risk.

I do think we can fix code here to improve the geocode issue.

cdnninja added a commit to Hyundai-Kia-Connect/hyundai_kia_connect_api that referenced this issue Oct 12, 2024
Hyundai-Kia-Connect/kia_uvo#946

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants