vingerha / gtfs2

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

'utf-8' codec can't decode byte 0xa2 in position 99: invalid start byte | when adding NYC subway real-time data source #82

Closed mbonaccors closed 1 month ago

mbonaccors commented 1 month ago

Describe the bug When I try to add real-time gtfs feed from the mta developer page as a new data source it is not able to parse the feed and create the database.

when I look at the files in the gtfs home assistant folder I see the following inside the

/homeassistant/gtfs2/Subway - ACE.sqlite

file:

'utf-8' codec can't decode byte 0xa2 in position 99: invalid start byte

url to data source (NYC MTA Gtfs real-time feed for A,C,E subway lines)

https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-ace

Release used

Additional Please add logs if helpfull, switch to 'debug' logging to get more details

mbonaccors commented 1 month ago

All the NYC subway data feeds can be found here:

https://api.mta.info/#/subwayRealTimeFeeds

vingerha commented 1 month ago

Two issues:

mbonaccors commented 1 month ago

Ah I see. Thanks for reviewing this so quickly! I’ve been trying to find an integration for home assistant that can connect to these subway feeds (many in NYC probably in same boat). Is there any more information I might be able to provide or be of assistance or is it basically not going to be possible with this current codebase?

vingerha commented 1 month ago

Hmm... for some reason it works for me (now).... so the format is correct (enough) for my lib to convert it. What I did was set it up via th service call, just the url and to check, I ticked the debug output toggle....it presents the converted json nicely. So it seems not the source itself. I need precise steps on how you set it up until it crashed.

mbonaccors commented 1 month ago

Hello again - I can try setting it up via the service call as well, is there documentation on that installation process?

Here are the precise steps on how I set it up from my end with screenshots:

  1. HA info: image

  2. GTFS2 installation info: image

  3. Go to settings --> integrations --> add GTFS 2: image

  4. Obtain URL for ACE line of subway from MTA Developer resource page (Realtime Feeds): image

  5. Setup a new data source: image

image

  1. Wait a few minutes, review files in GTFS2 directory: image

image

image

Seems not to be working, but let's confirm:

Try to create new "Scheduled Departure on Stops in your vicinity" image image

I looked in the "HA Logs" but do not see anything when i search for GTFS or Subway.

vingerha commented 1 month ago

You are using a realtime feed where you should use the static (!) data feed.... this is in (imo) clearly mentioned in the docs

mbonaccors commented 1 month ago

Ah okay, I understand, so there is just no ability to use realtime feed at the moment. I will use static feed for now. Thank you for reviewing once again.

vingerha commented 1 month ago

The realtime data is not giving a lot of information, it only has some (usually cryptic) pointers to route, trip or stop but no details what these would be

mbonaccors commented 1 month ago

Ah that makes sense upon reviewing the documents:

image

https://new.mta.info/document/134521 Seems they have a pdf that explains how to decode the information. Seems like a larger project. If it is feasible, might I add it as a future feature request?

vingerha commented 1 month ago

Highly unlikely as it states "extensions added specifically for NYCT", this integration only covers gtfs generically ... so you need to get the static data, for which I am almost certain that this exists.

mbonaccors commented 1 month ago

Yes, I now have it working with static information!

image

mbonaccors commented 1 month ago

Got it working with static. Many thanks!!

IMG_0511

IMG_0510

IMG_0509