One Bus Away component

I live in Seattle and our Metro Bus service publicly shares data about arrival times, routs, and even GPS locations of buses. This is super handy as an app on my phone, but I want to tie this into some automatons to help notify me when my I have enough time to make my next bus or if I should sip my coffee slowly.

They use and open API that sends JSON with all the data based on your bus stop number. I did set up a REST sensor and some filters to display the next 4 bus arrival times, but it was kinda hacky due to the large amount of data and frequency at witch it changes. I am not supper proficient with python and it would probably take someone else no time to do this vs my weeks of stumbling. I also think this would be handy for many people since One Bus Away supports many cities in the US.

Basically I want to be able to set up a sensor in config that uses the City and bus stop number to populate the following data for each bus in the query:

  • Bus number
  • Real Time Arial
  • Scheduled Arial
  • Latitude
  • Longitude

Perhaps you need to share the api documentation?

Ah, good point.

http://developer.onebusaway.org/modules/onebusaway-application-modules/1.1.13/api/where/index.html

This is what I was using to pull data to the HA REST sensor of that helps. All the data is there in JSON or XML.

http://developer.onebusaway.org/modules/onebusaway-application-modules/1.1.13/api/where/methods/arrivals-and-departures-for-stop.html

I have been playing with the Scrape Sensor and have this working for pulling arrival times.

- platform: scrape
    resource: http://api.pugetsound.onebusaway.org/api/where/arrivals-and-departures-for stop/1_15206.xml?key=TEST
    name: One Bus Away
    select: 'predictedDepartureTime'
    index: 0
  - platform: scrape
    resource: http://api.pugetsound.onebusaway.org/api/where/arrivals-and-departures-for-stop/1_15206.xml?key=TEST
    name: One Bus Away2
    select: 'predictedDepartureTime'
    index: 1

I would love to know if there was a way to add other data as attributes without having to hit the same site each time for all of the information. Also, I am sure that a few people would love to have a Component that works with One Bus Away considering they have a rather solid API.

Another Seattle transit rider here! I love the idea of integrating OneBusAway. @Richard_Albritton have you worked on this any more in the last few years? Would you mind posting your code to GitHub? I might take a swing at it when I have some time.

I posted the beginnings of a real integration here GitHub - jvert/home-assistant-onebusaway: OneBusAway integration for Home Assistant.

Love to get some feedback or contributions from people who are better at HA integrations than I am.

Thanks for starting this! I’m trying to configure it with OneBusAway’s “multi-region” api. I’m in Spokane, WA. I can’t figure out how to connect to that api though. Curious if you’ve dove into that at all.