Giter VIP home page Giter VIP logo

dashbutton's Introduction

Amazon Dash button

The script listen.py registers ARP-packets in the local network. If you enter the MAC of your Amazon Dash button it registers if the button is pressed. It can act on this event with a request to a ITTT webhook (ITTT maker channel) or by writing a mail using a Gmail-account.

Installation

Activate your dash button with the Amazon smartphone app. You do not need to select a product to order. The script will register if the button is pressed even if no product was selected.

The script uses scapy to sniff the ARP-packets the button sends when connecting to your wifi. Scapy is available for Python 2.7 and Python 3.x. If you want to trigger the webhook you also need requests, the mail part uses smtplib.

The script probably needs root-privileges:

sudo python listen.py

Run the script without any modification. It will list all unrecognized MAC addresses in ARP packets. Your router will answer all the packets so its mac address pops up many times. Press your button and note the MAC that pops up next. If you are unsure which one it is: it is not harmful to press the button more than once. After noting the MAC of your button and router insert those in listen.py. The addresses listed there are mine - just replace them.

Change the code so it fits your needs. For ITTT you need to change the URL for the webhook so it matches your key. If you want to mail directly change the Gmail settings in send_mail.py.

Run listen.py again. It now prints Button Pressed! every time you press your button.

dashbutton's People

Contributors

pinae avatar

Stargazers

Wynnchel Duncan avatar Jeremias Haucke avatar yourfriendcaspian avatar  avatar Alexander Melde avatar Vishnu avatar Sascha avatar  avatar Tobias Mücksch avatar

Watchers

James Cloos avatar  avatar Birko Bergt avatar  avatar  avatar

dashbutton's Issues

5s timeout not working quite as expected (anymore)

First of all thanks for the cool article. I just received two dash buttons today and tried directly the python script.

As far as I can tell the button is sending the ARP request periodically and multiple times in a pattern of 3 requests in a batch (each one second after another). After that it waits for some time and tries again sending 3 requests in a batch and does this endlessly.

Could it be that I got a newer version of the dash button where they included this 'fix' to prevent anyone from using the button for a different purpose other than ordering from amazon?

I also still didn't select the product hence I get the notification 'You're almost done ..' on my phone although this one I get only the first time so it seems like the Amazon Server is able to handle this somehow.

ARP Sniffing doesnt work for me

I get the following Error after starting the script the first time:
pi@raspberrypi:~ $ sudo python2 listen.py WARNING: No route found for IPv6 destination :: (no default route?) Listening for ARP packets... Traceback (most recent call last): File "listen.py", line 26, in <module> sniff(prn=arp_received, iface="wlan0", filter="arp", store=0, count=0) File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 586, in sniff r = prn(p) File "listen.py", line 10, in arp_received if packet[ARP].op == 1 and packet[ARP].hwdst == '00:00:00:00:00:00': File "/usr/lib/python2.7/dist-packages/scapy/packet.py", line 770, in __getitem__ raise IndexError("Layer [%s] not found" % lname) IndexError: Layer [ARP] not found

newbie questions

Ok I have a Pi Zero with Raspbian running Pi-Hole. I also have two Dash buttons and simply want to get an email when a member of my family presses a Dash rather than ordering the item from Amazon.

Couple of simple questions:

  1. I run "sudo apt-get install scapy". Correct?
  2. Does it matter where I put the dashbutton folder/files?
  3. Does the MAC of my router go into line 11?

Is that everything? I've changed the gmail account stuff to my own details of course.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.