Name: onebusaway-alexa
Owner: OneBusAway
Description: An Java-based app to communicate with Amazon Alexa for devices such as the Amazon Echo
Created: 2015-08-27 04:30:58.0
Updated: 2018-04-20 05:23:05.0
Pushed: 2017-04-03 22:51:34.0
Size: 29871
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Are you ready to ask your Amazon Echo, “Alexa, where's my bus?“
This project is an implementation of the OneBusAway open-source platform for real-time transit info for Amazon's Alexa Voice Service.
To enable this skill on your Alexa device, you can say, “Enable OneBusAway skill.”
You can also search for and enable skills in the Alexa app:
Just say “Alexa, open OneBusAway” to get started. You'll set your city and favorite stop, using the stop number. Then, just say “Alexa, open OneBusAway” to get arrival times for your favorite stop. You can find your stop number on the placard in the bus zone, in your OneBusAway mobile app, or on your agency website. If you have trouble finding your stop number, see our guide for “Finding your stop number”.
Other features - say Alexa, ask OneBusAway to...
:
...filter routes
to filter out arrivals for particular routes for your currently selected stop...enable clock times
to announce times in a clock format like “at 10:25am” instead of “in 5 minutes”...set my stop to X
to change your stop to the specified number...set my city to X
to change your city to the specified city...repeat
to repeat the last message...enable experimental regions
to enable regions that may be unstable and without real-time infoRefer to interaction model/utterances.txt
for the full list of spoken phrases we support.
Our user interface flow diagram also defined how you can interact with the skill.
The OneBusAway skill is currently available in the following cities:
See OneBusAway Deployments for more information about available OneBusAway regions.
See our Privacy Policy to better understand what information the OneBusAway Alexa skill uses when you request transit arrival information.
Want to make OneBusAway Alexa better? We welcome collaboration! See our Contributing Guide for more details.
The application backing the skill was designed to run in AWS.
The set up process will be a bit circuitous, because, for security reasons, you want Lambda to run your code only if triggered by Alexa, rather than some random Internet visitor or script kiddie. To do this, we must create a skill first, and then supply its unique skill id to Lambda. But, to create a skill, a backing Lambda function should already be deployed. This is resolved by deploying a placeholder Lambda function first, and updating it later.
Therefore, the process is as follows:
aws/cloudformation/onebusaway.template
.You can examine AWS resources created from this template on the Resources tab.
Note that two distinct sets of AWS access credentials are being generated: {lambdaDeploymentAccessKey}
and {lambdaDeploymentSecretKey}
are for deploying Lambda functions, whereas {appExecutionAccessKey}
and {appExecutionAccessSecret}
are for running the application.
You can also use CloudFormation from command line with AWS CLI.
mvn package
. Look for “BUILD SUCCESS”. Resulting JAR is target/onebusaway-alexa-1.0-jar-with-dependencies.jar
Upload to Amazon Lambda with:
mvn lambda:deploy-lambda \
-DaccessKey={lambdaDeploymentAccessKey} \
-DsecretKey={lambdaDeploymentSecretKey} \
-Ds3Bucket={lambdaDeploymentS3Bucket} \
-Dregion=us-east-1 \
-DlambdaRoleArn={lambdaExecutionRoleARN}
…where {lambdaDeploymentAccessKey}
, {lambdaDeploymentSecretKey}
, {lambdaDeploymentS3Bucket}
and {lambdaExecutionRoleARN}
are values generated by CloudFormation during AWS infrastructure set up.
From the AWS Console > Lambda, open the newly created Lambda function and add a Trigger (Event Source) of type Alexa Skills Kit
.
Note the ARN of the Lambda function at the top right corner of the screen. You will use it to set up a new Alexa Skill in the next section.
See the lambda maven plugin homepage for more information on deploying.
Custom Interaction Model
, set Invocation Name to “one bus away”. Name can be anything since this is your development version.interaction model/schema.json
into “Intent Schema” text box.TRANSIT_MODES
. Under “Enter values”, paste the contents of the file interaction model/customSlotTypes/TRANSIT_MODES
.AMAZON.US_CITY
. Under “Enter values”, paste the contents of the file interaction model/customSlotTypes/AMAZON.US_CITY
.interaction model/utterances.txt
.src/main/resources/onebusaway.properties
with the following parameters:l-app-id-development=
key-id=
secret-key=
lemaps.api-key=
usaway.api-key=
Fill in the values:
skill-app-id-development
is Alexa Skill ID from previous step
aws.key-id
and aws.secret-key
are {appExecutionAccessKey}
and {appExecutionSecretKey}
respectively as generated by CloudFormation
googlemaps.api-key
Google Maps GeoCoding API Key which can be obtained from Google Developers
onebusaway.api-key
can be obtained from your local OBA region. Typically, you can use TEST
while are you waiting for a key.
mvn package
.CAUTION: Every time you re-deploy to Lambda using the lambda-maven-plugin
, you must
manually re-add “Alexa Skills Kit” as the function's Trigger. Support for Event Source configuration is coming.
For now, you do not need to do this if you deploy your code through the Lambda UI in AWS Console.
Don't have an Amazon Echo? No worries, there are a few options.
Just remember to log in using the same Amazon account that you've used above to set up the skill.