GTFS Real Time custom component async issue

Hello community!

I’m currently implementing a new GTFS Real Time custom component to track transit in real time (there is a few available but all missing some features IMO).

My proposal includes the ability to get multiple sensors per line/stop to track the next services in real time, with a fallback to static data to supplement real time services.

Let’s say I want to track the next 3 departures for my stop: if only 1 is real time, it will fulfill the 2 others with static data.

I’ve been learning a lot for my first custom component implementation and so far I’m pretty happy with the results, real time sensors work perfectly.

Real time data comes from a simple HTTP request and works smoothly.

However, I’m struggling to initialize the static data. I have a method that fetch the GTFS zip files (~15MB for my local transit), then read the file with ZipFile.
This happens in async_setup_platform (ha-gtfs-rt/custom_components/gtfs_rt/sensor.py at 1f2cc1ea8ca02e8610d1df0e69a0a9d004fb7f0f · william57m/ha-gtfs-rt · GitHub) using hass.create_task but HA crash because it looks like it block the main thread.
My task is fetching the zip file (ha-gtfs-rt/custom_components/gtfs_rt/gtfs_static.py at 1f2cc1ea8ca02e8610d1df0e69a0a9d004fb7f0f · william57m/ha-gtfs-rt · GitHub), until there it’s working, then it parse the zip files (ha-gtfs-rt/custom_components/gtfs_rt/gtfs_static.py at 1f2cc1ea8ca02e8610d1df0e69a0a9d004fb7f0f · william57m/ha-gtfs-rt · GitHub), and that’s where it seems to crash HA for some reason. You can see I’m running it in the running loop ha-gtfs-rt/custom_components/gtfs_rt/gtfs_static.py at 1f2cc1ea8ca02e8610d1df0e69a0a9d004fb7f0f · william57m/ha-gtfs-rt · GitHub but it’s still not working.

I’m not so sure what I’m doing wrong.

I’d appreciate any help,

Best,
William