Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set_climatisation #450 #492

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

fix: set_climatisation #450 #492

wants to merge 3 commits into from

Conversation

Kolbi
Copy link
Contributor

@Kolbi Kolbi commented Nov 12, 2024

@Kolbi Kolbi changed the title set_climatisation #450 fix: set_climatisation #450 Nov 12, 2024
@pergolafabio
Copy link

i was testing the start_climate_control with my Q4
do you know why there is a calculation for the temp_c ?
i inspected the json, and it was sending a temp like 25xx , resulting in a bad request...
maybe this was needed for the old API? i commented it out for me, and below works
again , hardcoded, proably doesnt work for other regions for users with Q4

      async def start_climate_control(self, vin: str, temp_f: int, temp_c: int, glass_heating: bool, seat_fl: bool, seat_fr: bool, seat_rl: bool, seat_rr: bool):

        target_temperature = None
        if temp_f is not None:
            target_temperature = int(((temp_f - 32) * (5 / 9)) * 10 + 2731)
        elif temp_c is not None:
            #target_temperature = int(temp_c * 10 + 2731)
            target_temperature = int(temp_c)

        # Default Temp
        target_temperature = target_temperature or 23
        data = { 
            "targetTemperature" : target_temperature, 
            "targetTemperatureUnit": "celsius", 
            "climatisationWithoutExternalPower": True, 
            "climatizationAtUnlock": False, 
            "windowHeatingEnabled": glass_heating, 
            "zoneFrontLeftEnabled": seat_fl, 
            "zoneFrontRightEnabled": seat_fr, 
            "zoneRearLeftEnabled": False, 
            "zoneRearRightEnabled": False 
        }
        data = json.dumps(data)
        headers = {
            "Authorization": "Bearer " + self._bearer_token_json["access_token"]
        }
        res = await self._api.request(
            "POST",
            "https://emea.bff.cariad.digital/vehicle/v1/vehicles/{vin}/climatisation/start".format(
                vin=vin.upper(),
            ),
            headers=headers,
            data=data,
        )

@coreywillwhat
Copy link
Contributor

Q4 data structure is different than all the older vehicles, and as you know, the EU is different than NA region endpoints.

I dont know if the Q4 data structure is going to be the new standard or if only for electric vehicles or some other subset of vehicles. A while back i was working on some logic to use the correct logic based on the vehicle, or even having the user select an option under integration options.

Your Q4 uses Celsius in the new data structure. Legacy data structure used 'deca-kelvin'. Why they used that in the past, i have no idea.

My time is so limited these days, I'm really not sure I'll have time to work on this until the new year, unfortunately.
I could probably get it working pretty quickly for NA/Legacy Data structure, but finding even an afternoon to work on it is hard at the moment.

Making it work universally and smart enough to do it automatically is the real challenge. I was also working on integration options that the user would select to try different data structures or endpoints. Ultimately that may be the best path forward, but again, last time i worked on it, they changed everything again so I lost the progress.

Happy to answer any questions you have if any others.

@pergolafabio
Copy link

ok, that makes sence with the temparature
but take your time, no hurry, i have a working solution now, i can turn on/off climate not from HA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants