Skip to content

Commit

Permalink
Moving cars give an empty list of positions
Browse files Browse the repository at this point in the history
  • Loading branch information
WebSpider committed Oct 1, 2024
1 parent e460905 commit 3058cbc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions custom_components/myskoda/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ def _positions(self) -> Positions:
return positions

def _vehicle_position(self) -> Position | None:
return next(
pos
for pos in self._positions().positions
if pos.type == PositionType.VEHICLE
)
if self._positions().positions:
return next(
pos
for pos in self._positions().positions
if pos.type == PositionType.VEHICLE
)
else:
return None

@property
def source_type(self) -> SourceType: # noqa: D102
Expand Down

0 comments on commit 3058cbc

Please sign in to comment.