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

Force update not working. #275

Closed Growiel closed 2 years ago

Growiel commented 2 years 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

Ioniqu Electric v2, EU

Describe the bug

force_update doesn't work anymore.

Debug logs if an error occurred

kia_uvo - Exception in update : string indices must be integers - traceback: Traceback (most recent call last): File "/config/custom_components/kia_uvo/Vehicle.py", line 56, in update self.vehicle_data = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiEU.py", line 427, in get_cached_vehicle_status return response["resMsg"]["vehicleStatusInfo"] TypeError: string indices must be integers

I don't really have more info to share, could be due to an outage with the API, my Bluelink app is also not working, but if that's the case, I guess we need a better way to handle it (show an error message ?)

EDIT: Both the Bluelink app and the integration are back.

cdnninja commented 2 years ago

Could you test my code from #276 and let me know how it handles the next failure? It may just shift the error further up.

Growiel commented 2 years ago

Here are the results, it ws not working again this morning.

There were 3 different logs generated, in order of when they happened:

This error originated from a custom integration.

Logger: custom_components.kia_uvo.Vehicle
Source: custom_components/kia_uvo/Vehicle.py:81
Integration: Kia Uvo / Hyundai Bluelink (documentation, issues)
First occurred: 7:19:39 AM (1 occurrences)
Last logged: 7:19:39 AM

kia_uvo - Exception in update : 'NoneType' object is not subscriptable - traceback: Traceback (most recent call last): File "/config/custom_components/kia_uvo/Vehicle.py", line 59, in update self.set_last_updated() File "/config/custom_components/kia_uvo/Vehicle.py", line 258, in set_last_updated self.vehicle_data["vehicleStatus"]["time"], TypeError: 'NoneType' object is not subscriptable
This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/kia_uvo/__init__.py:207
Integration: Kia Uvo / Hyundai Bluelink (documentation, issues)
First occurred: 7:19:39 AM (1 occurrences)
Last logged: 7:19:39 AM

Error setting up entry <redacted>@gmail.com for kia_uvo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 327, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/kia_uvo/__init__.py", line 218, in async_setup_entry
    await update(dt_util.utcnow())
  File "/config/custom_components/kia_uvo/__init__.py", line 207, in update
    datetime.now(local_timezone) - vehicle.last_updated
TypeError: can't subtract offset-naive and offset-aware datetimes
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/kia_uvo/__init__.py:79
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 7:19:52 AM (1 occurrences)
Last logged: 7:19:52 AM

[140577562747232] 'vehicle'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 190, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1667, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/config/custom_components/kia_uvo/__init__.py", line 79, in async_handle_force_update
    vehicle: Vehicle = hass.data[DOMAIN][DATA_VEHICLE_INSTANCE]
KeyError: 'vehicle'

EDIT:

Forgot to attach the DEBUG logs:

2022-02-07 07:19:39 DEBUG (SyncWorker_3) [custom_components.kia_uvo.KiaUvoApiEU] kia_uvo - get_cached_vehicle_status response {'retCode': 'F', 'resCode': '4017', 'resMsg': 'Invalid request value - Invalid Application Id. - 151544.29399991035', 'msgId': 'aeb17d4c-2b94-449c-9a08-0026449e4de8'}
2022-02-07 07:19:39 DEBUG (SyncWorker_3) [custom_components.kia_uvo.KiaUvoApiEU] kia_uvo - get_cached_vehicle_status API failed to respond with data
fuatakgun commented 2 years ago

solution will be here: https://github.com/fuatakgun/kia_uvo/issues/280