diff --git a/homeassistant/components/sensor/gtfs.py b/homeassistant/components/sensor/gtfs.py index 2355d03d34a..ad954899e6d 100644 --- a/homeassistant/components/sensor/gtfs.py +++ b/homeassistant/components/sensor/gtfs.py @@ -68,6 +68,7 @@ def get_next_departure(sched, start_station_id, end_station_id): AND time(origin_stop_time.departure_time) > time(:now_str) AND start_station.stop_id = :origin_station_id AND end_station.stop_id = :end_station_id + AND origin_stop_time.stop_sequence < destination_stop_time.stop_sequence ORDER BY origin_stop_time.departure_time LIMIT 1; """.format(day_name=day_name)) result = sched.engine.execute(sql_query, now_str=now_str,