diff --git a/custom_components/myskoda/device_tracker.py b/custom_components/myskoda/device_tracker.py index 2fda051..e2d4ce5 100644 --- a/custom_components/myskoda/device_tracker.py +++ b/custom_components/myskoda/device_tracker.py @@ -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