Skip to content

Commit

Permalink
Moving cars give an empty list of positions (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
WebSpider authored Oct 7, 2024
1 parent 231a725 commit 709354d
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 709354d

Please sign in to comment.