audiconnect / audi_connect_ha

Adds an audi connect integration to home assistant
MIT License
227 stars 98 forks source link

fix: update_vehicle_statusreport #372

Closed coreywillwhat closed 5 months ago

coreywillwhat commented 5 months ago

Certain vehicles are reporting different timestamp formats for different sensors. The impacts might be the vehicle status report not updating. This could be the reason the Q4 and e-tron aren't working. This PR attempts to parse the timestamps.

error in log:

Traceback (most recent call last):
  File "/config/custom_components/audiconnect/audi_connect_account.py", line 495, in update_vehicle_statusreport
    self._vehicle.state["last_update_time"] = max(
                                              ^^^^
TypeError: '>' not supported between instances of 'str' and 'datetime.datetime'

One user's log of LIGHT_STATUS timestamp from #207 :

2024-04-12 06:05:50.053 DEBUG (MainThread) [custom_components.audiconnect.audi_models] Timestamp retrieved for 'LIGHT_STATUS': 2024-04-12T05:56:13.025Z

My log for the same sensor:

2024-04-12 09:54:30.871 DEBUG (MainThread) [custom_components.audiconnect.audi_models] Timestamp retrieved for 'LIGHT_STATUS': 2024-04-12 02:30:40+00:00