Hyundai-Kia-Connect / hyundai_kia_connect_api

This is a Kia UVO and Hyundai Bluelink written in python. It is primary consumed by home assistant. If you are looking for a home assistant Kia / Hyundai implementation please look here: https://github.com/Hyundai-Kia-Connect/kia_uvo. Much of this base code came from reading bluelinky and contributions to the kia_uvo home assistant project.
MIT License
123 stars 71 forks source link

Remote Climate Start Not Functional for IONIQ BEVs #369

Closed kermitageo closed 11 months ago

kermitageo commented 1 year ago

Hi, I am unable to get remote climate start to function with an IONIQ 5/6 vehicle.

climateOpts = ClimateRequestOptions(set_temp="72")
vm.start_climate(vehicle_id="XYZ",options=climateOpts)

Response:

hyundai_kia_connect_api - Start engine response: {"errorSubCode":"GEN","systemName":"BLODS","errorSubMessage":"Feature Status is OFF","errorMessage":"Your vehicle does not support this feature.","errorCode":502}

It seems that these vehicles may use a different API endpoint for remote starting vs. those seen in HyundaiBlueLinkAPIUSA.py

# this URL is not correct - what is it?
url = self.API_URL + "rcs/rsc/start"

Has there been any research done into which endpoints these vehicles use so they can be supported here? Thanks!

cdnninja commented 1 year ago

Not so far. Someone in the USA with one of these cars will need to sniff the traffic.

We don't have any regular devs in the USA. Just in Canada and eu.

kermitageo commented 1 year ago

Whoops, accidental close.

Looks like this is the same issue as

https://github.com/Hyundai-Kia-Connect/kia_uvo/issues/400 && https://github.com/Hacksore/bluelinky/issues/221

TaiPhamD commented 1 year ago

Not so far. Someone in the USA with one of these cars will need to sniff the traffic.

We don't have any regular devs in the USA. Just in Canada and eu.

I have this car and would like a suggestion on how to snoop the traffic. Previously, I had my own api working against this endpoint: https://owners.hyundaiusa.com/bin/common/remoteAction. however , the ability to get the auth token for that endpoint is not working anymore as their web login requires passing google captcha: https://owners.hyundaiusa.com/us/en/login.html

I would love to see if we can use the Oauth login from: https://api.telematics.hyundaiusa.com/ac/v2/rcs/rsc/start to make it work with Ioniq5 and newer vehicles.

cdnninja commented 1 year ago

nox plus charles web proxy works for the android app. The android app I think is a different API in the US than the website.

Once your sniff that endpoint it is most likely quick to update the code to support both ICE and the EV approach.

TaiPhamD commented 1 year ago

@cdnninja did you have to do anything special with the NOX and charles proxy setup? I can't get the MyHyundai app to go through my charles ssl proxy since the ssl chain keeps on breaking. I enabled root in NOX android 12 and added charles CA cert into the android's system CA (/system/etc/security/cacerts/) but it's still not happy. I even tried to decompile the APK and edited res/xml/network-security-config .xml to allow trusting both user and system CA but that didn't help either. Thanks.

cdnninja commented 1 year ago

Each region is different. Sounds like you did the steps I have done for other regions. You could try Android 6. Some don't like rooted devices as well.

cdnninja commented 1 year ago

To confirm the web browser in nox is working for ssl sites? Just to prove your config out.

TaiPhamD commented 1 year ago

To confirm the web browser in nox is working for ssl sites? Just to prove your config out.

yes see here:

image
zphaze commented 12 months ago

Unsure if it’s helpful but I was able to sniff traffic from the iOS app last month and could do more if necessary. The information is posted in this issue https://github.com/Hyundai-Kia-Connect/kia_uvo/issues/400

TaiPhamD commented 12 months ago

Unsure if it’s helpful but I was able to sniff traffic from the iOS app last month and could do more if necessary. The information is posted in this issue Hyundai-Kia-Connect/kia_uvo#400

This is exactly what I needed. The endpoint is simply different for ioniq 5: /ac/v2/evc/fatc/start and using this I was able to start the climate control. Do you have payload for stopping climate control as well?

cdnninja commented 12 months ago

@zphaze oops I missed you response. This part will need a PR generated. https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/blob/5c52701160db6144e353369aa0602fabd468202a/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py#L507-L559

Assuming that code still works for non electric vehicles if statements are key for any changed portion such as the endpoint. I don't own a Kia anymore so can't say I keep up with this repo like I used to.

zphaze commented 12 months ago

@TaiPhamD Here is the Stop Command

POST /ac/v2/evc/fatc/stop HTTP/1.1
Host: [api.telematics.hyundaiusa.com](http://api.telematics.hyundaiusa.com/)
deviceId: …
Accept: */*
deviceMeid: …
Accept-Encoding: gzip, deflate, br
Location: ..
Content-Length: 2
User-Agent: MyHyundai/5.1.5 (iPhone; iOS 17.0.3; Scale/3.00)
deviceName: iPhone
gen: 2
Cookie: …
Version: 1.4.7
registrationId: …
osVersion: 17.0.3
from: SPA
access_token: …
brandIndicator: H
Accept-Language: en-US;q=1
NADID: …
requestId: 60
username: …
Featureusage_time: 2023-10-22T14:26:57Z
Client_Id: …
vin: …
Offset: -7
Connection: keep-alive
Content-Type: application/json
osType: iOS
APPCLOUD-VIN: …
appVersion: 5.1.5
Language: 0
To: ISS
appType: MyHyundai
{}
TaiPhamD commented 12 months ago

@zphaze thank you. I finally managed to do the SSL proxy decoding myself on iOS and its much easier. For some reason my android emulator did not work well at all compare to iOS. I can get all the api myself now.