Tracking migraines and the world of the Internet of Things

I recently read a post by Ted Benson titled, How I Hacked Amazon’s $5 WiFi Button to track Baby Data, where he sniffs for the ARP request of an Amazon Dash Button to log data. The Amazon Elements Dash button cost only $4.99 so I ordered one immediately.

My idea is to use it to track when I have migraines to better pinpoint things that trigger it. Usually when I get a migraine I am not keen on trying to write it down (although I should) so I thought this may be an easy way to do it. Just press a button!

Once I received my button I started adapting Ted's code. The CloudStich service is incredibly easy to use! I signed up for an account, got a personal URL, and was ready to log information to Google spreadsheets!

Getting the Code to Run:
My biggest hurdle was getting requisite Python libraries installed on my Macbook Pro. To intercept network traffic for the Dash button, Python uses the the Scapy library.

from scapy.all import *

Even after installing scapy, when I tried to import it, I got an error:

import pcapy as pcap ImportError: No module named pcapy
I installed pcap only to get another error for missing the dnet library. Attempting to install it using pip failed to I thought I'd try my favorite package manager, HomeBrew.

 $ brew search dnet  
 libdnet wordnet  
   
 $ brew install libdnet  
 ==> Downloading https://homebrew.bintray.com/bottles/libdnet-1.12.yosemite.bottle.2.tar.gz  
 ######################################################################## 100.0%  
 ==> Pouring libdnet-1.12.yosemite.bottle.2.tar.gz  
 ==> Caveats  
   
 Python modules have been installed and Homebrew's site-packages is not  
 in your Python sys.path, so you will not be able to import the modules  
 this formula installed. If you plan to develop with these modules,  
 please run:  
  mkdir -p /Users/me/Library/Python/2.7/lib/python/site-packages  
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/me/Library/Python/2.7/lib/python/site-packages/homebrew.pth  
 ==> Summary  
 🍺 /usr/local/Cellar/libdnet/1.12: 28 files, 476K  
   

Once I got dnet installed, I also had to run it as root. This is not a big deal for me, but may be a roadblock for some that do not have superuser privileges on their machines.

My next dash button may be put in my mailbox and linked with Pushover.



Comments

Popular posts from this blog

Using Audacity as an Oscilloscope

Using Google Command Line Tools to post my Computer Systems Notes

Ping utility that targets a specific port