Amazon Dash Doorbell

Recently, Amazon dash buttons came on sale. After reading many tutorials out there, I succumbed and decided to ‘hack’ it. Which is another fancy way of saying I used it for something other than intended. I’ll tell you how I did it and hopefully it will be easy for you to do. Let me know what other creative uses you find for them!

This is what I used:

  • 1 x Dash Button
  • 1 x Raspberry Pi

This is what we will be doing:

  1. Register the button on Amazon
  2. Block the dash button at the router
  3. Setup a script that allows you to read the network for dash button presses and takes further action
  4. Setup a script that sends me a message when the button is pressed

Register the button on Amazon

You will need the amazon app on your phone. Here are the instructions. Follow them until you get to where you have to select a product. Instead, just exit out of the app.

At this point your dash button is configured to your wifi.

Block the dash button at the router

Because we exited out of the app, every time you push the button, we will get a notification stating that we haven’t fully configured the button. This can be avoided if we block the button from reaching the internet. Check your router’s settings for a firewall. I blocked mine by using the MAC address.

To get the mac address for your dash button, hold it down until the LED is blue. This will create a ‘hotspot’ that you can connect to. Using your phone, look for wifi networks and find “Amazon Configure me”.

Connect to it and navigate to http://192.168.0.1 on your browser. From here, you can see your mac address.

 

Setup a script that allows you to read the network for dash button presses and takes further action

Although this seems like it would be hard, thanks to Nemko and their Amazon dash script, this is super easy. This assumes you have a Raspberry pi or some other debian linux machine in your network. The steps are super simple.

To install, do this:

$ sudo pip install amazon-dash
$ sudo python -m amazon_dash.install

After that, open /etc/amazon-dash.yml. Make sure to follow the example and use the MAC address you obtained from the previous steps. Put your MAC address into the .yml file and under cmd put in the name of the script you will be creating. In my case I put it under /home/pi/pythonScripts/doorbell/doorbell.py.

Setup a script that sends me a message when the button is pressed

Let’s now create the doorbell.py script.


#!/usr/bin/env python3
import requests, smtplib

# --------- User Settings ---------
gmail_user = 'email@gmail.com'
gmail_password = ''
gmail_recipients = ['@tmomail.net']
CHAT_ID = ""
BOT_TOKEN = ""
TELEGRAM_URL = "https://api.telegram.org/bot"+BOT_TOKEN+"/"
# ---------------------------------

method = "sendMessage"
text = "Ding Dong! Someone is at the door!"
payload = {"chat_id" : CHAT_ID, "text": text}
r = requests.post(url=TELEGRAM_URL+method,json=payload)


sent_from = gmail_user
to = gmail_recipients
subject = 'Ding Dong! There is someone at the door!'
body = 'Sent from House Botler'

email_text = """\
From: %s
To: %s
Subject: %s

%s
""" % (sent_from, ", ".join(to), subject, body)

try:
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.ehlo()
server.login(gmail_user, gmail_password)
server.sendmail(sent_from, to, email_text)
server.close()

print('Email sent!')
except:
print('Something went wrong...')

 

For this you will have to get:

  1. Google app password
  2. Telegram bot token

Trying it out

When your press the button, the raspberry pi should detect the dash button on the network and execute your script. In my case I get a notification via telegram. My wife gets an SMS message! In the future, I plan to get more creative once Amazon decides to open up the notification API for Alexa.

Let me know what you guys think!

Leave a Reply

Your email address will not be published.