Getting an Uber ride with the Amazon dash button

See this article for an improved version for the new AWS IoT Button

This weekend I got inspired by this great post and decided to order an Amazon Dash Button. I knew this little device could help me solve a pain point I’ve had since I moved to San Francisco 3 months ago.

Like many people, I use Uber daily for my work commute — looking at you Uber, I would love to see a monthly commuter plan! Every morning, I go through the same routine — unlock phone, open the app, select the same pickup location and the same destination over and over again. I know, first-world-problem right?

But I love optimization, so what if all that can be done with the push of a button?

The goal was simple; by pressing a button — conveniently located in my bathroom, I would just need to finish getting ready and get out of my apartment. The car would be right there waiting for me without ever having to touch my phone.

I had my first live test this morning, and it was awesome!

Here is how I did it, and how you can try it out too — however, if you prefer to go directly to the code, please visit geoffrey/uber-dash.

Setup the button with the Amazon App

First, you need to setup your dash button to communicate with your network using the Amazon App. Follow the steps that you can find under Amazon App — Your account — Dash devices carefully exit the setup process before the last step that actually lets you choose your order from Amazon. :speak_no_evil:

Get your button’s Identity

Using and running the first python snippet provided in this article, you can find the MAC address of your button (e.g. a0:02:dc:b1:3d:b2).

Intercept your button’s communications

After getting the button’s MAC address, I decided to play a little bit more with the network using Nodejs and the pcap module. I’m not a network expert, so I spent some extra time playing with the packets. I inspected their structure in order to spot and extract the ones I was interested in.

Unfortunately, I was only able to find MAC addresses as an array of integers (e.g. [160, 2, 220, 177, 61, 178]). I didn’t really search further and converted that array into the usual 6 group of two hexadecimal digits separated by colons— please ping me if you know a better way to extract hexadecimal MAC addresses from the packets with this pcap module! Then I compared these against the target’s MAC address: the dash-button. Every time they match, I call the handler function.

I also had to throttle the packet detections as I was detecting a couple of them within just one press.

Calling Uber when the button wakes up

Once you are able to detect the button waking up on your network, you’re almost done. You can now do virtually anything you want, including ordering a Uber ride using their API.

I created a very simple Express app that allows you to OAuth with Uber in order to give the app permissions to request rides for you.

And voilà, now we just need to listen for the button and call uber.call whenever the button gets pressed.

Get your first dash-uber ride!

First, clone this repo and edit the ./source/config.js file to add your dash button MAC address, your Uber application credentials as well as the pickup and drop-off coordinates and the product id (UberX, UberBlack…) you want to order.

Install dependencies using npm install.

Run ./dash-button.js which will listen for the dash button and call Uber:

In order to get the product id you want to use when the button is pressed, you can visit http://localhost:3000/products — after you log in. It’ll respond with the list of products available at your pickup location. Copy/paste the id of the product you chose into your config file, and relaunch the program.

Contribute

Please feel free to fork this project and contribute with pull-requests. I know it’s a quick-and-dirty hack, so there is tons of room for improvement. I’m more than happy to look into your PRs when I’m not too busy working at Checkr. (We are hiring!)

Published in Startups, Wanderlust, and Life Hacking

-

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.