Skip to content

OneBusAway Binding ​

OneBusAway is an open source, real-time, transit-information service. This binding lets you get events based on transit arrivals and departures, so you can create rules to do something based on that data.

Preparation ​

You will need to obtain an API key from the transit provider you want to load data from. Different providers of the service have different policies, so you will have to figure this part out for each deployment.

Supported Things ​

This binding supports route arrival and departure times for all stops provided from a OneBusAway deployment.

Binding Configuration ​

The following configuration options are available for the API binding:

ParameterNameDescriptionRequired
apiKeyAPI KeyThe API key given to you by a transit provider for their deployment.yes
apiServerAPI ServerThe domain name of the deployment to talk to, e.g. api.pugetsound.onebusaway.org.yes

The following configuration options are available for the Stop binding (which requires an API binding):

ParameterNameDescriptionRequired
stopIdStop IDThe OneBusAway ID of the stop to obtain data for, e.g. 1_26860.yes
intervalUpdate IntervalThe number of seconds between updates.no

Thing Configuration ​

The following configuration options are available for a Route (which requires a Stop binding):

ParameterNameDescriptionRequired
routeIdRoute IDThe OneBusAway ID of the route to obtain data for, e.g. 1_102574.yes

Channels ​

The Route Thing supports the following channels:

Channel Type IDChannel KindItem TypeDescription
arrivalstateDateTimeThe arrival time of a Route at a Stop.
departurestateDateTimeThe departure time of a Route at a Stop.
updatestateDateTimeThe last time this data was updated (per the data provider, not the last time openHAB updated the data).
routeEventtrigger—Triggered when a Route arrives or departs a Stop (event values: ARRIVAL, DEPARTURE).

Channel Configurations ​

The arrival, departure, and routeEvent channels can be configured with an offset specifying the number of seconds to move an event back in time.

Full Example ​

Here is an example of a configuration for a bus stop in Seattle, WA, USA that has three routes configured.

demo.things:

dsl
Bridge onebusaway:api:pugetsound [apiKey="your-api-key", apiServer="api.pugetsound.onebusaway.org"] {
  Bridge onebusaway:stop:1_26860 [stopId="1_26860"] {
    Thing onebusaway:route:1_100193 [routeId="1_100193"]
    Thing onebusaway:route:1_102574 [routeId="1_102574"]
    Thing onebusaway:route:1_100252 [routeId="1_100252"]
  }
}

demo.items:

java
// Route 1_100193 (#32)
DateTime Fremont_32_Arrival "32 - University District" { channel="onebusaway:route:1_100193:arrival" }
DateTime Fremont_32_Departure "32 - University District" { channel="onebusaway:route:1_100193:departure" }

// Route 1_102574 (#40)
DateTime Fremont_40_Arrival "40 - Ballard" { channel="onebusaway:route:1_102574:arrival" }
DateTime Fremont_40_Departure "40 - Ballard" { channel="onebusaway:route:1_102574:departure" }

// Route 1_100252 (#62)
DateTime Fremont_62_Arrival "62 - Sand Point East Green Lake" { channel="onebusaway:route:1_100252:arrival" }
DateTime Fremont_62_Departure "62 - Sand Point East Green Lake" { channel="onebusaway:route:1_100252:departure" }