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
391 stars 81 forks source link

Start Climate Service call fails on Niro EV #801

Open bstempien opened 6 months ago

bstempien commented 6 months 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 USA Kia Version of the integration 2.18.2

Describe the bug Calling the Service kia_uvo.start_climate fails to start the Climate system on my 2022 Kia Niro EV. An Error is reported in the Log Viewer. Other functions like the Vehicle Information pull, Lock and Unlock work fine.

Debug logs if an error occurred

2024-01-11 21:19:32.746 DEBUG (SyncWorker_10) [hyundai_kia_connect_api.KiaUvoAPIUSA] hyundai_kia_connect_api - Planned start_climate payload: {'remoteClimate': {'airCtrl': True, 'airTemp': {'unit': 1, 'value': '70'}, 'defrost': False, 'heatingAccessory': {'rearWindow': 0, 'sideMirror': 0, 'steeringWheel': 0}, 'ignitionOnDuration': {'unit': 4, 'value': 5}, 'heatVentSeat': {'driverSeat': {'heatVentType': 0, 'heatVentLevel': 0, 'heatVentStep': 1}, 'passengerSeat': {'heatVentType': 0, 'heatVentLevel': 0, 'heatVentStep': 1}, 'rearLeftSeat': {'heatVentType': 0, 'heatVentLevel': 0, 'heatVentStep': 1}, 'rearRightSeat': {'heatVentType': 0, 'heatVentLevel': 0, 'heatVentStep': 1}}}} 2024-01-11 21:19:32.746 DEBUG (SyncWorker_10) [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': '70'}, 'defrost': False, 'heatingAccessory': {'rearWindow': 0, 'sideMirror': 0, 'steeringWheel': 0}, 'ignitionOnDuration': {'unit': 4, 'value': 5}, 'heatVentSeat': {'driverSeat': {'heatVentType': 0, 'heatVentLevel': 0, 'heatVentStep': 1}, 'passengerSeat': {'heatVentType': 0, 'heatVentLevel': 0, 'heatVentStep': 1}, 'rearLeftSeat': {'heatVentType': 0, 'heatVentLevel': 0, 'heatVentStep': 1}, 'rearRightSeat': {'heatVentType': 0, 'heatVentLevel': 0, 'heatVentStep': 1}}}} 2024-01-11 21:19:33.560 DEBUG (SyncWorker_10) [hyundai_kia_connect_api.KiaUvoAPIUSA] hyundai_kia_connect_api got response {"status":{"statusCode":1,"errorType":1,"errorCode":450,"errorMessage":"Invalid Schema Request"}} 2024-01-11 21:19:33.560 ERROR (SyncWorker_10) [hyundai_kia_connect_api.KiaUvoAPIUSA] hyundai_kia_connect_api - Error: unknown error response {"status":{"statusCode":1,"errorType":1,"errorCode":450,"errorMessage":"Invalid Schema Request"}} 2024-01-11 21:19:33.563 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 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/kia_uvo/services.py", line 90, 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 721, 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 42, 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 87, in request_with_logging_wrapper raise RequestException requests.exceptions.RequestException 2024-01-11 21:19:33.604 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139861991153856] Error handling message: Unknown error (unknown_error) Brian Stempien from 192.168.1.28 (Mozilla/5.0 (X11; Linux x86_64) 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 1587, in async_run return await asyncio.shield(run.async_run()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 479, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 502, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/kia_uvo/services.py", line 90, 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 721, 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 42, 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 87, in request_with_logging_wrapper raise RequestException requests.exceptions.RequestException`

To Reproduce Call the service with the correct parameters.

Expected behavior Climate system turns on and heats the car.

Additional context This was working before the 2024.1 HA updates and last two Hyundai-Kia-Connect releases. But, my automations were disabled for the Christmas holidays. I uninstalled the Integration and reinstalled. I have authenticated again. I even created a PIN (I did not have one before) in the Kia Access app and then deleted my Kia and added it again.

cdnninja commented 6 months ago

Can you try roll back to 2.17.x versions of this integration and let us know if it works? Just go into HACS and redownload and select the version.

bstempien commented 6 months ago

That fixed it.

Update: It works if I don't try to trigger the Heated Steering wheel. Picking either Steering wheel, Side and Back Defroster or Steering wheel only, results in an error.

cdnninja commented 6 months ago

Does your car support heated seat setting in the native app?

When you say works with other selection do you mean current release or the old one?

bstempien commented 6 months ago

I don't see heated seats, just Rear and Steering wheel.

On Thu, Jan 11, 2024, 11:11 PM cdnninja @.***> wrote:

Does your car support heated seat setting in the native app?

— Reply to this email directly, view it on GitHub https://github.com/Hyundai-Kia-Connect/kia_uvo/issues/801#issuecomment-1888404231, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3TSEEL75Z4MHW55Q7DG23YOCZV5AVCNFSM6AAAAABBXOUQYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBYGQYDIMRTGE . You are receiving this because you authored the thread.Message ID: @.***>

cdnninja commented 6 months ago

Does the latest work with what you mentioned above or just the older version?

bstempien commented 6 months ago

Just the older version.

On Thu, Jan 11, 2024, 11:33 PM cdnninja @.***> wrote:

Does the latest work with what you mentioned above or just the older version?

— Reply to this email directly, view it on GitHub https://github.com/Hyundai-Kia-Connect/kia_uvo/issues/801#issuecomment-1888417543, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3TSED3Y7JKTTYGQD2CYVDYOC4IVAVCNFSM6AAAAABBXOUQYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBYGQYTONJUGM . You are receiving this because you authored the thread.Message ID: @.***>

dlysnes commented 5 months ago

Same here, same car. It starts hvac, but does not start windshield defrost, rear window heat and steering wheel heat. Car has heayed seats, but those are not supported neither by app nor api.

chasebolt commented 3 months ago

this is interesting to read because my 24' shortage does not have rear heated seats, but the app still sends json data with the rear seats set to 0 (off).

id be curious to know, if you log into the kia web app with your browser and send a start climate request, what json data is sent in the API call?

dlysnes commented 3 months ago

Hm, there's no web page anymore I think (EU)

chasebolt commented 3 months ago

ah bummer then as that is the easiest way to grab the json POST data as it matches the app (at least for the US).

whinis commented 1 month ago

I have the same issue with my Ev6 and here is what the web page is sending


  "action": "ACTION_EXEC_REMOTE_CLIMATE_ON",
  "remoteClimate": {
    "airTemp": {
      "value": "72",
      "unit": "1"
    },
    "airCtrl": true,
    "defrost": false,
    "ventilationWarning": true,
    "heatingAccessory": {
      "steeringWheel": 0,
      "steeringWheelStep": null,
      "sideMirror": 0,
      "rearWindow": 0
    }
  }
}```
whinis commented 1 month ago

I submitted a PR to the api https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/567 that should hopefully fix this and #844