JeanCarl's Adventures

BMW Sustainability Hackathon

April 29, 2013 |

Feeding my addiction for hackathons and the creativity it incubates, I attended the BMW Sustainability Hackathon in Mountain View this past weekend.

Subtle building entrance. They got cool toys inside!

Breakfast. The healthy kind.

I started out playing with Twilio’s API to see how it worked. By the time the official program started, which was no more than a half hour later, I was sending SMS messages to my phone. Because it was so simple to integrate, it took control of the project. Whatever I built, it had to involve text messaging.

Receiving these text messages was like getting postal mail when you were young, an exciting new method of interaction (at least for me). I totally wanted to just play with Twilio all weekend and send/receive messages! I still do. And for someone that isn’t into text messaging (email is free, why pay for text messages!), this changed my opinion on text messages.

Tony Mataya from Twilio introducing their API

This isn’t usually the way I go about a project, and it was strangely opposite to my web development experience with the beautiful graphical interfaces with buttons that perform actions. When I start a new project, I usually have a picture of a layout in my mind screaming to be converted into HTML. Some formatted data screaming to be read from/written to a MySQL database. A user flow that goes through several pages. The UI for this, text!

Anyways, having the UI already finished (wait, the UI? with text messaging? go ahead and laugh, it’s a joke), I needed another API to actually do something with. The only other one that had staff ready to talk with was ChargePoint, the company behind those electric car chargers in nearly every Silicon Valley tech giant’s parking lot. Some things that their API offered was to find a charge point near a lat/lng or street address, check the availability, and to reserve from a subset of those stations.

The ChargePoint team had a PHP example to pull charging station locations nearby. That was great. It got me started quickly and kept me focusing on the idea, not the service.

Thinking back to why this hackathon was so fun, it was because these two companies had code samples ready to copy and paste, that worked on the first attempt. I cannot stress this enough, it is incredibly challenging to learn a new API, code a library for it, and then use the data creatively in your own application in a matter of a few hours. Because Twilio had the code ready, I only had to change the phone numbers and the message content. Done!

A side effect to getting the basics of an API working quickly is that you can continue experimenting and building on top. You want reservable stations instead of all the stations? Just change the method being called (opening and closing XML tag!), keep the parameters the same and you’re done!

Break time to see the guts of the Mini.

ChargePointSMS

The ChargePointSMS prototype is pretty basic. You can find nearby charging stations, and reserve and cancel reservations. You can text nearby {address} to find any charging station near by that address. Some stations can be reserved, some can’t.

If you’re looking for a reservable station, text find {address}.

Once you have chosen a reservable station, you can text reserve {length of time}. Your spot will be reserved for that length of time fifteen minutes from now. This is so you can travel to that spot and won’t have to pay for the travel time.

If you can reserve the station, you should also be able to cancel it. Well, the keyword cancel ended up stopping the Twilio service from texting my phone number. Plan B, unreserve. Text unreserve and ChargePointSMS will find the last reservation and cancel (err, unreserve) it.

Other options include reserve {nickname} {length of time}. Having previously saved a station location under the nickname, you can quickly reserve frequently used locations, like the one near your favorite coffee shop.

Find, reserve and drive to a ChargePoint station

Judges

Behind closed doors, that's where judges go after demos.

Enhancements

Given this was a single user demo, the part of connecting the phone number where the SMS messages are coming from and the ChargePoint account was hardcoded. A verification/linking process needs to be added, and maybe a way to switch between ChargePoint accounts.

A reoccurring reservation would be nice. Let me reserve that spot closest to my cubicle everyday. Or reserve a spot near the gym every Tuesday night for my yoga class.

The prototype pulls the first result and displays it. Being able to send a next previous keyword to cycle through locations would be useful. And ignore to remove this location from ever being displayed to me.

A list option to summarize upcoming reservations I have made.

A bean bag chair, a sweet ride, and code. I so have to get myself a bean bag!

Debug time

Here’s the gotchas I recall from interacting with the APIs. They are brief, may not be completely accurate, or even be a general problem.

It looks ugly because it's broken! But the sandwich was a delicious distraction.

The first resevation I made was “now for the next hour”. Opps, you can’t cancel within 24 hours of a reservation. I added 24 hours to the times so unreserve could work.

Cancel and stop are reserved keywords in the Twilio API. They unsubscribe you from messages. Use start to reactivate Twilio.

There were only three reservable stations (in CA, WA, MS). Searching San Francisco returned the same result as Mountain View. It’s a mighty long walk from where you park!

HTML comments don’t work when returning SMS XML to Twilio.

Summary

It was a great hackathon, one that I actually learned an API I’m going to use in the future. BMW had a great venue to hangout with great food. And what better way to hack than to sit in a bean bag chair next to a sweet vehicle. And the test drive was really amazing. Maybe next time that can be a grand prize?

Representatives from (left to right) Twilio, ChargePoint, and BMW.

Test drive? Me? First EV I've driven. I'm impressed.

Dinner!