Skip to content

Instantly share code, notes, and snippets.

Created September 28, 2019 22:32
Show Gist options
  • Save fffonion/d4960503ff6782640286163d47a30080 to your computer and use it in GitHub Desktop.
Save fffonion/d4960503ff6782640286163d47a30080 to your computer and use it in GitHub Desktop.
Setting up dash button without Amazon App
import requests
import re
import sys
# Initial work from:
h = requests.Session()
def wait_for_device():
print("* Long press the dash button until LED light blinks in blue")
print("* Connect to Wifi with SSID \"Amazon ConfigureMe\"")
print("* Waiting for connection...")
while True:
r = h.get(BASE_URL, timeout=1)
if 'Amazon Dash' in r.content:
print("+ Connected!")
content = r.content
serial = re.findall('Serial Number</th>[^/]+>([A-Z0-9_]+)</td', content, re.DOTALL)[0]
mac = re.findall('MAC Address</th>[^/]+>([A-Z0-9_]+)</td', content, re.DOTALL)[0]
firmware = re.findall('Firmware</th>[^/]+>([A-Z0-9_]+)</td', content, re.DOTALL)[0]
battery = re.findall('Battery</th>[^/]+>([A-Z0-9_]+)</td', content, re.DOTALL)[0]
print("* Serial: %s, MAC: %s, Firmware: %s, Battery: %s" % (serial, mac, firmware, battery))
return mac
def configure_wifi(ssid, password):
print("* Configure Dash button to connect to \"%s\"" % ssid)
# is the ssid in range ?
r = h.get(BASE_URL, headers={'Content-Type': 'application/json'}, timeout=5)
amzn_networks = r.json()['amzn_networks']
found = False
for amzn_network in amzn_networks:
if amzn_network['ssid'] == ssid:
found = True
if not found:
print("- SSID %s is not discoverable by Dash button" % ssid)
print("%s/?amzn_ssid=%s&amzn_pw=%s" % (BASE_URL, ssid, password))
r = h.get("%s/?amzn_ssid=%s&amzn_pw=%s" % (BASE_URL, ssid, password), timeout=5)
if r.status_code == 200:
print("+ Dash button configured!")
return True
if __name__ == '__main__':
if len(sys.argv) < 3:
configure_wifi(sys.argv[1], sys.argv[2])
except KeyboardInterrupt:
Copy link

I´ve installed old amazon app apk version wich has still the function to add new dash buttons.

I just tried the mentioned App version in the German region but no Dash menus or settings are visible to add a new button.

Copy link

  • Long press the dash button until LED light blinks in blue
  • Connect to Wifi with SSID "Amazon ConfigureMe"
  • Waiting for connection...
  • Connected!
    Traceback (most recent call last):
    File "D:\", line 60, in
    File "D:\", line 26, in wait_for_device
    serial = re.findall('Serial Number[^/]+>([A-Z0-9_]+)</td', content, re.DOTALL)[0]
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\", line 240, in findall
    return _compile(pattern, flags).findall(string)
    TypeError: cannot use a string pattern on a bytes-like object

Copy link

elysweyr commented May 5, 2023

File "D:\", line 26, in wait_for_device

You may need to append .decode('utf-8') to line 25.

Copy link

elysweyr commented May 5, 2023

I am on FW version 60019520_EU and it worked.
The problem in my case was that I had to url encode the SSID and password because it contained spaces and special characters.

Note: Don't forget to block internet access for your dash buttons otherwise they will get an OTA update and brick themselves.

Seems like my button is connection to the wireless network but isn't able to acquire a DHCP lease - odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment