Skip to content

Commit

Permalink
Fix line filter
Browse files Browse the repository at this point in the history
  • Loading branch information
warrior25 committed Oct 9, 2023
1 parent c573e00 commit a1bae5d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions custom_components/Nysse/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,14 @@ def remove_unwanted_data(self, departures, journeys):
removed_journey_count = 0
removed_departures_count = 0

# Remove unwanted journeys based on departure time and stop code
# Remove unwanted journeys based on departure time, stop code and line number
for journey in journeys[:]:
if journey["departureTime"] < self._last_update_time + timedelta(
minutes=self.timelimit
) or (journey["stopCode"] != self.stop_code):
if (
journey["departureTime"]
< self._last_update_time + timedelta(minutes=self.timelimit)
or (journey["stopCode"] != self.stop_code)
or (journey["line"] not in self.lines)
):
journeys.remove(journey)
removed_journey_count += 1

Expand Down

0 comments on commit a1bae5d

Please sign in to comment.