question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with GTFS timezones

See original GitHub issue

The problem

When using the GTFS integration (with http://karttapalvelu.kuopio.fi/google_transit/google_transit.zip), I get departure times offset by the same amount as my timezone.

So say I have a departure time at 16:20, the sensor would show that to me as 18:20. If I change my timezone(Europe/Helsinki (UTC +2)) in the configuration to UTC, the departure times are shown correctly.

I guess this has to do with the recently added timezone code
self._state = self._departure[“departure_time”].replace(tzinfo=dt_util.UTC)

It seems to me, that the code just defines whatever is set in the departure_time as UTC, and then the UI accounts for this by offsetting it by 2h. In my case the gtfs data is defined in local times, and the data has the agency timezones defined as “Europe/Helsinki”, so I guess the integration does not take that into account at the moment. So my departure time seems correct until it is set to UTC in the line mentioned above.

What version of Home Assistant Core has the issue?

core-2021.12.8

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

GTFS

Link to integration documentation on our website

https://www.home-assistant.io/integrations/gtfs/

Example YAML snippet

sensor:
  - platform: gtfs
    origin: 201447
    destination: 303022
    data: vilkku
    name: Bussi 5
    include_tomorrow: true

Anything in the logs that might be useful for us?

No response

Additional information

The gtfs data Link I provided had some issues with some weird characters in the beginning of the files agency.txt and routes.txt (and maybe feed_info.txt). Removing the weirdness from the beginning of the file created the sqlite database correctly.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:18

github_iconTop GitHub Comments

1reaction
puzzledsamcommented, Dec 30, 2022

Also experiencing this issue, which makes it impractical to use the bus times as glanceable information.

1reaction
simgaymercommented, Dec 27, 2022

I too am encountering the exact same issue in the United States Central Standard Time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

agency_timezone - Transit Partners Help - Google Support
Time zone fields specify the time zone for the transit agency and stops. ... as a reference for the departure and arrival times...
Read more >
potentially wrong handling of GTFS Time values #175 - GitHub
GTFS Time is not defined relative to midnight, but relative to noon - 12h. While that makes "writing" GTFS feeds easier, it makes...
Read more >
RFC: The timezone of the feed - Google Groups
agency.agency_timezone contains the timezone where the transit agency is located. At this moment GTFS has a mandatory requirement that a single feed
Read more >
Critical GTFS Validation Errors - Caltrans - CA.gov
A GTFS validator is a software tool that identifies common issues with a ... Agencies from GTFS agency.txt have been found to have...
Read more >
Realtime validation errors and warnings - Google Developers
Verify the HTTP error code returned and investigate the issue ... Be sure to provide the timestamp in the UTC timezone, in seconds...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found