An Amazon Dash Button is a plastic $5 button equipped with a WiFi connection and a battery capable of 1,000 presses. Amazon’s intent is that you will place these devices around your home so as to quickly re-order your favorite products.
For me, the intriguing aspect of these tiny devices lies in their placement. Although each button is disciplined to a single outcome (ordering a specific product), they can be placed within the context of the purpose they serve – thus augmenting existing hardware.
The button for ordering batteries goes on your Nintendo Wii U. The button for ordering laundry detergent goes on your washing machine. Always forgetting to pick up K-cups from the supermarket? Stick that dash-button on your Keurig coffee-maker.
Unbeknownst to Amazon, these dash-buttons are quickly becoming a gateway drug to the world of IoT (Internet of Things). Whether you’d like to use your dash button to order a pizza or call for an Uber – there’s a hack for that.
Place it. Press it. Get it. Do as you please.
In this blog, I’m going to walk you through how to bend an Amazon Dash Button to your will; writing to a SharePoint list and initiating a Nintex workflow. Before we get started, here’s a quick video of my finished product in action!
Breaking Down the Hack
The real challenge here is that we need a non-intrusive way to detect that our dash button has been pressed and emit our own custom event. Luckily, Amazon has made this easy for us in their attempt to preserve battery life.
Each time a dash-button is pressed, the following events occur:
1. The device wakes itself up
2. The device connects to your Wi-Fi (previously configured)
3. The device places an order.
In order to connect to your local network (step 2 above), the dash button must first request an IP address. It will then issue an ARP Probe to confirm that no other devices on the network are using the IP address it’s been assigned. Here’s our way in!
Since the ARP Probe contains our dash button’s MAC address, our server can be configured to monitor requests and take action for only our specific device.
For this activity, we’ll be using a fantastic node module by Alex Hortin.
Ensuring our dash button doesn’t actually order anything.
When your dash button arrives, you will find instructions that walk you through the configuration process using Amazon’s mobile app. Follow those instructions until you reach the final step. Here, we want to omit “selecting a product” and instead just exit the app.
Installation & Setup
Now that our dash button is ready to go, let’s install a few quick dependencies. We’re going to need node.js and npm. You can download the two in tandem here.
Because npm is updated more frequently than node.js, it is also wise to run an update to verify you have the latest version:
[sudo] npm install npm@latest -g
Now that our foundation is in place, we need to install a pair of node modules to handle ARP probe detection and facilitate our interactions with SharePoint. To do so, run the following commands:
$ npm install node-dash-button $ npm install csom-node
Both of these modules are well documented so if you run into any issues, please refer to their GitHub repositories:
Find Your Dash Button
Next, we need to monitor your local network for ARP requests in order to decipher the signature (MAC address) of your specific dash button. To do so, run the following program from your newly created node-dash-button directory within node_modules:
# you may need to use sudo due to libpcap running in permiscuous mode $ cd node_modules/node-dash-button $ node bin/findbutton
Begin pressing your dash button and watch for ARP requests to be written to the console. There may be several other devices on your local network, so you may need to do this several times until you can isolate which request is your button.
You can expect a value like: “f0:27:2d:31:43:0e.”
Test Your Dash Button
Now that we’ve determined the address for our dash button, let’s run a quick test. Let’s see if we can perform an action (logging to console) in response to using our dash button. To do this, let’s create a test.js file and include the following code snippet:
After running the above program and pressing your dash-button, you should now see your response!
Incorporating SharePoint and Nintex
This is where the fun begins! Now that we’ve hacked our dash button to emit an event, what that event consists of is entirely up to you!
Leveraging the CSOM module that we configured earlier – I’ve opted to harness my dash button to write to a SharePoint List! I’m also initiating a Nintex
workflow when new items are added to this SharePoint List so that I can take advantage of its vast array of business automation tools and make room for future growth.
Take a look at my updated script:
I’d love to hear in the comments below how you fare with the dash button hack! How better could you spend $5 today than to dip your toe into the emerging IoT industry?