node package manager



NPM version Dependency Status Build Status XO code style License

Publish dash button presses to a MQTT broker. 🔘📡

Based on node-dash-button by Alex Hortin - all credits belong to him.

Getting started

Tested on macOS and Linux. If you're running on Linux you have to install libpcap-dev:

  • Ubuntu, Debian, Raspbian, ... $ sudo apt-get install libpcap-dev
  • Fedora, CentOS $ sudo yum install libpcap-devel


Prerequisite: Node.js version 6.0 or above. I suggest to use to install a recent version of Node.js.

$ sudo npm install -g dashbutton2mqtt

Find dash buttons

$ sudo dashbutton2mqtt --scan

The scan shows only MAC Addresses that are known to be registered by Amazon. If you want to see all detected addresses add the option -v debug.

Create a JSON mapping file

Create a JSON file that maps dash button mac addresses to MQTT topics and payloads.


    "50:f5:da:60:20:10": {
        "topic": "dashbutton/foo"
    "50:f5:da:60:20:11": {
        "topic": "dashbutton/bar",
        "payload": "press"

If you omit the payload attribute an empty string will be published.


$ sudo dashbutton2mqtt -m /path/to/mapping.json


  • Since node-dash-button uses libpcap to scan for dash button arp packets this tool must be run with superuser.
  • This tool has to be executed on a host that is connected to the same wifi network as the dash buttons.
  • Due to the nature of the dash buttons there will be a latency of ~4 seconds between a button press and the MQTT publish.
  • As long as the LED of the dash button is blinking you can't do further button presses.

Binding To Specific Network Interface

By default this tool binds to the first network interface. To bind to a specific interface, such as eth6, pass the name of the interface with the --interface option.

Adjusting the Timeout

If multiple presses are detected you can increase the timeout between presses. Default is 5000ms, depending on your network this may not be enough, you can set a higher timeout with the --timeout option.

Command line options

Usage: dashbutton2mqtt [options]

  -v, --verbosity  possible values: "error", "warn", "info", "debug"
                                                               [default: "info"]
  -s, --scan       scan for dash buttons
  -m, --mapping    json file containing dashbutton-mqtt mappings (see Readme)
         [default: "/Users/basti/WebstormProjects/dashbutton2mqtt/example.json"]
  -n, --name       instance name. used as mqtt client id and as prefix for
                   connection topic                      [default: "dashbutton"]
  -u, --url        mqtt broker url. See
                                                   [default: "mqtt://"]
  -i, --interface  bind to network interface to listen for dash button presses
                                                                 [default: null]
  -p, --protocol   protocol to use for button detection. possible values: "arp",
                   "udp", "all"                                 [default: "all"]
  -t, --timeout    timeout between button presses.               [default: 5000]
  -h, --help       Show help                                           [boolean]
  --version        Show version number                                 [boolean]

Run as service

I suggest PM2 to run dashbutton2mqtt in the background and start on system boot.


Pull requests welcome! 😀


MIT © Sebastian Raff