Skip to content

Commit

Permalink
Add Last Captured attribute to device tracker
Browse files Browse the repository at this point in the history
Shows the approximate time the car was parked.
  • Loading branch information
DarkFox committed Sep 25, 2024
1 parent 97a8360 commit eb10d91
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions custom_components/volkswagen_we_connect_id/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,17 @@ def source_type(self):
def icon(self):
"""Return the icon."""
return "mdi:car"

@property
def extra_state_attributes(self):
"""Return timestamp of when the data was captured."""
try:
return {
"last_captured": get_object_value(
self.data.domains["parking"][
"parkingPosition"
].carCapturedTimestamp.value
)
}
except KeyError:
return None

0 comments on commit eb10d91

Please sign in to comment.