vingerha / gtfs2

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

Offset not working as expected #31

Closed mmrvelj closed 9 months ago

mmrvelj commented 9 months ago

Describe the bug Whatever I put in the offset property, it seems to have no effect.

I would expect if I put e.g. value 10, that I should not get information about departures that are in less than 10 minutes. However I do , although next two departures are in 7 and 17 minutes, I am still shown departure due in 7 minutes.

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

Release used gtfs2 release 0.3.8 HA OS core 2024.2.5

vingerha commented 9 months ago

How long did you wait after applying the setting? It does not immediately apply, only after the next refresh. Only 3 days ago I tested this and it worked fine for me As per the requests for any ticket...need more data to verify and please provide exact data, screenshots, etc.

vingerha commented 9 months ago

Adding, this is part of previous code and what it seems to do is add X minutes to the departure time so that you can account for e.g. walking time to the stop. When I add e.g. 60 mins...the whole thing moves with ...60 mins

mmrvelj commented 9 months ago

I am using data from Croatian transportation system in Zagreb located here: https://www.zet.hr/odredbe/datoteke-u-gtfs-formatu/669

Direct link: https://www.zet.hr/gtfs-scheduled/latest

Regarding configurations, there is not much to show, but here it is: basic config: gtfs-config-1 second config screen: gtfs-config-2

how it is represented: gtfs-config-3

detailed calculation: gtfs-config-4

these times are regular times from schedule. They are correct departure times, not modified by the offset I put.

I would expect that times are either moved by the specified number of minutes or that they are not shown then they are less then specified amount of offset. If I understand your last comment, it should be the first option -that the times are actually moved by offset value.

Just to check, is the value that I need to put really in minutes (like it's specified in GUI), not seconds or milliseconds or something similar? I can read python code, could you direct me to file where this is taken into account, perhaps I can figure out what could be wrong with my config?

mmrvelj commented 9 months ago

OK, found the location, it moves current time (now) by the offset in minutes. Nothing wrong with the code, so my assumption is that the calculation is not executed on my side. But the config is inside for more than 24 hours, and it still does not takes it into consideration. What could I do to force recalculation?

mmrvelj commented 9 months ago

I figured it out. I have put same value for data refresh (15 minutes) and offset (15 minutes).

Refresh time must be lower (more frequent) in order to get the desired effect, as otherwise it will too often recalculate too late.