Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing trips after midnight #36

Closed
Edluund opened this issue Mar 5, 2024 · 5 comments
Closed

Missing trips after midnight #36

Edluund opened this issue Mar 5, 2024 · 5 comments

Comments

@Edluund
Copy link

Edluund commented Mar 5, 2024

Describe the bug
When the next departure time is after midnight the date is still the same as today in the entity state. In the attribute "Next departures" it holds the correct date (tomorrow) but the entity state is wrong. When the entity updates after midnight it starts looking at the next service day which starts at around 05:00:00 meaning the departures in the "Next departures" attribute below will be skipped completely.

Looking at the data in the zip file the provider seems to set the time higher than 24:00:00 which seems to be within spec according to the GTFS website but might not be common practice by other providers.

Example from stop_times inside zip file:

121120000339467318,26:03:48,26:03:48,9022050026735002,16,Malmö C,3,3,9089.68,0

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

Release used
gtfs2 release 0.3.8, HA type: HAOS

Additional
Info from entity taken at March 5, 2024 at 23:57

State: March 5, 2024 at 00:01:00

Arrival: March 5, 2024 at 00:01:40
Day: today
First: false
Last: false
Offset: 0
Agency agency ID: 505000000000000012
Agency agency name: Skånetrafiken
Agency agency url: https://www.resrobot.se/
Agency agency timezone: Europe/Stockholm
Agency agency lang: sv
Agency agency phone: None
Agency agency fare url: None
Agency agency email: None
Origin station stop ID: 9022050026982004
Origin station stop code: None
Origin station stop name: Malmö Lorensborg
Origin station stop desc: None
Origin station stop lat: 55.588913
Origin station stop lon: 12.983927
Origin station zone ID: None
Origin station stop url: None
Origin station location type: 0
Origin station parent station: 26982
Origin station stop timezone: None
Origin station wheelchair boarding: None
Origin station platform code: D
Origin station location type name: Station
Origin station wheelchair boarding available: unknown
Destination station stop ID: 9022050027004001
Destination station stop code: None
Destination station stop name: Malmö Stadion
Destination station stop desc: None
Destination station stop lat: 55.588075
Destination station stop lon: 12.987764
Destination station zone ID: None
Destination station stop url: None
Destination station location type: 0
Destination station parent station: 27004
Destination station stop timezone: None
Destination station wheelchair boarding: None
Destination station platform code: A
Destination station location type name: Station
Destination station wheelchair boarding available: unknown
Route route ID: 9011012000300000
Route agency ID: 505000000000000012
Route route short name: 3
Route route long name: Ringlinjen
Route route desc: None
Route route type: 700
Route route url: None
Route route color: None
Route route text color: None
Route type name: Bus Service
Trip route ID: 9011012000300000
Trip service ID: 1389
Trip trip ID: 121120000345187553
Trip trip headsign: None
Trip trip short name: None
Trip direction ID: 1
Trip block ID: None
Trip shape ID: 1121120000323477605
Trip wheelchair accessible: None
Trip bikes allowed: None
Trip bikes allowed state: unknown
Trip wheelchair access available: unknown
Origin stop arrival time: March 5, 2024 at 00:01:00
Origin stop departure time: March 5, 2024 at 00:01:00
Origin stop drop off type: 3
Origin stop pickup type: 3
Origin stop shape dist traveled: 6 843,92
Origin stop headsign: Ringlinjen via Södervärn
Origin stop sequence: 18
Origin stop timepoint: 1
Origin stop drop off type state: Contact Driver
Origin stop pickup type state: Contact Driver
Origin stop timepoint exact: true
Destination stop arrival time: March 5, 2024 at 00:01:40
Destination stop departure time: March 5, 2024 at 00:01:40
Destination stop drop off type: 3
Destination stop pickup type: 3
Destination stop shape dist traveled: 7 102,21
Destination stop headsign: Ringlinjen via Södervärn
Destination stop sequence: 19
Destination stop timepoint: 0
Destination stop drop off type state: Contact Driver
Destination stop pickup type state: Contact Driver
Destination stop timepoint exact: false
Next departures: March 6, 2024 at 00:01:00, March 6, 2024 at 00:21:00, March 6, 2024 at 00:45:00, March 6, 2024 at 01:05:00
Next departures lines: 2024-03-05T23:01:00+00:00 (3/Ringlinjen), 2024-03-05T23:21:00+00:00 (3/Ringlinjen), 2024-03-05T23:45:00+00:00 (3/Ringlinjen), 2024-03-06T00:05:00+00:00 (3/Ringlinjen)
Next departures headsign: 2024-03-05T23:01:00+00:00 (None), 2024-03-05T23:21:00+00:00 (None), 2024-03-05T23:45:00+00:00 (None), 2024-03-06T00:05:00+00:00 (None)
Gtfs updated at: March 5, 2024 at 23:56:31
Origin stop alert: no info
Destination stop alert: no info
Gtfs rt updated at: March 5, 2024 at 23:56:31
Next departure realtime: -
Delay: unknown
Latitude:
Longitude:
@vingerha
Copy link
Owner

vingerha commented Mar 6, 2024

I will have a look, did you tick the box 'include tomorrow'?

@Edluund
Copy link
Author

Edluund commented Mar 6, 2024

Yes, 'include tomorrow' is ticked. Have tried it without having it ticked as well but it's the same result

@vingerha
Copy link
Owner

vingerha commented Mar 7, 2024

Fixed in 0.3.9... I used the 'offset' for testing as I will not wait for almost midgnight :)

@vingerha vingerha closed this as completed Mar 7, 2024
@Edluund
Copy link
Author

Edluund commented Mar 7, 2024

The new version seems to have fixed the problem with the date being wrong, thanks! Although it still skips the trips after midnight when the entity is updated after midnight.

E.g. First trip on any given service day departs at 05:00:00 and the last trip is the next day at 02:00:00 (or 26:00:00 as in the stop_times.txt). When the entity updates after midnight it will show the first trip on the next service day starting on that date as it's State, which means that all trips from the previous service day between 00:00:00 and 02:00:00 will be skipped.

I'm not sure I explain it well and note this isn't a major issue for me as I basically never use transit after midnight.

@vingerha
Copy link
Owner

vingerha commented Mar 8, 2024

... when the entity is updated after midnight.

Hmm, the thing is... I am not going to stay up after midnight :) and no way to change the time of my machine wihtout affecting other things. The only way to reproduce this I see right now is to change the code to fake the time and date...that is not a little task. And I need a reproduction to see what data comes from where, there is soo much code to deal with dates/tomorrow/today, midnight...and this is even without effect of the data-source (sqlite).

But what you describe sounds logical (I mean: I understand why it does not take 'yesterday'). But I also donot understand why the dataset has slots with both start/end of tomorrow in it, why would this not be part ot a trip 'tomorrow'....no clue.
I will keep it in mind but ...well... unless more people see this I prefer to keep it low-ish prio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants