audiconnect / audi_connect_ha

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

Lots of warnings for `shortTerm` and `longTerm` since 1.6 (regression?) #387

Closed mm98 closed 6 months ago

mm98 commented 6 months ago

Describe the bug

Do we have a regression of #254? I've started seeing lots of calls and warnings on shortTerm and longTerm since upgrading to v1.6, which returns 403 (forbidden)

Logger: custom_components.audiconnect.audi_connect_account
Source: custom_components/audiconnect/audi_connect_account.py:868
integration: Audi Connect (documentation, issues)
First occurred: 13:04:37 (32 occurrences)
Last logged: 16:34:38

Unable to obtain the vehicle longTerm tripdata of REDACTED - {'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, 4, 16, 3, 52, 30, tzinfo=datetime.timezone.utc), 'carType': 'gasoline', 'engineTypeFirstEngine': 'gasoline', 'primaryEngineRange': 240, 'primaryEngineRangePercent': 28, 'hybridRange': 240, 'position': {'latitude': REDACTED, 'longitude': REDACTED, 'timestamp': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc), 'parktime': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc)}}, 'fields': {'TOTAL_RANGE': 240, 'TANK_LEVEL_IN_PERCENTAGE': 28, 'UTC_TIME_AND_KILOMETER_STATUS': 45240, 'MAINTENANCE_INTERVAL_TIME_TO_INSPECTION': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_INSPECTION': 13800, 'MAINTENANCE_INTERVAL_TIME_TO_OIL_CHANGE': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_OIL_CHANGE': 13800, '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'}}: 403, message='', url=URL('https://mal-3a.prd.eu.dp.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/REDACTED/tripdata/longTerm?type=list&from=1970-01-01T00:00:00Z&to=2024-04-16T15:34:42Z')
Unable to obtain the vehicle shortTerm tripdata of REDACTED - {'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, 4, 16, 3, 52, 30, tzinfo=datetime.timezone.utc), 'carType': 'gasoline', 'engineTypeFirstEngine': 'gasoline', 'primaryEngineRange': 240, 'primaryEngineRangePercent': 28, 'hybridRange': 240, 'position': {'latitude': REDACTED, 'longitude': REDACTED, 'timestamp': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc), 'parktime': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc)}}, 'fields': {'TOTAL_RANGE': 240, 'TANK_LEVEL_IN_PERCENTAGE': 28, 'UTC_TIME_AND_KILOMETER_STATUS': 45240, 'MAINTENANCE_INTERVAL_TIME_TO_INSPECTION': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_INSPECTION': 13800, 'MAINTENANCE_INTERVAL_TIME_TO_OIL_CHANGE': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_OIL_CHANGE': 13800, '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'}}: 403, message='', url=URL('https://mal-3a.prd.eu.dp.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/REDACTED/tripdata/shortTerm?type=list&from=1970-01-01T00:00:00Z&to=2024-04-16T15:49:36Z')
Unable to obtain the vehicle longTerm tripdata of REDACTED - {'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, 4, 16, 3, 52, 30, tzinfo=datetime.timezone.utc), 'carType': 'gasoline', 'engineTypeFirstEngine': 'gasoline', 'primaryEngineRange': 240, 'primaryEngineRangePercent': 28, 'hybridRange': 240, 'position': {'latitude': REDACTED, 'longitude': REDACTED, 'timestamp': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc), 'parktime': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc)}}, 'fields': {'TOTAL_RANGE': 240, 'TANK_LEVEL_IN_PERCENTAGE': 28, 'UTC_TIME_AND_KILOMETER_STATUS': 45240, 'MAINTENANCE_INTERVAL_TIME_TO_INSPECTION': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_INSPECTION': 13800, 'MAINTENANCE_INTERVAL_TIME_TO_OIL_CHANGE': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_OIL_CHANGE': 13800, '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'}}: 403, message='', url=URL('https://mal-3a.prd.eu.dp.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/REDACTED/tripdata/longTerm?type=list&from=1970-01-01T00:00:00Z&to=2024-04-16T15:49:37Z')
Unable to obtain the vehicle shortTerm tripdata of REDACTED - {'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, 4, 16, 3, 52, 30, tzinfo=datetime.timezone.utc), 'carType': 'gasoline', 'engineTypeFirstEngine': 'gasoline', 'primaryEngineRange': 240, 'primaryEngineRangePercent': 28, 'hybridRange': 240, 'position': {'latitude': REDACTED, 'longitude': REDACTED, 'timestamp': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc), 'parktime': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc)}}, 'fields': {'TOTAL_RANGE': 240, 'TANK_LEVEL_IN_PERCENTAGE': 28, 'UTC_TIME_AND_KILOMETER_STATUS': 45240, 'MAINTENANCE_INTERVAL_TIME_TO_INSPECTION': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_INSPECTION': 13800, 'MAINTENANCE_INTERVAL_TIME_TO_OIL_CHANGE': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_OIL_CHANGE': 13800, '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'}}: 403, message='', url=URL('https://mal-3a.prd.eu.dp.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/REDACTED/tripdata/shortTerm?type=list&from=1970-01-01T00:00:00Z&to=2024-04-16T16:04:38Z')
Unable to obtain the vehicle longTerm tripdata of REDACTED - {'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, 4, 16, 3, 52, 30, tzinfo=datetime.timezone.utc), 'carType': 'gasoline', 'engineTypeFirstEngine': 'gasoline', 'primaryEngineRange': 240, 'primaryEngineRangePercent': 28, 'hybridRange': 240, 'position': {'latitude': REDACTED, 'longitude': REDACTED, 'timestamp': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc), 'parktime': datetime.datetime(2024, 4, 16, 3, 50, 20, tzinfo=datetime.timezone.utc)}}, 'fields': {'TOTAL_RANGE': 240, 'TANK_LEVEL_IN_PERCENTAGE': 28, 'UTC_TIME_AND_KILOMETER_STATUS': 45240, 'MAINTENANCE_INTERVAL_TIME_TO_INSPECTION': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_INSPECTION': 13800, 'MAINTENANCE_INTERVAL_TIME_TO_OIL_CHANGE': 320, 'MAINTENANCE_INTERVAL_DISTANCE_TO_OIL_CHANGE': 13800, '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'}}: 403, message='', url=URL('https://mal-3a.prd.eu.dp.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/REDACTED/tripdata/longTerm?type=list&from=1970-01-01T00:00:00Z&to=2024-04-16T16:04:38Z')
Traceback (most recent call last):
  File "/config/custom_components/audiconnect/audi_connect_account.py", line 868, in update_vehicle_tripdata
    td_cur, td_rst = await self._audi_service.get_tripdata(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/audiconnect/audi_services.py", line 324, 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-3a.prd.eu.dp.vwg-connect.com/api/bs/tripstatistics/v1/vehicles/REDACTED/tripdata/shortTerm?type=list&from=1970-01-01T00:00:00Z&to=2024-04-16T12:34:37Z')

To Reproduce None ...

Expected behavior None ...

Screenshots None ...

Logfile None ...

coreywillwhat commented 6 months ago

Thanks @mm98 . Sorry about that. I think I know the issue/solution. We'll have to check once then disable the scan for this data afterwards.

Suggest you downgrade to previous version to avoid overpolling API forbidden, until I can get to this, hopefully in a couple hours.

Other solution is comment a few lines of code out.

coreywillwhat commented 6 months ago

https://github.com/audiconnect/audi_connect_ha/commit/30c4cfb1f0352f557899ba96f69d3925b500e183 see that commit to show which lines to comment out if you're comfortable. Otherwise, suggest downgrading until we can try a fix.

coreywillwhat commented 6 months ago

388 drafted

mm98 commented 6 months ago

Thanks @mm98 . Sorry about that.

Absolutely no need to say sorry 🙏🏻 I just report what I see 😊 I'm a dev myself. So I know how it can be sometimes. You guys do a great job maintaining this 👌

coreywillwhat commented 6 months ago

well we appreciate it! hard to catch everything without trying every vehicle :)