audiconnect / audi_connect_ha

Adds an audi connect integration to home assistant
MIT License
232 stars 96 forks source link

Trip Data Errors #254

Closed cdnninja closed 7 months ago

cdnninja commented 7 months ago

My car is reporting trip errors. In my app being a Q7 ICE it doesn't report trips. As such home assistant throws errors. I plan to dig in when I get time but this is for a single spot to show this. Applies to both long and short term trip.

2024-03-05 19:15:45.380 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Unable to obtain the vehicle shortTerm tripdata of WA1WXAF74LD005144 - {'vin': 'XXXXX', 'csid': 'XXXXXX', 'model': 'Audi Q7 Komfort 55 TFSI quattro tiptronic', 'model_year': 2020, 'model_family': '', 'title': 'Audi Q7', 'state': {'last_update_time': datetime.datetime(2024, 3, 4, 23, 52, 33, tzinfo=datetime.timezone.utc), 'carType': 'gasoline', 'engineTypeFirstEngine': 'gasoline', 'primaryEngineRange': 230, 'primaryEngineRangePercent': 28, 'hybridRange': 230}, 'fields': {'TOTAL_RANGE': 230, 'TANK_LEVEL_IN_PERCENTAGE': 28, 'UTC_TIME_AND_KILOMETER_STATUS': 70367, 'MAINTENANCE_INTERVAL_TIME_TO_INSPECTION': 474, 'MAINTENANCE_INTERVAL_DISTANCE_TO_INSPECTION': 20500, 'MAINTENANCE_INTERVAL_TIME_TO_OIL_CHANGE': 109, 'MAINTENANCE_INTERVAL_DISTANCE_TO_OIL_CHANGE': 5500, 'OIL_LEVEL_DIPSTICKS_PERCENTAGE': True, 'LIGHT_STATUS': [{'name': 'right', 'status': 'off'}, {'name': 'left', 'status': 'off'}], 'STATE_LEFT_FRONT_WINDOW': '3', 'STATE_RIGHT_FRONT_WINDOW': '3', 'STATE_LEFT_REAR_WINDOW': '3', 'STATE_RIGHT_REAR_WINDOW': '3', 'STATE_SUN_ROOF_MOTOR_COVER': '3', 'LOCK_STATE_HOOD': '0', 'OPEN_STATE_HOOD': '3', 'LOCK_STATE_LEFT_FRONT_DOOR': '0', 'OPEN_STATE_LEFT_FRONT_DOOR': '3', 'LOCK_STATE_RIGHT_FRONT_DOOR': '0', 'OPEN_STATE_RIGHT_FRONT_DOOR': '3', 'LOCK_STATE_LEFT_REAR_DOOR': '0', 'OPEN_STATE_LEFT_REAR_DOOR': '0', 'LOCK_STATE_RIGHT_REAR_DOOR': '0', 'OPEN_STATE_RIGHT_REAR_DOOR': '3', 'LOCK_STATE_TRUNK_LID': '0', 'OPEN_STATE_TRUNK_LID': '3'}}: 403, message='', url=URL('https://mal-1a.prd.ece.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/XXXX/tripdata/shortTerm?type=list&from=1970-01-01T00:00:00Z&to=2024-03-06T03:45:44Z') Traceback (most recent call last): File "/config/custom_components/audiconnect/audi_connect_account.py", line 692, in update_vehicle_tripdata td_cur, td_rst = await self._audi_service.get_tripdata(self._vehicle.vin, kind) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/audiconnect/audi_services.py", line 321, in get_tripdata data = await self._api.request( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/audiconnect/audi_api.py", line 67, in request raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 403, message='', url=URL('https://mal-1a.prd.ece.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/XXXXXXXXXX/tripdata/shortTerm?type=list&from=1970-01-01T00:00:00Z&to=2024-03-06T03:45:44Z')

mm98 commented 7 months ago

I can confirm this. I get this error for shortTerm and longTerm tripdata.


{
  "vin": "{REDACTED}",
  "csid": "{REDACTED}",
  "model": "Audi A5 Sportback advanced 40 TFSI S tronic",
  "model_year": 2021,
  "model_family": "",
  "title": "Audi A5 Sportback",
  "state": {
    "last_update_time": "datetime.datetime(2024, 3, 5, 9, 44, 4, tzinfo=datetime.timezone.utc)",
    "carType": "gasoline",
    "engineTypeFirstEngine": "gasoline",
    "primaryEngineRange": 760,
    "primaryEngineRangePercent": 82,
    "hybridRange": 760,
    "position": {
      "latitude": 0,
      "longitude": 0,
      "timestamp": "datetime.datetime(2024, 3, 5, 9, 44, 4, tzinfo=datetime.timezone.utc)",
      "parktime": "datetime.datetime(2024, 3, 5, 9, 44, 4, tzinfo=datetime.timezone.utc)"
    }
  },
  "fields": {
    "TOTAL_RANGE": 760,
    "TANK_LEVEL_IN_PERCENTAGE": 82,
    "UTC_TIME_AND_KILOMETER_STATUS": 43175,
    "MAINTENANCE_INTERVAL_TIME_TO_INSPECTION": 362,
    "MAINTENANCE_INTERVAL_DISTANCE_TO_INSPECTION": 15900,
    "MAINTENANCE_INTERVAL_TIME_TO_OIL_CHANGE": 362,
    "MAINTENANCE_INTERVAL_DISTANCE_TO_OIL_CHANGE": 15900,
    "OIL_LEVEL_DIPSTICKS_PERCENTAGE": true,
    "LIGHT_STATUS": [
      {
        "name": "right",
        "status": "off"
      },
      {
        "name": "left",
        "status": "off"
      }
    ],
    "STATE_LEFT_FRONT_WINDOW": "3",
    "STATE_RIGHT_FRONT_WINDOW": "3",
    "STATE_LEFT_REAR_WINDOW": "3",
    "STATE_RIGHT_REAR_WINDOW": "3",
    "LOCK_STATE_HOOD": "0",
    "OPEN_STATE_HOOD": "3",
    "LOCK_STATE_LEFT_FRONT_DOOR": "2",
    "OPEN_STATE_LEFT_FRONT_DOOR": "3",
    "LOCK_STATE_RIGHT_FRONT_DOOR": "2",
    "OPEN_STATE_RIGHT_FRONT_DOOR": "3",
    "LOCK_STATE_LEFT_REAR_DOOR": "2",
    "OPEN_STATE_LEFT_REAR_DOOR": "3",
    "LOCK_STATE_RIGHT_REAR_DOOR": "2",
    "OPEN_STATE_RIGHT_REAR_DOOR": "3",
    "LOCK_STATE_TRUNK_LID": "2",
    "OPEN_STATE_TRUNK_LID": "3"
  }
}
DivingUp commented 7 months ago

yes..i would suggest that i put a pr to disable this function for now until we have found a solution as developers... because i suspect that too many 403s on the service will block access for 24h again... that just gives issues here again account...

DivingUp commented 7 months ago

255 PR is done... please merge @cdnninja

cdnninja commented 7 months ago

Duplicate to #226 so closing.