GTFS Realtime

I created a new sensor that provides real-time departure data for local transit systems that have gtfs feeds. I’ve been using it in my personal home assistant project for the past week or two with no issues, but I’m wondering what the best way to share it is.

Should I create a pull request for home assistant, or is it better for me to share it as a custom component, and gather feedback first?

Here’s the commit in my local branch with all of the changes: https://github.com/tdickman/home-assistant/commit/e57aaa63f4a0f2b5f1107bb8f79303fd35e8fc28

1 Like

Always a good idea to test it with the user base as a custom component and get feedback first.

I’ll have to check if I have any local feeds that work as I don’t use this. But if I do, I’ll try it out and report back.

If you’re still looking for help my regional rail says it has a gtfs realtime feed. If you put out a custom component I can see if I can test it for you.

Let me know if you need the Feed URL.

I’d love to have some help testing it - I’ll try to get a custom component out later this week for testing. I’ll post here once it’s ready.

1 Like

any progress on this?

I’ve not tried your custom component however the photo provided seems to provide the same functionality as an existing component here https://home-assistant.io/components/sensor.google_travel_time/

Is your component able to simply list the time of the next bus/train times rather than point A to B travel times?

All transport companies doesn’t share their GTFS feed with Google. I know the one in my city doesn’t… But if it’s based on the same behavior than the theoretical, static GTFS, yeah, it should give the time before the next departure and not the travel time.

I have a similar set up to get my travel information. I want to know when the next train is so I use transportapi.com. It is really easy to use, it gives a json response to a request. For example here is one of my sensors.

- platform: rest
  resource: https://transportapi.com/v3/uk/train/station/EUS/live.json?app_id=YOURAPPIDHERE&app_key=APIKEYHERE&calling_at=EDB&darwin=false&train_status=passenger
  name: First Departure
  value_template: '{{ value_json.departures.all[0].expected_departure_time }}'

My example will give the next train from London Euston calling at Edinburgh.
Just add your transportapi app_id, app_key and station then off you go you will get the next departure from that station. There is loads of options that can be used as part of the request. All the information is live and is updated every minute.

I’m only new to HASS so trying this is still a little beyond me, but I can’t wait until it’s an official component.

I live near a train station (in Sydney, AU) and would love to have a sensor showing the minutes to the next train. Access to the real time GTFS is pretty easy here, from what I read.

I’ve uploaded a copy of the component, and posted about it in the custom components forum. Let me know if you have any trouble!

1 Like