vingerha / gtfs2

Support GTFS in Home Assistant GUI-only
https://github.com/vingerha/gtfs2
MIT License
79 stars 7 forks source link

When "including tomorrow", state showing next departure is wrongly set to tomorrow (correct time, but not date) #23

Closed Friedrieck closed 7 months ago

Friedrieck commented 7 months ago

Describe the bug If I set up a sensor and "include tomorrow", it shows the next departure the day after as state, even if there are still many the same day. Only the day is wrong, the hour is correct. The data in the attributes (next_...) seem however correct. If I set up the same sensor without including tomorrow, it's all correct (but at the end of the day, I don't have the next departure the day after then...)

Steps/data to reproduce the behavior, e.g.

Release used gtfs2 release 0.3.6, HA type: HAOS

Additional From dev tools, faulty one (with include tomorrow):

State: 2024-02-27T15:13:00+00:00

arrival: 2024-02-27T15:37:00+00:00
day: today
first: false
offset: 10
agency_agency_id: B
agency_agency_name: TEC Brabant Wallon
agency_agency_url: http://www.letec.be
agency_agency_timezone: Europe/Brussels
agency_agency_lang: fr
agency_agency_phone: +32 10 23 53 53
agency_agency_fare_url: None
agency_agency_email: None
origin_station_stop_id: Bottbru2
origin_station_stop_code: None
origin_station_stop_name: OTTIGNIES Rue de Mont-Saint-Guibert
origin_station_stop_desc: None
origin_station_stop_lat: 50.657737
origin_station_stop_lon: 4.604118
origin_station_zone_id: 6160
origin_station_stop_url: None
origin_station_location_type: 0
origin_station_parent_station: None
origin_station_stop_timezone: None
origin_station_wheelchair_boarding: None
origin_station_platform_code: None
origin_station_location_type_name: Station
origin_station_wheelchair_boarding_available: unknown
destination_station_stop_id: Bottgar4
destination_station_stop_code: None
destination_station_stop_name: OTTIGNIES Gare - Quai 4
destination_station_stop_desc: None
destination_station_stop_lat: 50.673016
destination_station_stop_lon: 4.569715
destination_station_zone_id: 6140
destination_station_stop_url: None
destination_station_location_type: 0
destination_station_parent_station: None
destination_station_stop_timezone: None
destination_station_wheelchair_boarding: None
destination_station_platform_code: None
destination_station_location_type_name: Station
destination_station_wheelchair_boarding_available: unknown
route_route_id: B0031-18821
route_agency_id: B
route_route_short_name: 31
route_route_long_name: Ottignies - Louvain-la-Neuve - Bruyères
route_route_desc: None
route_route_type: 3
route_route_url: None
route_route_color: None
route_route_text_color: None
route_type_name: Bus
trip_route_id: B0031-18821
trip_service_id: B_2024-BW_A_P3-Sem-Cong-05
trip_trip_id: 41360539-B_2024-BW_A_P3-Sem-Cong-05
trip_trip_headsign: None
trip_trip_short_name: 24
trip_direction_id: 1
trip_block_id: 7816769
trip_shape_id: B00310026
trip_wheelchair_accessible: None
trip_bikes_allowed: None
trip_bikes_allowed_state: unknown
trip_wheelchair_access_available: unknown
origin_stop_arrival_time: 2024-02-27T15:13:00+00:00
origin_stop_departure_time: 2024-02-27T15:13:00+00:00
origin_stop_drop_off_type: 0
origin_stop_pickup_type: 0
origin_stop_sequence: 4
origin_stop_drop_off_type_state: Regular
origin_stop_pickup_type_state: Regular
origin_stop_timepoint_exact: true
destination_stop_arrival_time: 2024-02-27T15:37:00+00:00
destination_stop_departure_time: 2024-02-27T15:37:00+00:00
destination_stop_drop_off_type: 0
destination_stop_pickup_type: 0
destination_stop_sequence: 19
destination_stop_drop_off_type_state: Regular
destination_stop_pickup_type_state: Regular
destination_stop_timepoint_exact: true
next_departures: 2024-02-26T15:13:00+00:00, 2024-02-26T16:13:00+00:00, 2024-02-26T17:13:00+00:00, 2024-02-26T18:13:00+00:00, 2024-02-26T19:13:00+00:00, 2024-02-27T05:13:00+00:00, 2024-02-27T06:13:00+00:00, 2024-02-27T06:30:00+00:00, 2024-02-27T07:13:00+00:00, 2024-02-27T08:13:00+00:00
next_departures_lines: 2024-02-26T15:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-26T16:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-26T17:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-26T18:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-26T19:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-27T05:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-27T06:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-27T06:30:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-27T07:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-27T08:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères)
next_departures_headsign: 2024-02-26T15:13:00+00:00 (None), 2024-02-26T16:13:00+00:00 (None), 2024-02-26T17:13:00+00:00 (None), 2024-02-26T18:13:00+00:00 (None), 2024-02-26T19:13:00+00:00 (None), 2024-02-27T05:13:00+00:00 (None), 2024-02-27T06:13:00+00:00 (None), 2024-02-27T06:30:00+00:00 (None), 2024-02-27T07:13:00+00:00 (None), 2024-02-27T08:13:00+00:00 (None)
gtfs_updated_at: 2024-02-26T14:33:13.365610+00:00
origin_stop_alert: no info
destination_stop_alert: no info
info_realtime: No realtime information
last: false
attribution: TEC Brabant Wallon
device_class: timestamp
icon: mdi:bus
friendly_name: 31 MS

Correct one:

State: 2024-02-26T15:13:00+00:00

offset: 10
agency_agency_id: B
agency_agency_name: TEC Brabant Wallon
agency_agency_url: http://www.letec.be
agency_agency_timezone: Europe/Brussels
agency_agency_lang: fr
agency_agency_phone: +32 10 23 53 53
agency_agency_fare_url: None
agency_agency_email: None
origin_station_stop_id: Bottbru2
origin_station_stop_code: None
origin_station_stop_name: OTTIGNIES Rue de Mont-Saint-Guibert
origin_station_stop_desc: None
origin_station_stop_lat: 50.657737
origin_station_stop_lon: 4.604118
origin_station_zone_id: 6160
origin_station_stop_url: None
origin_station_location_type: 0
origin_station_parent_station: None
origin_station_stop_timezone: None
origin_station_wheelchair_boarding: None
origin_station_platform_code: None
origin_station_location_type_name: Station
origin_station_wheelchair_boarding_available: unknown
destination_station_stop_id: Bottgar4
destination_station_stop_code: None
destination_station_stop_name: OTTIGNIES Gare - Quai 4
destination_station_stop_desc: None
destination_station_stop_lat: 50.673016
destination_station_stop_lon: 4.569715
destination_station_zone_id: 6140
destination_station_stop_url: None
destination_station_location_type: 0
destination_station_parent_station: None
destination_station_stop_timezone: None
destination_station_wheelchair_boarding: None
destination_station_platform_code: None
destination_station_location_type_name: Station
destination_station_wheelchair_boarding_available: unknown
route_route_id: B0031-18821
route_agency_id: B
route_route_short_name: 31
route_route_long_name: Ottignies - Louvain-la-Neuve - Bruyères
route_route_desc: None
route_route_type: 3
route_route_url: None
route_route_color: None
route_route_text_color: None
route_type_name: Bus
trip_route_id: B0031-18821
trip_service_id: B_2024-BW_A_P3-Sem-Cong-05
trip_trip_id: 41360539-B_2024-BW_A_P3-Sem-Cong-05
trip_trip_headsign: None
trip_trip_short_name: 24
trip_direction_id: 1
trip_block_id: 7816769
trip_shape_id: B00310026
trip_wheelchair_accessible: None
trip_bikes_allowed: None
trip_bikes_allowed_state: unknown
trip_wheelchair_access_available: unknown
next_departures: 2024-02-26T15:13:00+00:00, 2024-02-26T16:13:00+00:00, 2024-02-26T17:13:00+00:00, 2024-02-26T18:13:00+00:00, 2024-02-26T19:13:00+00:00
next_departures_lines: 2024-02-26T15:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-26T16:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-26T17:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-26T18:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères), 2024-02-26T19:13:00+00:00 (31/Ottignies - Louvain-la-Neuve - Bruyères)
next_departures_headsign: 2024-02-26T15:13:00+00:00 (None), 2024-02-26T16:13:00+00:00 (None), 2024-02-26T17:13:00+00:00 (None), 2024-02-26T18:13:00+00:00 (None), 2024-02-26T19:13:00+00:00 (None)
gtfs_updated_at: 2024-02-26T14:35:53.658373+00:00
info_realtime: No realtime information
origin_stop_alert: no info
destination_stop_alert: no info
arrival: 2024-02-26T15:37:00+00:00
day: today
first: false
last: false
origin_stop_arrival_time: 2024-02-26T15:13:00+00:00
origin_stop_departure_time: 2024-02-26T15:13:00+00:00
origin_stop_drop_off_type: 0
origin_stop_pickup_type: 0
origin_stop_sequence: 4
origin_stop_drop_off_type_state: Regular
origin_stop_pickup_type_state: Regular
origin_stop_timepoint_exact: true
destination_stop_arrival_time: 2024-02-26T15:37:00+00:00
destination_stop_departure_time: 2024-02-26T15:37:00+00:00
destination_stop_drop_off_type: 0
destination_stop_pickup_type: 0
destination_stop_sequence: 19
destination_stop_drop_off_type_state: Regular
destination_stop_pickup_type_state: Regular
destination_stop_timepoint_exact: true
attribution: TEC Brabant Wallon
device_class: timestamp
icon: mdi:bus
friendly_name: Ligne 31 - rue de MSG
vingerha commented 7 months ago

interesting...I did not look at this for a long time I must admit... :) ...

vingerha commented 7 months ago

fixed in 0.3.7

Friedrieck commented 7 months ago

It seems fixed, thanks for the swift reaction! I'll come back after today's last bus if the next one of tomorrow does not show as expected (but from the attributes, it already seems OK). Thanks again for the quick and effective fix!