kia_uvo: 2024 Kia Sportage - Incorrect request payload format

Region and Brand of car US 2024 Kia Sportage X-Pro Prestige

Version of the integration v2.16.3

Describe the bug Trying to start the car with heating: 4, it fails with the error Incorrect request payload format. Screenshot below shows I do have all of these features available in the app.

Debug logs if an error occurred

2023-12-17 21:19:11.227 DEBUG (SyncWorker_4) [hyundai_kia_connect_api.KiaUvoAPIUSA] hyundai_kia_connect_api - Planned start_climate payload: {'remoteClimate': {'airCtrl': True, 'airTemp': {'unit': 1, 'value': '80'}, 'defrost': True, 'heatingAccessory': {'rearWindow': 4, 'sideMirror': 4, 'steeringWheel': 4}, 'ignitionOnDuration': {'unit': 4, 'value': 10}}}
2023-12-17 21:19:11.228 DEBUG (SyncWorker_4) [hyundai_kia_connect_api.KiaUvoAPIUSA] hyundai_kia_connect_api - sending https://api.owners.kia.com/apigw/v1/rems/start request with {'remoteClimate': {'airCtrl': True, 'airTemp': {'unit': 1, 'value': '80'}, 'defrost': True, 'heatingAccessory': {'rearWindow': 4, 'sideMirror': 4, 'steeringWheel': 4}, 'ignitionOnDuration': {'unit': 4, 'value': 10}}}
2023-12-17 21:19:11.671 DEBUG (SyncWorker_4) [hyundai_kia_connect_api.KiaUvoAPIUSA] hyundai_kia_connect_api got response {"status":{"statusCode":1,"errorType":1,"errorCode":9001,"errorMessage":"Incorrect request payload format"}}
2023-12-17 21:19:11.671 ERROR (SyncWorker_4) [hyundai_kia_connect_api.KiaUvoAPIUSA] hyundai_kia_connect_api - Error: unknown error response {"status":{"statusCode":1,"errorType":1,"errorCode":9001,"errorMessage":"Incorrect request payload format"}}
2023-12-17 21:19:11.674 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
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 70, in async_handle_start_climate
await coordinator.async_start_climate(vehicle_id, climate_request_options)
File "/config/custom_components/kia_uvo/coordinator.py", line 198, in async_start_climate
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 134, in start_climate
return self.api.start_climate(self.token, self.get_vehicle(vehicle_id), options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoAPIUSA.py", line 652, in start_climate
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
2023-12-17 21:19:11.705 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140429685065152] Error handling message: Unknown error (unknown_error) Chase Bolt from 192.168.1.1 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 782, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
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 70, in async_handle_start_climate
await coordinator.async_start_climate(vehicle_id, climate_request_options)
File "/config/custom_components/kia_uvo/coordinator.py", line 198, in async_start_climate
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 134, in start_climate
return self.api.start_climate(self.token, self.get_vehicle(vehicle_id), options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoAPIUSA.py", line 652, in start_climate
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

To Reproduce

service: kia_uvo.start_climate
data:
  duration: 10
  climate: true
  temperature: 80
  defrost: true
  heating: 4
  device_id: 5115d312c9cce9f562401c1bb71ffc85
  flseat: 8
  frseat: 8

Expected behavior Start the car with heated steering wheel, heated mirrors, and rear defrost.

Screenshots IMG_B65D260C000D-1

Additional Info I tested different values for heating and these are available to me: 0, 1

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

Example code that I use to test. This is so I can reference a local copy of the code:

from pathlib import Path
import logging
import sys
import os

path_root = r"path to local github directory with edit"
sys.path.append(str(path_root))
from hyundai_kia_connect_api import *
from hyundai_kia_connect_api.exceptions import *

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='%(asctime)s %(name)s %(levelname)s:%(message)s')
logger = logging.getLogger(__name__)

vm = VehicleManager(region=1, brand=3, username="test@gmail.com", password="test", pin="", geocode_api_enable = True)

print(vm.check_and_refresh_token())


vm.update_all_vehicles_with_cached_state()
print(vm.vehicles)

Now in here where the print is called you could add other items to run: start climate would be something like. It would also need seats added if you like following the names here: https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/blob/b705f143aa87f82c8e45d383254636281ecb96f0/hyundai_kia_connect_api/ApiImpl.py#L19-L28

climateOptions = ClimateRequestOptions(set_temp = 70, duration = 10, defrost = True, climate = True, heating = 1)
vm.start_climate(vm.vehicles[0].id, climateOptions)

The CI follows semantic release titles. It is how it picks the release number and generates release notes. I’m not sure why that last one didn’t.

If you google semantic release it shows the rules of it. I’m no pro with this. When by a computer I’ll tinker to try make sure the checks tell us in advance before I merge it.