Skip to content

Commit

Permalink
Fix unavailable device tracker causing exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
WebSpider authored and Prior99 committed Sep 21, 2024
1 parent 9e54d59 commit 813470f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions custom_components/myskoda/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ def source_type(self) -> SourceType: # noqa: D102

@property
def latitude(self) -> float | None: # noqa: D102
return self._positions().positions[0].gps_coordinates.latitude
if len(self._positions().positions) > 0:
return self._positions().positions[0].gps_coordinates.latitude
else:
return None

@property
def longitude(self) -> float | None: # noqa: D102
return self._positions().positions[0].gps_coordinates.longitude
if len(self._positions().positions) > 0:
return self._positions().positions[0].gps_coordinates.longitude
else:
return None

def required_capabilities(self) -> list[CapabilityId]:
return [CapabilityId.PARKING_POSITION]

0 comments on commit 813470f

Please sign in to comment.