kia_uvo icon indicating copy to clipboard operation
kia_uvo copied to clipboard

Bluelink/Hyundai - Open & Close charging door

Open beanian opened this issue 3 years ago • 20 comments

Is it possible to extend the functionality of this service to support the opening & closing of the charing port door? I can perform those actions from the Bluelink app. I have an EU Hyundai Ioniq 5.

beanian avatar Jan 11 '22 18:01 beanian

Hey, normally it is doable BUT in EU region, i needed to reverse engineer all the mobile app calls via installing the app into my phone and directly executing the commands. If you have tech knowledge, follow our wiki page to do the similar, otherwise, i have to access your car to extract exact calls and functions.

fuatakgun avatar Jan 11 '22 18:01 fuatakgun

Thanks, tried following the steps to capture the traffic, however upon launching the modified Bluelink app I get a message saying "This application has been forged" and it quits. Any ideas?

beanian avatar Jan 13 '22 20:01 beanian

Opening/closing charge port (I5/EV6)is done by calling below URL - Note the api/v2 in the URL as opposed the the other stuff on v1.

https://prd.eu-ccapi.kia.com:8080/api/v2/spa/vehicles/a0...10/control/portdoor HTTP/1.1

with Json message:

{"action":"open"}
{"action":"close"}

povlhp avatar Feb 07 '22 10:02 povlhp

thanks for this, we need to modify based on v1 vs v2, you are right.

fuatakgun avatar Feb 08 '22 17:02 fuatakgun

Hi @fuatakgun , Great work on this. Any plans to ad this feature, "open/close charging port"?

nrfribeiro avatar Oct 07 '22 15:10 nrfribeiro

@ZuinigeRijder with the above sniffed URL would you up to implement this in EU and give it a try? Once working in the API I can extend here in UVO.

cdnninja avatar Nov 26 '22 22:11 cdnninja

FYI Initial work on this in the API is here: https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/153 and needs testing.

cdnninja avatar Nov 30 '22 04:11 cdnninja

I have created a PR with a service for this. If able to test it out before I merge that would be great!

cdnninja avatar Dec 02 '22 22:12 cdnninja

This has since been released in the 2.X branch. If you could test that would be awesome. I will close this in a few days if I don't hear back.

cdnninja avatar Dec 12 '22 01:12 cdnninja

Anyone had a chance to test this out?

cdnninja avatar Dec 17 '22 04:12 cdnninja

Just tested this on my Hyundai Ioniq 5 in Ireland and it does not work. When I call the service it unlocks the car and the charging port door remains closed.

beanian avatar Dec 17 '22 17:12 beanian

https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/194

cdnninja avatar Dec 17 '22 20:12 cdnninja

Could you update in HACS from "master" and try again?

cdnninja avatar Dec 17 '22 20:12 cdnninja

So I tried again and got this Logger: hyundai_kia_connect_api.KiaUvoApiEU Source: /usr/local/lib/python3.10/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py:66 First occurred: 4:49:11 PM (1 occurrences) Last logged: 4:49:11 PM

Unknown API response format: {'error': 'Access to this API has been disallowed'}

beanian avatar Dec 20 '22 16:12 beanian

Could you enable debug logs and provide those?

cdnninja avatar Dec 20 '22 17:12 cdnninja

2022-12-21 15:47:58.152 DEBUG (SyncWorker_9) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - Charge Port Action Request: {'action': 'open', 'deviceId': 'xxxxxx-a166-4504-83ec-xxxxxxxxx'} 2022-12-21 15:47:58.153 DEBUG (SyncWorker_9) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - get_stamp 2022-12-21 13:02:53.523000+00:00 120000 82 998 82.53858847500001 2022-12-21 15:47:58.764 DEBUG (SyncWorker_9) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - Charge Port Action Response: {'error': 'Access to this API has been disallowed'} 2022-12-21 15:47:58.765 ERROR (SyncWorker_9) [hyundai_kia_connect_api.KiaUvoApiEU] Unknown API response format: {'error': 'Access to this API has been disallowed'} 2022-12-21 15:47:58.777 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 451, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/kia_uvo/services.py", line 90, in async_handle_open_charge_port await coordinator.async_open_charge_port(vehicle_id) File "/config/custom_components/kia_uvo/coordinator.py", line 174, in async_open_charge_port await self.hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 126, in open_charge_port return self.api.charge_port_action(self.token, self.get_vehicle(vehicle_id), CHARGE_PORT_ACTION.OPEN) File "/usr/local/lib/python3.10/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 565, in charge_port_action _check_response_for_errors(response) File "/usr/local/lib/python3.10/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 67, in _check_response_for_errors raise InvalidAPIResponseError() hyundai_kia_connect_api.exceptions.InvalidAPIResponseError

beanian avatar Dec 21 '22 15:12 beanian

Unfortunately not alot for me to go on. Looks like we are sending the correct command but something isn't correct. I assume this works fine in your mobile app? @povlhp are you able to test it out and compare payloads?

cdnninja avatar Dec 21 '22 18:12 cdnninja

I came here to look for this feature. Any news or status? I notice that my Bluelink app asks for biometrics to allow opening the charging port, can that be related?

tmjo avatar Mar 20 '24 09:03 tmjo

Code was created but no one has tested it. https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/506

Could you test?

cdnninja avatar Mar 20 '24 20:03 cdnninja

Code was created but no one has tested it. Hyundai-Kia-Connect/hyundai_kia_connect_api#506

Could you test?

Ah, cool! I'll test it. Currently away from home for some weeks, but I'll test it when I get back home!

tmjo avatar Mar 28 '24 12:03 tmjo