Open Kolbi opened 2 weeks ago
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,
)
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.
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
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 ...
After some quick and rough testing can confirm this to be working on A3 TFSIe in EU. Will need to be fine tuned if eg. the status needs to be queried. (See #450)
Extended the hotfix to enable climatisation to be interrupted as well via Execute Vehicle Action. Not pretty as made at 5 AM but it works nevertheless.
audi_services.py
async def set_climatisation(self, vin: str, start: bool):
if start:
await self.start_climate_control(vin, None, 22, False, False, False, False, False)
else:
data = {"": ""}
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/stop".format(
vin=vin.upper(),
),
headers=headers,
data=data,
)
Correct, the status is indeed missing, I removed that part , it needs to be included as well, if the status is successful, it wil probably update the climate sensor as well? Now we need to wait for the next 15 min poll interval to actually see if the climate is turned on?
Correct, the status is indeed missing, I removed that part , it needs to be included as well, if the status is successful, it wil probably update the climate sensor as well? Now we need to wait for the next 15 min poll interval to actually see if the climate is turned on?
Yes, I believe that can be and should be implemented directly via a request to https://emea.bff.cariad.digital/vehicle/v1/vehicles/{VIN}/pendingrequests
.
However, I don't see it as something really urgent as the action can be assumed successful in most cases.
Will need to be addressed when fixing the API calls.
set_climatisation #450
https://github.com/audiconnect/audi_connect_ha/issues/450#issuecomment-2468995526