Hyundai-Kia-Connect/hyundai_kia_connect_api

CA no seat heating function

Closed this issue · 6 comments

  • Hyundai / Kia Connect version: 1.45.6
  • Python version: 3.9
  • Operating System: HAOS

Description

I was trying to get the seat heating work for the start_climate function.

What I Did

I changed the KiaUvoApiCA.py file line number 495 to the following and it worked. (Non EV)
Steeling wheel heating: On
Front and back defrost: On
Driver Seat: HI heat, All other off.

Was using burp to capture the API call.

payload = {
            "setting": {
                "airCtrl": int(climate),
                "defrost": defrost,
                "heating1": 4,
                "igniOnDuration": duration,
                "ims": 0,
                "airTemp": {"value": set_temp, "unit": 0, "hvacTempType": 1},
                "seatHeaterVentCMD":{"drvSeatOptCmd":8, "astSeatOptCmd":2, "rlSeatOptCmd":2, "rrSeatOptCmd":2},
            },
            "pin": self.pin,
        }

Any chance it could be added to the API? I usually just change the KiaUvoApiCA.py each time when this pip package get updates.

Thanks!

Yes we have another issue opened for this. All the basics exist. I just need to test it by sending heated seats will it break my car as mine doesn't support that via remote control. It changes if I can lump it into all payloads or need to do an if statement with unique payload.

I'll see if I can do that today if not my wife has the Kia this weekend away.

Other than that this will be quick.

Looks like you have an EV so it is separate from my cars logic today as start is different for reach. Can you test the latest release and let me know if it works for seats?

As a note the values are explained in https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/blob/master/hyundai_kia_connect_api/const.py

Hi cdnninjia,

No mine is ICE, 2021 Hyundai Elantra, I will test it and let you know, thanks!

Interesting! This whole time I thought when "setting" was used it was an EV in the payload as an EV won't start with my payload of a 2019 sorento ICE. This logic can be seen here:

if vehicle.engine_type == ENGINE_TYPES.EV:
payload = {
"hvacInfo": {
"airCtrl": int(options.climate),
"defrost": options.defrost,
"heating1": options.heating,
"airTemp": {
"value": hex_set_temp,
"unit": 0,
"hvacTempType": 1,
},
},
"pin": token.pin,
}
else:
payload = {
"setting": {
"airCtrl": int(options.climate),
"defrost": options.defrost,
"heating1": options.heating,
"igniOnDuration": options.duration,
"ims": 0,
"airTemp": {"value": hex_set_temp, "unit": 0, "hvacTempType": 0},
"seatHeaterVentCMD":{"drvSeatOptCmd":options.front_left_seat, "astSeatOptCmd":options.front_right_seat, "rlSeatOptCmd":options.rear_left_seat, "rrSeatOptCmd":options.rear_right_seat},
},
"pin": token.pin,
}

Now since I assume your elantra starts with the current code it means your car takes both the old and new format without issue.

So two things I need to do to narrow that down.

  1. could you enable debug logs for the package and see what "get vehicle response" I think it has an API or generation item in that. genType is a value of it that maybe tells us which we should be using.
  2. I will test using the "settings" version of the payload on my ICE 2019 and see if it works or not. If it does we can just go back to a single payload approach.

Hi cdnninja,

Here is the get vehicles response:

{
  "responseHeader": {
    "responseCode": 0,
    "responseDesc": "Success"
  },
  "result": {
    "vehicles": [
      {
        "vehicleId": "****",
        "nickName": "ELANTRA",
        "modelCode": "EL74MF20A100",
        "modelName": "ELANTRA ICE",
        "modelYear": "2021",
        "fuelKindCode": "G",
        "trim": "Ultimate Tech (Melan",
        "engine": "",
        "exteriorColor": "YP5",
        "dtcCount": 0,
        "subscriptionStatus": "A",
        "subscriptionEndDate": "****",
        "mileageForNextService": ****,
        "daysForNextService": "****",
        "overviewMessage": "",
        "defaultVehicle": true,
        "enrollmentStatus": "4",
        "genType": "G1",
        "photoUrl": "****",
        "valetParkingModeOn": 1,
        "vin": "****"
      }
    ]
  }
}

The seat heating is working now! But the side window defrost and heated steeling wheel still not work. I attached the captured settings from web request (myhyundai.ca) below. When compare with the HA log, only two parts are different: heating1 and hvacTempType.

From the HA log: heating1 is 1 and hvacTempType is 0

From the web request: heating1 is 4 and hvacTempType is 1.

{
  "setting": {
    "airCtrl": 1,
    "defrost": true,
    "airTemp": {
      "value": "13H",
      "unit": 0,
      "hvacTempType": 1
    },
    "heating1": 4,
    "igniOnDuration": 8,
    "seatHeaterVentCMD": {
      "drvSeatOptCmd": 8,
      "astSeatOptCmd": 2,
      "rlSeatOptCmd": 2,
      "rrSeatOptCmd": 2
    },
    "ims": 0,
    "defaultFavorite": false
  },
  "pin": "****"
}

Thank you for your great work!

Well I was clearly confused. EVs use havinfo so my code change only works on ICE cars. Did you try pass a 4 for heating in climate when you called it? I haven't seen a 4 so haven't defined as a enum but it should pass through. What are your options in the app? I want to create a label for 4. I assume it is "Side Windows, heated steering wheel and rear window" but want to confirm. Screenshots of the app with the options would help.

Here is the options I am aware of but 4 sounds new:

HEAT_STATUS = {
None: None,
0: "Off",
1: "Steering Wheel and Rear Window",
2: "Rear Window",
3: "Steering Wheel",
}