Look a squirrel! Logo

🐷 Bacon button

Scotland has a long history of innovation; the first cloned mammal, tractor beams, first Bicycle, first Robot Olympics, Penicillin, et al. Unsurprisingly one of their greatest inventions is the World's Best Hangover Cure, a Bacon roll and Irn Bru.

Bacon roll
the square meat under the bacon is sausage

My wife and I suffer equally from our hangovers. If we're lucky one of us will have remembered to pick up bacon in advance otherwise we're going to have to venture outside. After a night-out we generally spend our mornings feeling sorry for ourselves and trying to convince the other to get up and get some bacon (my wife wins 60% of the time by threatening to make me porridge instead).

My hatred of porridge puts me at a distinct disadvantage, so I had to level the playing field with technology.

Amazon Dash Button
no I didn't threaten to stop wearing deodorant

The Amazon Dash Button is a WiFi connected button that is meant to make it easy to order common household items. Let's hack it!

Prevent it from ordering from Amazon

The purpose of the button is to order from Amazon. But we don't want to receive more deodorant every time we want bacon. Most tutorials on hacking the buttons suggest stopping once you get to the product selection screen during setup.

But you get £5 off your first order (which also happens to be the price of the button) so essentially if you pick a button for a product you actually need you can recoup the cost of your button.

Complete the setup, place your order (with your discount) and then go back into your device settings and deactivate the button. Once deactivated you can begin the setup process again and this time stop at the product selection screen.

Detecting button pushes

To conserve battery life the button is only on when it has been pushed. Push the button, it wakes up and connects to your Wifi network. This is what we're going to detect. When a device with your button's MAC address joins the network we know it has been pushed. We're going to use amazon-bash to detect this.

First we need to find the device's MAC address, to do this follow the amazon-bash instructions:

while :; do arp-scan --localnet -O ieee-oui.txt | grep 'Amazon'; done

I used a spare Raspberry Pi as my button server, but any *nix machine should work, although you may need to install some dependencies.

Sending bacon requests 🐷

Now to translate button pushes into tasty bacon through the power of pestering. Each button push will trigger a new text message to be sent via the Nexmo API to my wife's mobile phone. Hopefully the notification sounds (as well as how pitiful and ill I look) will persuade her that a quiet life is worth getting up to get bacon.

I made a couple of tweaks to the amazon-bash.sh script. I could probably get better performance using the Wifi script but I didn't have airmon-ng.


Facebook screenshot
I think I find this much funnier than my long suffering wife does

So it hasn't actually gained me any bacon, yet. But this was only a proof-of-concept. However further validation of the idea with my current delivery mechanism may prove very detrimental to my health. So I'll need to find an alternative solution for phase 2.

There's a takeaway close by which delivers Breakfast Munchie boxes. Now I just need to reverse engineer the Just-Eat API…

Breakfast Munchie Box
a breakfast munchie box, I can feel my arteries hardening already

More from Look a squirrel!

Morseboard - Morse Code via your keyboard backlight

Because it's there – George Mallory As a developer sometimes it can be difficult to remember just because you can do something, does not always mean you should do something. With...

See Article

Presenting code in Keynote

When it comes to slide design I'm heavily influenced by Zach Holman's Slide Design for Developers; the bigger, the bolder, the brighter, the better! I try to keep text to...

See Article