A bash script to react to the click of an amazon-dash button
Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.travis.yml
README.md
amazon-bash-wifi.sh
amazon-bash.sh
ieee-oui.txt

README.md

Amazon-DBash

Build Status

This script will execute around 2-3 seconds after the click vs the nodejs alternative that are called when the button flashes red (about 10 seconds after being clicked). It is also extremely light weight as most linux distros have the packages installed already vs nodejs which is a huge library.

Instructions

Amazon app

When you receive your brand spanking new Dash Button set it up using the Amazon app, which is available for iOS and Android:

  • On the app go to Your Account -> Set up a new device.
  • Select Dash Button and follow the multiple instructions until you are prompted to select a product - ! Do not select a product !.

Finding the MAC address of the Dash Button

We need to first get a list of OUIs (Organizationally Unique Identifier) for amazon products.

wget https://raw.githubusercontent.com/maxisme/amazon-bash/master/ieee-oui.txt

Now you should:

  • Run this as root

    $ while :; do arp-scan --localnet -O ieee-oui.txt | grep 'Amazon'; done
    
  • Click the Dash Button.

    This should output the MAC address (in my case: 50:f5:da:6a:f3:2c) of the Dash.

  • ctrl-c to exit loop.

  • rm ieee-oui.txt to delete the list.

Using amazon-bash.sh

You can use either amazon-bash.sh or amazon-bash-wifi.sh:

  • amazon-bash.sh is for use when you do not have a wifi dongle.
  • amazon-bash-wifi.sh is for when you do (the latter has a lot faster reaction speed). This method also requires that you install aircrack-ng.

Within the scripts you need to update the MAC variable to the one we found earlier.

And also you need to update the onClick function to include what you want to happen on the click. Some ideas:

Also a reminder that if you want this script to run permanently:

  1. Make the script executable chmod +x /path/to/amazon-bash-wifi.sh
  2. Add @reboot /path/to/amazon-bash-wifi.sh to your crontab

My weird purchase of a Dash Button

I bought a Dash Button for £4.99 not knowing that you were limited to the product the sticker shows (I bought it judging on the best available logo, which turned out to be Ariel). As I am a student I cannot actually afford the luxury of Ariel washing capsules but on the other hand as I am a Computer Science Student I could have done with Listerine 😉. Anyway I told this to amazon who refunded me the £4.99 immediately and when I asked twice if I needed to do anything more (i.e. return the device) they changed the subject. So now I have a free doorbell. Thank you Amazon.