Issues with GTFS timezones
See original GitHub issueThe 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:
- Created 2 years ago
- Comments:18

Top Related StackOverflow Question
Also experiencing this issue, which makes it impractical to use the bus times as glanceable information.
I too am encountering the exact same issue in the United States Central Standard Time.