Skip to content

Commit

Permalink
Add initial VW ID support
Browse files Browse the repository at this point in the history
Tested with ID3 (Thanks to @OZ1SEJ for credentials)
  • Loading branch information
stickpin committed Jan 19, 2024
1 parent 2256216 commit efc1300
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions volkswagencarnet/vw_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ def last_connected(self) -> str:
last_connected_time_path = f"{Services.MEASUREMENTS}.odometerStatus.value.carCapturedTimestamp"
if is_valid_path(self.attrs, last_connected_time_path):
last_connected_time_utc = find_path(self.attrs, last_connected_time_path)
if type(last_connected_time_utc) == str:
last_connected_time_utc = datetime.strptime(last_connected_time_utc, '%Y-%m-%dT%H:%M:%S.%fZ').replace(microsecond=0)
last_connected_time = last_connected_time_utc.replace(tzinfo=timezone.utc).astimezone(tz=None)
return last_connected_time.strftime("%Y-%m-%d %H:%M:%S")
return last_connected_time
Expand Down Expand Up @@ -679,7 +681,7 @@ def is_service_inspection_distance_supported(self) -> bool:
:return:
"""
return is_valid_path(self.attrs, "vehicleHealthInspection.maintenanceStatus.value.carCapturedTimestamp")
return is_valid_path(self.attrs, "vehicleHealthInspection.maintenanceStatus.value.inspectionDue_km")

@property
def oil_inspection(self):
Expand Down Expand Up @@ -2475,8 +2477,10 @@ def api_trips_status_last_updated(self) -> datetime:

@property
def is_api_trips_status_supported(self):
"""Trips API status is always supported."""
return True
"""Check if Trips API status is supported."""
if self._services.get(Services.TRIP_STATISTICS, {}).get("active", False):
return True
return False

@property
def api_selectivestatus_status(self) -> bool:
Expand Down Expand Up @@ -2505,8 +2509,10 @@ def api_parkingposition_status_last_updated(self) -> datetime:

@property
def is_api_parkingposition_status_supported(self):
"""Parkingposition API status is always supported."""
return True
"""Check if Parkingposition API status is supported."""
if self._services.get(Services.PARKING_POSITION, {}).get("active", False):
return True
return False

@property
def api_token_status(self) -> bool:
Expand Down

0 comments on commit efc1300

Please sign in to comment.