UP  |  HOME

Amazon Dash

Table of Contents

Device Setup

Setup the dash with amazon's app, but don't associate it with any item. Amazon no longer offers device configuration. The following method might still work, but I haven't tested on a new device.

Reattaching to wifi

In absence of Amazon Servers, the v2 dash can be ‘re-enrolled’ to wifi if the key is held down. It’s not really reset, it only loses wifi setup. Connect your phone to the ConfigureMe AP the v2 provides during setup, and open the following URL to re-pair WiFi: http://192.168.0.1/?amzn_ssid=SSID&amzn_pw=PASSWORD

Block the Dash's Internet Access

(Steps below based on Frontier FiOS-G100 router)

  1. Navigate to Advanced > Network Settings > Network Objects
  2. Add an object with type "MAC Address" and set it to the dash's MAC. (divine the dash MAC from your router's dhcp records). Mac Mask should be left as all FF.
  3. Navigate to Firewall > Access Control
  4. Add a rule and select your object from the device dropdown. Leave protocol as "Any" and when as "Always". End result should appear as:

dash_acl.png

Handle button presses with a python script

Create a systemd service

Listing 1: /etc/systemd/system/dash.service
[Unit]
Description=Dash MPD Play Toggle
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python3 /usr/local/bin/dash.py
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

Create a python script to run whatever command (mpc to toggle music play/pause in this example).

MAC_ADDRESS and MPD_HOST should be set accordingly.

Listing 2: /usr/local/bin/dash.py
#!/usr/bin/python3
from scapy.all import *
import subprocess
import datetime

MAC_ADDRESS = 'fa:ke:ma:ca:dd:rs'
MPD_HOST = 'password@localhost'
now = datetime.datetime.now()

def detect_button(pkt):
    global now
    if pkt.haslayer(DHCP) and pkt[Ether].src == MAC_ADDRESS and datetime.datetime.now() > now + datetime.timedelta(seconds=2):
        print("Button Press Detected")
        subprocess.Popen(['mpc', '--host', MPD_HOST, 'toggle'], shell=False)
        now = datetime.datetime.now()

sniff(prn=detect_button, filter="(udp and (port 67 or 68))", store=0)