Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue getting GTFS-rt integration to work with Septa/Philadelphia public transit #32

Open
rsnyder415 opened this issue May 1, 2024 · 1 comment

Comments

@rsnyder415
Copy link

rsnyder415 commented May 1, 2024

Hello Mark and company, I have been trying for the past day to get the gtfs-rt integration working for my local bus in Philadelphia. Bear with me because I am quite sure I am going to get something wrong in this post. I have reviewed the issues on this page and none seem to be the same as the one I am having. Here is what I have added to the sensor list in my configuration.yaml:

- platform: gtfs_rt
    trip_update_url: 'https://www3.septa.org/api/TransitView/index.php'
    departures:
    - name: 11th Street Bus Headed North
      route: '45'
      stopid: '16832'
      directionid: 'Northbound'
      icon: mdi:bus
      service_type: 'bus'

I can't seem to get any sensor to populate into my home assistant using this code. I tried to use the test.py script to troubleshoot but couldn't figure out how to use it.

As far as I can tell, there is no API key needed to access the Septa gtfs-rt data. The only thing I can tell that is different is that "route" from the integration is "route_id" in the Septa data, "stopid" is "next_stop_id", etc. This is where I really reveal my novice-ness. I don't know how to get the integration to realize the the "route" data it is looking for is named "route_id" in the data set.

Here is the SEPTA page that lists the api info:
Septa API info

Any suggestions on what I can do to get this working? Sorry to bother.

Thanks.

@InTheDaylight14
Copy link

Here is an adjusted configuration. This one is closer but it still does not work. I had to google the gtfs-rt trip update and vehicle position urls which are different from the SEPTA API.

trip_update_url: 'https://www3.septa.org/gtfsrt/septa-pa-us/Trip/rtTripUpdates.pb'
vehicle_position_url: 'https://www3.septa.org/gtfsrt/septa-pa-us/Vehicle/rtVehiclePosition.pb'
departures:
- name: '11th Street Bus Headed North'
  route: '45'
  stopid: '16832'
  directionid: '0'
  # directionid: '1'

Note: Direction 0 and 1 show up in the real time data below, I'm not sure which one corresponds to Northbound

This is the data received from SEPTA gtfs-rt:

DEBUG:sensor:      Stop:  Stop Sequence: 52 Stop Time: 0
DEBUG:sensor:   Received Trip ID 733142 Route ID: 45 direction ID 0 Start Time:  Start Date: 
DEBUG:sensor:   Feed Route ID 45 changed to 45
DEBUG:sensor:      Stop:  Stop Sequence: 7 Stop Time: 0
DEBUG:sensor:   Received Trip ID 733259 Route ID: 45 direction ID 1 Start Time:  Start Date: 
DEBUG:sensor:   Feed Route ID 45 changed to 45
DEBUG:sensor:      Stop:  Stop Sequence: 1 Stop Time: 0
DEBUG:sensor:   Received Trip ID 733262 Route ID: 45 direction ID 1 Start Time:  Start Date: 
DEBUG:sensor:   Feed Route ID 45 changed to 45
DEBUG:sensor:      Stop:  Stop Sequence: 17 Stop Time: 0
DEBUG:sensor:   Received Trip ID 733263 Route ID: 45 direction ID 1 Start Time:  Start Date: 
DEBUG:sensor:   Feed Route ID 45 changed to 45
DEBUG:sensor:      Stop:  Stop Sequence: 34 Stop Time: 0
DEBUG:sensor:   Received Trip ID 733147 Route ID: 45 direction ID 0 Start Time:  Start Date: 
DEBUG:sensor:   Feed Route ID 45 changed to 45
DEBUG:sensor:      Stop:  Stop Sequence: 4 Stop Time: 0
DEBUG:sensor:   Received Trip ID 733261 Route ID: 45 direction ID 1 Start Time:  Start Date:

Now compare to the data I receive from MARTA:

DEBUG:sensor:   Received Trip ID 9095658 Route ID: 21619 direction ID 0 Start Time: 16:20:00 Start Date: 20240517
DEBUG:sensor:   Feed Route ID 21619 changed to 21619
DEBUG:sensor:      Stop: 81900 Stop Sequence: 1 Stop Time: 1715977364
DEBUG:sensor:      Stop: 99972388 Stop Sequence: 2 Stop Time: 1715977425
DEBUG:sensor:      Stop: 81028 Stop Sequence: 3 Stop Time: 1715977462
DEBUG:sensor:      Stop: 82030 Stop Sequence: 4 Stop Time: 1715977497
DEBUG:sensor:      Stop: 82032 Stop Sequence: 5 Stop Time: 1715977540
DEBUG:sensor:      Stop: 82034 Stop Sequence: 6 Stop Time: 1715977573
DEBUG:sensor:      Stop: 82036 Stop Sequence: 7 Stop Time: 1715977633
DEBUG:sensor:      Stop: 82038 Stop Sequence: 8 Stop Time: 1715977710
DEBUG:sensor:      Stop: 82040 Stop Sequence: 9 Stop Time: 1715977740
DEBUG:sensor:      Stop: 82042 Stop Sequence: 10 Stop Time: 1715977769
DEBUG:sensor:      Stop: 82044 Stop Sequence: 11 Stop Time: 1715977800
DEBUG:sensor:      Stop: 82046 Stop Sequence: 12 Stop Time: 1715977830
DEBUG:sensor:      Stop: 82048 Stop Sequence: 13 Stop Time: 1715977889
DEBUG:sensor:      Stop: 83036 Stop Sequence: 14 Stop Time: 1715977938
DEBUG:sensor:      Stop: 83042 Stop Sequence: 15 Stop Time: 1715978018
DEBUG:sensor:      Stop: 83045 Stop Sequence: 16 Stop Time: 1715978106
DEBUG:sensor:      Stop: 83056 Stop Sequence: 17 Stop Time: 1715978221
DEBUG:sensor:      Stop: 84142 Stop Sequence: 18 Stop Time: 1715978312
DEBUG:sensor:      Stop: 84146 Stop Sequence: 19 Stop Time: 1715978350
DEBUG:sensor:      Stop: 84167 Stop Sequence: 20 Stop Time: 1715978397
DEBUG:sensor:      Stop: 84162 Stop Sequence: 21 Stop Time: 1715978464
DEBUG:sensor:      Stop: 84179 Stop Sequence: 22 Stop Time: 1715978516
DEBUG:sensor:      Stop: 84172 Stop Sequence: 23 Stop Time: 1715978554
DEBUG:sensor:      Stop: 84174 Stop Sequence: 24 Stop Time: 1715978583
DEBUG:sensor:      Stop: 99973371 Stop Sequence: 25 Stop Time: 1715978615
DEBUG:sensor:      Stop: 99973368 Stop Sequence: 26 Stop Time: 1715978646
DEBUG:sensor:      Stop: 99973366 Stop Sequence: 27 Stop Time: 1715978704
DEBUG:sensor:      Stop: 84902 Stop Sequence: 28 Stop Time: 1715978740

There are more upcoming stops associated with a trip ID. The Stop time field is populated for each stop in the sequence. In the SEPTA data, all stop times are 0 which can't be right. There is also only one upcoming stop per trip ID.

I'm not sure where to troubleshoot from here. It could be something wrong with SEPTA's gtfs-rt feed, or something wrong with how this integration is taking in that feed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants