<div dir="ltr">Pete, <div><br></div><div>Have you seen this method that simply relies on the ARP requests by MAC address? Similar to where you are heading, but this is already complete and appears ready to use....<br><br><a href="https://familab.org/2016/02/hacking-the-amazon-dash-button-to-make-a-simple-cheap-iot-place-anywhere-networked-button-3/">https://familab.org/2016/02/hacking-the-amazon-dash-button-to-make-a-simple-cheap-iot-place-anywhere-networked-button-3/</a><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 23, 2016 at 4:02 PM, Pete Soper via TriEmbed <span dir="ltr"><<a href="mailto:triembed@triembed.org" target="_blank">triembed@triembed.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">OK, after wading through some cosmically complex implementations of "detect the button push" and finding the trivial Python program of the seminal how-to involving baby diaper use only works in my house for the very first button press, I wondered if these things would respond to pings while they're winking and blinking. They do. Then I wondered if they remember to request the same IP address over and over. They do. So, in my house, where the DHCP environment is very stable for the main LAN, I can arrange for a completely reliable mapping of button to IP address. So I can just use the shell script below for a trivial means of detecting a button. The script puts no measurable load on the computer I tried it on. I'm arranging a proper scheme that keys off MAC addresses to be immune to DHCP behavior using arpalert, but in the meantime I thought the group might find this script amusing. (I'll publish the arpalert-based scheme when I've worked out some patches to that code to get a few issues out of my face and some utilities to automate the process a bit).<br>
<br>
To use this little script I I set up a button as usual and either use the diaper-logger's Python script or simply look at the router's admin interface to see the IP address dispensed. I then put that in my /etc/hosts file with a name and use that in the script below. Making this script general (e.g. taking the IP and text/action as parameters) would of course be the next step with this approach. Anyway, this script might be of interest to folks that just want to play vs installing scapy or a hundred Javascript modules. I' about 99 3/4% sure this would work on Windows using Cygwin.<br>
<br>
One interesting side effect of setting up a bunch of buttons is that my phone is simply filled with reminders about the fact that I never selected a product for each button. So I would add to the usual instructions out on the net "after setting up the last button, uninstall the Amazon app!"<br>
<br>
#!/bin/sh<br>
<br>
while [ /bin/true ] ; do<br>
<br>
  ping -w 1 -c 1 gatorade1 >/dev/null 2>&1<br>
<br>
  if [ $? -eq 0 ] ; then<br>
<br>
    echo "You can get your own Gatorade" | espeak --stdin<br>
<br>
    # make sure we don't double trigger<br>
<br>
    sleep 10<br>
<br>
  fi<br>
<br>
done<br>
<br>
<br>
-Pete<br>
<br>
_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" rel="noreferrer" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://TriEmbed.org" rel="noreferrer" target="_blank">http://TriEmbed.org</a><br>
</blockquote></div><br></div>