Skip to content

Instantly share code, notes, and snippets.

@capndesign
Last active April 7, 2017 08:49
Show Gist options
  • Save capndesign/36f1ee72016908106a89 to your computer and use it in GitHub Desktop.
Save capndesign/36f1ee72016908106a89 to your computer and use it in GitHub Desktop.
Connecting a Dash Button to IFTTT

Earlier in the week, I saw a Medium piece about using Dash buttons as a cheap connected device, and decided to play with it. I decided the most flexible solution was to wire it to IFTTT, so I did that.

He has instructions, but here’s what I did.

  1. Create a virtualenv and install Scapy.
  2. Then install Requests.
  3. Follow the instructions on Medium to get the MAC address of your device.
  4. Learn how to use the Maker channel and create a URL for this trigger.
  5. Modify your dash-button.py file to match the one below and fill in the right information.
  6. Create an IFTTT recipe and go to town.
from scapy.all import *
import requests
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
print "aye"
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
if pkt[ARP].hwsrc == '{MAC ADDRESS OF BUTTON}':
r = requests.post("https://maker.ifttt.com/trigger/{event_name}/with/key/{secret_key}")
print r
print sniff(prn=arp_display, filter="arp", store=0, count=30)
@masteruan
Copy link

This is my result... <Sniffed: TCP:0 UDP:0 ICMP:0 Other:0>

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