Hacksore / bluelinky

An unofficial nodejs API wrapper for Hyundai bluelink and Kia UVO
https://bluelinky.readme.io
MIT License
345 stars 77 forks source link

Support setting additional climate options (steeringwheel warmer, sidemirrors/rearwindowheating) #230

Open tsfuchs opened 1 year ago

tsfuchs commented 1 year ago

Hi there,

I own a Hyundai Ioniq 5 and I would like to be able to control the climate settings remotely. I have analyzed the payloads of the API calls in the Bluelink app, and I have noticed the following:

I would be happy to submit a PR with changes, but it would depend on how the VehicleClimateOptions are intended to be structured in the future.

Hacksore commented 1 year ago

There are plans to simplify the input options in 8.x which has not yet been released.

I guess we have been thinking they are boolean flags but maybe more like an enum depending on your vehicle?

Happy to accept a PR on this.

https://bluelinky.readme.io/reference/start

arteck commented 1 year ago

grafik

this is a simple boolean

tsfuchs commented 1 year ago

grafik

this is a simple boolean

Oh wow, you‘ve found the official Hyundai api documentation? This makes our lives so much easier. Kidding aside, the Official Bluelink App sends 0, 2, 3 or 4 to the Hyundai ioniq 5. So you are unfortunately wrong, at least this is not boolean for all cars.

arteck commented 1 year ago

show that I want to see..

RAW data plz

cdnninja commented 1 year ago

From the python side we learned that anything returned as an int from the api that appears to be a Boolean isn't. So heating and seats are examples of that. Some items return a true or false. Anything else has additional meaning.

We are using enums to map this out.

This also differs by model.

cdnninja commented 1 year ago

Since I am by a PC now here is our constant file that shows what we have learned so far: https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/blob/master/hyundai_kia_connect_api/const.py

arteck commented 1 year ago

in my opinion is it only the send status from car.. not setable status... on/off grafik

we are talking here about "turn on/off"

cdnninja commented 1 year ago

I can confirm as fact that for at least Canada the above is used for setting. I have it functional and tested in recent days.

Other regions waiting to hear from users if the app supports setting and someone to capture that traffic.

cdnninja commented 1 year ago

https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/issues/190

tsfuchs commented 1 year ago

As written above, I traced the API calls the Bluelink app makes when activating steering wheel warmer and/or side mirrors/rear window. So cdnninja is definitely right that these values are not only used when reading out the vehicle status. And I can also confirm that sending 1 for heating1 works as well for activating both even though the app sent 4 in the europe region.

cdnninja commented 1 year ago

@tsfuchs Could you do me a huge favor and check if your app offers this same sort of thing for heated / cooled seats? I have that implemented in canada API but not sure if offered for EU. As well if you can post what 4 means compared to my above post that would be great. I have seen a few posts lately reference 4 so would like to get the description right for it.

tsfuchs commented 1 year ago

@cdnninja In the European version of Bluelink, at least for the Ioniq 5, there is no control of seat heating and ventilation. However, it is possible that the API requirements may work, but I have not tested this. There is no difference in the effect between 1 and 4 for my Ioniq 5, but the app sends the 4. It's possible that the number "1" always means that all available systems are activated, or it may only function for compatibility purposes. From what I've found, the API seems quite "grown" and doesn't seem to have been well thought out from the start, but rather just started and then more and more functions were added in different regions. It's possible that the API has evolved over time as new features and capabilities were added.

tsfuchs commented 1 year ago

@arteck @cdnninja Here the extracted payload from the eu bluelink app (ioniq5), if arteck can't believe otherwise:

[ // only AC
    {
        "action": "start",
        "deviceId": "xxx",
        "hvacType": 1,
        "options": {
            "defrost": false,
            "frontWindowHeating": 0,
            "heating1": 0
        },
        "tempCode": "10H",
        "unit": "C"
    } ,
    // defrost windscreen
    {
        "action": "start",
        "deviceId": "xxx",
        "hvacType": 1,
        "options": {
            "defrost": true,
            "frontWindowHeating": 0,
            "heating1": 0
        },
        "tempCode": "10H",
        "unit": "C"
    },
    // side mirrors/rear window
    {
        "action": "start",
        "deviceId": "xxx",
        "hvacType": 1,
        "options": {
            "defrost": false,
            "frontWindowHeating": 0,
            "heating1": 2
        },
        "tempCode": "10H",
        "unit": "C"
    },
    // steering wheel warmer
    {
        "action": "start",
        "deviceId": "xxx",
        "hvacType": 1,
        "options": {
            "defrost": false,
            "frontWindowHeating": 0,
            "heating1": 3
        },
        "tempCode": "10H",
        "unit": "C"
    },
    // defrost windscreen + side mirrors/rear window
    {
        "action": "start",
        "deviceId": "xxx",
        "hvacType": 1,
        "options": {
            "defrost": true,
            "frontWindowHeating": 0,
            "heating1": 2
        },
        "tempCode": "10H",
        "unit": "C"
    },
    // defrost windscreen + steering wheel warmer
    {
        "action": "start",
        "deviceId": "xxx",
        "hvacType": 1,
        "options": {
            "defrost": true,
            "frontWindowHeating": 0,
            "heating1": 3
        },
        "tempCode": "10H",
        "unit": "C"
    },
    // defrost windscreen + side mirrors/rear windows + steering wheel warmer
    {
        "action": "start",
        "deviceId": "xxx",
        "hvacType": 1,
        "options": {
            "defrost": true,
            "frontWindowHeating": 0,
            "heating1": 4
        },
        "tempCode": "10H",
        "unit": "C"
    }
]
cdnninja commented 1 year ago

What I found in Canada with seats, and I assuming heating1 is that older cars only offered "Off" and "On" in app. That mapped to 0 and 1, which created the confusion we saw above as that appears to be Boolean. Later some cars were released that supported setting the seats so they released 2-8 as options. Both 0 and 2 being off which messed with our sensors as we never thought 2 was valid.

I suspect heating1 is the same. Now knowing if the newer cars accept the old values is a gamble and isn't ideal. However we never hit issues sending the older start_climate commands to newer cars, just missed out on the additional functionality.