Amazon Alexa Skill: London Bus Stop

Do you prefer to use warm, quiet, spacious bus? Me too
Every time I'm leaving home I have to get updates about time when next busses come to my bus stop. For that reason I literally keep TFL tab open all the time in my mobile

I've got freelance job to write Alexa Skill so I decided to play around with pet project. It's London Bus Stop - custom Alexa Skill which helps user to get information about busses coming to saved bus stop.

How to install it?

Go to London Bus Stops and get this skill or just say Alexa enable London Bus Stops skill.

How to configure it?

TL;DR;

Go to TFL website and search for bus stop you want to use. On the stop's page you'll find a short 5-digit code(same one you can find on the sign plate):

After that say «Alexa, ask London Bus Stops for setup». You'll be asked for that 5 digit code you have to verb and confirm. Sometimes Alexa Platform can't understand what number you meant so try different combinations. For 48584 if could be 48-58-4, 4-85-84 or 48-584 and so on.

Why configuration is so difficult?

This is very tricky question. Due Alexa platform restrictions it's nearly impossible say something like «Remember my bus stop is Old Street» because:

  • Old Street has 4 pairs of bus stops
  • Each pair has 2 directions
  • Platform restrictions don't allow to use speech-to-text
  • If skill found few bus stops it's annoying to use voice interface to make a selection

After some experiment I ended up with most reliable way to setup bus stop using short code. If you have other ideas I'm very open to it!

How does it work?

Thanks to UK Open Data Portal and very well done Transport For London API.

Server is written in python using flask-ask. It's very nice unofficial library of decorators for flask. Code looks very concise and decorators make it looks like it's java annotations :)


@ask.intent("ConfigureIntent")
def configure(is_repeat = False):
msg = render_template("configure" if not is_repeat else "configure_repeat" )
session.attributes['mode'] = "configuration"
return question(msg)

I have found and prepared database with shortcode, longcode and busstop name which is used for search and real time updates queries. Every time user ask for update skill find associated longcode stop id and make query to TFL API, process response and reads the result

Why did I create it?

Even I don't have Alexa at the moment I hope Londoners will find it useful in daily life :) I might publish it to open source as it free anyways