audiconnect / audi_connect_ha

Adds an audi connect integration to home assistant
MIT License
243 stars 100 forks source link

fix: Climatisation State for 2024 Q4 #452

Closed coreywillwhat closed 4 months ago

coreywillwhat commented 4 months ago

Add mapping for climatisation state for 2024 Q4

coreywillwhat commented 4 months ago

@pergolafabio please test, this should pull the climate state for your vehicle.

pergolafabio commented 4 months ago

Tested and working it added 1 extra entity now!

image

pergolafabio commented 4 months ago

Can you also add the timer left? the timer that counts down from 30 to 0

pergolafabio commented 4 months ago

I see the timer left in this request url: https://emea.bff.cariad.digital/vehicle/v1/vehicles/XXX/selectivestatus?jobs=climatisation

=> remainingClimatisationTime_min

Maybe also the target temp is interesting?

=> targetTemperature

Body:

{
  "climatisation": {
    "climatisationSettings": {
      "value": {
        "carCapturedTimestamp": "2024-07-24T18:50:05Z",
        "targetTemperature_C": 21,
        "targetTemperature_F": 70,
        "unitInCar": "celsius",
        "climatizationAtUnlock": false,
        "windowHeatingEnabled": false,
        "zoneFrontLeftEnabled": false,
        "zoneFrontRightEnabled": false
      }
    },
    "climatisationStatus": {
      "value": {
        "carCapturedTimestamp": "2024-07-24T18:50:09Z",
        "remainingClimatisationTime_min": 30,
        "climatisationState": "cooling"
      },
      "requests": [
        {
          "status": "successful",
          "operation": "start",
          "body": {
            "climatizationAtUnlock": false,
            "zoneFrontRightEnabled": false,
            "zoneRearLeftEnabled": false,
            "zoneRearRightEnabled": false,
            "targetTemperature": 21,
            "targetTemperatureUnit": "celsius",
            "climatisationWithoutExternalPower": true,
            "windowHeatingEnabled": false,
            "zoneFrontLeftEnabled": false
          },
          "requestId": "47c44560-02ff-47ef-85a5-6772b7afc580",
          "vcfRequestId": "d31e96f4-3aa0-4839-878c-416deefc457d"
        }
      ]
    },
    "windowHeatingStatus": {
      "value": {
        "carCapturedTimestamp": "2024-07-24T18:50:01Z",
        "windowHeatingStatus": [
          {
            "windowLocation": "front",
            "windowHeatingState": "off"
          },
          {
            "windowLocation": "rear",
            "windowHeatingState": "off"
          }
        ]
      }
    }
  }
}
coreywillwhat commented 4 months ago

I've added Remaining Climatisation Time please retest @pergolafabio . As for target temp, it will take a little more time as I'll have to modify a few other files since the entity doesn't exist yet.

Ideally, entities like remaining time, and target temp, would be attributes to the Climatisation State entity, but that would take a good amount more work as well.

Please submit a feature request for Target Temp and any others so myself or someone else can get to it when they have more time.

pergolafabio commented 4 months ago

ok, the remainingClimatisationTime is also working! :-)

the target temp is for another time then :-)

pergolafabio commented 4 months ago

Just trying to understand, you said :

As for target temp, it will take a little more time as I'll have to modify a few other files since the entity doesn't exist yet.

But you added the "remainingClimatisationTime_min" also with a few lines of code? that entity didnt exist either?

I also see the target temp in this request:

https://emea.bff.cariad.digital/vehicle/v1/vehicles/XXXX/selectivestatus?jobs=charging%2CchargingTimers%2CchargingProfiles%2CdepartureTimers%2Cclimatisation%2CclimatisationTimers%2CdepartureTimers%2Cmeasurements%2Cmeasurements%2CoilLevel%2Caccess%2CvehicleLights%2CvehicleHealthWarnings

{
......
.....
  "climatisation": {
    "climatisationSettings": {
      "value": {
        "carCapturedTimestamp": "2024-07-24T19:01:58Z",
        "targetTemperature_C": 21,
        "targetTemperature_F": 70,
        "unitInCar": "celsius",
        "climatizationAtUnlock": false,
        "windowHeatingEnabled": false,
        "zoneFrontLeftEnabled": false,
        "zoneFrontRightEnabled": false
      }
    },
    "climatisationStatus": {
      "value": {
        "carCapturedTimestamp": "2024-07-24T19:02:22Z",
        "remainingClimatisationTime_min": 0,
        "climatisationState": "off"
      },
      "requests": [
        {
          "status": "successful",
          "operation": "start",
          "body": {
            "climatisationWithoutExternalPower": true,
            "climatizationAtUnlock": false,
            "zoneRearRightEnabled": false,
            "targetTemperature": 21,
            "targetTemperatureUnit": "celsius",
            "zoneFrontRightEnabled": false,
            "zoneRearLeftEnabled": false,
            "windowHeatingEnabled": false,
            "zoneFrontLeftEnabled": false
          },
          "requestId": "7d6b8b21-4b01-4a14-b599-438038fb3bec",
          "vcfRequestId": "c49f2344-05b7-4fd7-adb8-6623d11f4f7c"
        },
        {
          "status": "timeout",
          "operation": "stop",
          "requestId": "1a0bffcb-fb63-4f99-b499-56b35083e80f",
          "vcfRequestId": "e74f83bf-544e-4500-a7e5-3aeefb514dd8",
          "group": 9,
          "info": "Your vehicle is not reachable at the moment. Please try again later."
        }
      ]
......
.....
}
coreywillwhat commented 4 months ago

No worries!

To create new entities requires telling the integration where to look, how to interpret the data, and providing all the metadata for the new entities. That requires modification and code in 3 different files.

The Climatisation State and Remaining Climatisation Time entities already existed for other vehicles, so the data interpretation and metadata was already there, i just had to tell it where to look for Climate state and Remaining Time for your vehicle.

coreywillwhat commented 4 months ago

Here is the full list of existing sensors and diagnostics, if you see any others that need mapping to your vehicle, please let us know in a new issue so we can track development.

image image

pergolafabio commented 4 months ago

ah ok, makes sense i'm comparing your entities in your screenshot to mine now ... for sensors: you have also longterm.short trip trip data sensoers, not sure what it is?

for diagnostics, you have a lot more, but its because you have a hjybrid :-)

as for the door/window/trunk sensors, i have them, but the states doesnt work... they are always locked... But also in the myAudi app, they dont change... probably the app needs an update for my new car :-)

coreywillwhat commented 4 months ago

ah ok, makes sense i'm comparing your entities in your screenshot to mine now ... for sensors: you have also longterm.short trip trip data sensoers, not sure what it is?

for diagnostics, you have a lot more, but its because you have a hjybrid :-)

as for the door/window/trunk sensors, i have them, but the states doesnt work... they are always locked... But also in the myAudi app, they dont change... probably the app needs an update for my new car :-)

Trip Data is unavailable for your vehicle at this time according to the logs:

2024-07-24 19:07:15.608 DEBUG (MainThread) [custom_components.audiconnect.audi_connect_account] Trip data support is disabled for VIN: *************6552. Exiting update process.
2024-07-24 19:07:15.608 DEBUG (MainThread) [custom_components.audiconnect.audi_connect_account] Trip data support is disabled for VIN: *************6552. Exiting update process.

as you're suggesting, the Audi App may need to be updated, or we may need to find more services for newer vehicles. If you find anything with HTTPTool let us know in a feature request.

pergolafabio commented 4 months ago

Will do, will check next time when the app gets updated...

Are you also going to work on the climate start ?

pergolafabio commented 4 months ago

And thnx! Much appreciated 👍

Kolbi commented 4 months ago

I merged this.

coreywillwhat commented 4 months ago

Will do, will check next time when the app gets updated...

Are you also going to work on the climate start ?

I will be working on it when I have time. I'm desperately missing it with the summer heat.