From 9dc26652ee3b2d5b26d609bd152568be29e5bb03 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 25 Jun 2024 20:08:04 +0200 Subject: [PATCH] Fix gtfs typing (#120451) --- homeassistant/components/gtfs/sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/gtfs/sensor.py b/homeassistant/components/gtfs/sensor.py index a0a0f0ebc0e..fbc65050704 100644 --- a/homeassistant/components/gtfs/sensor.py +++ b/homeassistant/components/gtfs/sensor.py @@ -270,7 +270,7 @@ def get_next_departure( schedule: Any, start_station_id: Any, end_station_id: Any, - offset: cv.time_period, + offset: datetime.timedelta, include_tomorrow: bool = False, ) -> dict: """Get the next departure for the given schedule.""" @@ -405,7 +405,7 @@ def get_next_departure( item = {} for key in sorted(timetable.keys()): - if dt_util.parse_datetime(key) > now: + if (value := dt_util.parse_datetime(key)) is not None and value > now: item = timetable[key] _LOGGER.debug( "Departure found for station %s @ %s -> %s", start_station_id, key, item