Dash2Alexa - Amazon Alexa Audio API Access

March 12, 2018

Since I got my first Amazon Echo end of last year, I love it. And although, as a typical German, I’m still a bit concerned about data privacy, at the end, convenience wins (as always :). There are many things which work flawlessly, and to be honest, the most used feature for me is a simple timer. But when it comes to aggregate actions, Alexa is still quite limited. Ok, you can define your routines, but for only an insufficient set of fixed actions. What I really would love to have is to start the radio when I get up in the morning, but this is not possible at the moment.

So I remembered my last years Amazon Dash button hacks and thought it would be cool to combine both, the Dash button and Alexa.

And here it is, my weekend hack …..

In a nutshell, the setup looks like:

  • Configure your router to not forward packets from your Dash Button.
  • Spoof on ARP requests for the Dash button’s MAC.
  • If found, call out to a text-to-speech service to convert configured Alexa commands to audio.
  • Play the received audio output via RaspberryPi attached speakers.

That’s it. You can use this sample code for doing the dirty work, but maybe you are interested in some more details.

Amazon Dash Button

Amazon Dash Button is part of Amazon’s consumer goods ordering service. This button contains a Wifi sender and is quite inexpensive. Each button is specific for a brand for which you can connect to a specific good. When you press the button, this good is ordered (e.f. 24 cans of beer ;-)

But this intended use case is not the only way how you can use this button. In fact, it can be used just as a plain Wifi button for any purpose.

First of all, you have to buy such a button e.g. 5 Euro here in Germany, but you can spend this five bucks for your first order. You just configure it as described by Amazon and maybe order something to spend your credits.

After this, you have to block the button in your home Wifi router for calling out to the internet. For obvious reasons, this is very important ;-) When the button is blocked, it will flash red eventually when being pressed (in contrast to flashing green when an order is placed).

When you press the button, it first asks via DHCP for an IP address. The MAC address of the button is relevant, so its time to pick that up, e.g.

  • By looking into your DHCP servers log
  • By trying arp -a
  • By checking your Wifi Router’s admin UI
  • Via Wireshark spoofing

This Mac address will be watched for later by spoofing ARP package traffic. When golang is your preferred programming language, then you can use directly rhuss/dash which is based on top of gopacket to watch for certain ARP packages and trigger an action when received.

Amazon Polly API access

In our use case, when we detect that a button is pressed, then we want to send out some fixed, text-based audio. For converting text coming from a configuration, a text-to-speech service is used.

There are several such services available. For our purpose, we are using Amazon Polly, which offers a free tier for the first 12 months (including 5 million characters per month, fair enough for a handful of buttons ;-) and then 4 $ per one million of chars.

A short cost calculation beyond the free tier: 100 characters for Alexa commands per button press (which is already quite a mouthful) costs ~ 0.4 cents. Or the other way round, for five bucks you can press the button 1.250 times: Three times a day per yeare for 5 $ Well, for me that’s worth the fun ;-)

You need an AWS account to access the speech API. The access and secret token can be either that of your root AWS account, or you probably should create a dedicated IAM User.

Of course, you can also use different text-to-speech tool. Maybe even the good old Unix speak will do it ? Not tried it yet, but will check that for sure very soonish. For now, the Polly voices are recognised quite well by my echo so that I won’t change it right now.

Raspberry Pi Audio

The final jigsaw piece is the hardware on which to run the watcher. For my use case, a Raspberry Pi 2 with some inexpensive speakers was totally good enough.

dash2alexa command

The dash2alexa command actually takes a configuration file (defautl: ~/.dash2alexa.yml)

# Sample configuration file for dash2alexa
# Adapt and copy it to ~/.dash2alexa.yml

# Access and secret for accessing the services
access: ".........."
secret: ".........."

# Network interface to listen for ARP requests when a Dash button is pressed
interface: "wlan0"

# Language ("de" or "en")
language: "de"

# Gender which can be either "male" or "female"
gender: "male"

# Keyword to use for alexa
keyword: "Alexa"

# Player to use when playing an mp3 sound file
player: "mpeg123"

# List of Dash Buttons with associated Alexa command
  # Symbolic name
- name: "heineken"
  # Mac adress of Dash button
  mac: "ac:63:be:00:11:22"
  # How many seconds to wait between Alexa commands
  wait: 4

  # Messages to talk
    - "Lautstärke 4"
    - "Spiele Bayern 3"

There’s not much documentation yet, but some will follow soon. Feel free to adapt the code, and I’m happy to integrate any pull requests. Also, as I’m a bloody golang greenhorn still, would be curious whether things could be done better.


This little hack uses Amazon Echo via its ‘Audio API’ to perform specific action on a button press. It’s entirely suited for a situation when its calm around, like putting the button right beside the bed for getting started even when your Echo is out of sight.

And finally, it’s just pure fun ;-) Enjoy!

P.S. Let me know in the comments whether you tried it out, too and how it works for you.