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

unknown error response when 12v battery is < 40% SoC #774

Open freaksdotcom opened 9 months ago

freaksdotcom commented 9 months ago

Please check Services, Known Bug / Issues and Troubleshooting over here first: https://github.com/fuatakgun/kia_uvo/blob/master/README.md US Kia EV6

Version of the integration 2.16.3

Describe the bug The integration doesn't recognize the error code when the 12v battery is low

2023-12-15 21:32:52.861 ERROR (SyncWorker_0) [hyundai_kia_connect_api.KiaUvoAPIUSA] hyundai_kia_connect_api - Error: unknown error response {"status":{"statusCode":1,"errorType":1,"errorCode":8007,"errorMessage":"Remote commands are not available due to low battery level. Battery must have at least 40% charge to execute remote commands."}}
2023-12-15 21:32:52.864 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547432001856]
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/kia_uvo/services.py", line 49, in async_handle_force_update
await coordinator.async_force_update_all()
File "/config/custom_components/kia_uvo/coordinator.py", line 159, in async_force_update_all
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 113, in force_refresh_all_vehicles_states
self.force_refresh_vehicle_state(vehicle_id)
File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 118, in force_refresh_vehicle_state
self.api.force_refresh_vehicle_state(self.token, vehicle)
File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoAPIUSA.py", line 254, in force_refresh_vehicle_state
self._get_forced_vehicle_state(token, vehicle)
File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoAPIUSA.py", line 576, in _get_forced_vehicle_state
response = self.post_request_with_logging_and_active_session(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoAPIUSA.py", line 41, in request_with_active_session_wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoAPIUSA.py", line 86, in request_with_logging_wrapper
raise RequestException
requests.exceptions.RequestException

Debug logs if an error occurred

To Reproduce Drain the 12v battery Force refresh

Expected behavior

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

Additional context

cdnninja commented 9 months ago

Out of interest. When in that state does any of the cached data show a battery error of some sort?

If so we can make it so once that happens it never tries a force refresh.

npike commented 9 months ago

My Niro PHEV is currently in this state, the data from the last refresh doesn't seem to indicate any errors other than stateOfCharge for the 12v battery is ”11”

cdnninja commented 9 months ago

Just checked and today kia USA branch doesn't handle error codes yet like the EU side. So home assistant will retry in the future.

Perfect world we would detect if last cached status was below say 40% and stop even bothering to try. I don't have a Kia though so don't spend much time on this anymore. Happy to receive a PR.