Skip to content

Commit

Permalink
fix parking time bug when moving
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverrahner committed Dec 5, 2023
1 parent 741088e commit 3517ebc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions volkswagencarnet/vw_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,9 +1091,13 @@ def is_vehicle_moving_supported(self) -> bool:
@property
def parking_time(self) -> str:
"""Return timestamp of last parking time."""
park_time_utc: datetime = find_path(self.attrs, "parkingposition.carCapturedTimestamp")
park_time = park_time_utc.replace(tzinfo=timezone.utc).astimezone(tz=None)
return park_time.strftime("%Y-%m-%d %H:%M:%S")
parking_time_path = "parkingposition.carCapturedTimestamp"
if is_valid_path(self.attrs, parking_time_path):
park_time_utc: datetime = find_path(self.attrs, parking_time_path)
park_time = park_time_utc.replace(tzinfo=timezone.utc).astimezone(tz=None)
return park_time.strftime("%Y-%m-%d %H:%M:%S")

return None

@property
def parking_time_last_updated(self) -> datetime:
Expand Down

0 comments on commit 3517ebc

Please sign in to comment.