How it works:
The build from Medium involved listening for ARP traffic on the local WiFi network and running code associated with the known MAC address of the Dash Button. What I did instead was to use a Raspberry Pi to create a WAP and poll the wicd daemon logs for WiFi association beacons from the Dash Button using logtail in a simple Bash ‘daemon’ running on the Pi. The script attempts to execute a program named as the corresponding MAC address it detects in a given directory, making it easy to bind new code to a given Dash button. An advantage of this is that I can write the triggered program in any language, since the Bash script simply forks and runs whatever program is present.
In the case above, my Dash button simply writes a character to the serial device corresponding to my Arduino, telling it to strobe the LED strip in a different mode based on the Arduino sketch I programmed.
At AWS re:Invent last week I got my hands on a custom Dash Button produced by their IoT Team that will call Lambda functions directly, removing the necessity to capture network events at all! How cool is that?
I’ll provide sources on Github shortly. Comment with any questions!