Skip to content

Instantly share code, notes, and snippets.

@redaphid
Last active August 29, 2015 14:28
Show Gist options
  • Save redaphid/4f150902689a754101a9 to your computer and use it in GitHub Desktop.
Save redaphid/4f150902689a754101a9 to your computer and use it in GitHub Desktop.
Dash button
#!/usr/bin/node
var request = require('request');
var arpListener = require('arp-listener')
var _ = require('lodash');
var throttledTrigger = _.throttle(trigger, 5000);
arpListener('wlan0', function(arpData) {
console.log(arpData.sender_ha);
if(arpData.sender_ha !== '80:37:73:f4:b7:fa') {
return;
}
console.log('Button Pushed!');
throttledTrigger();
})
function trigger() {
request.post('https://triggers.octoblu.com/flows/502cf4fb-6a5b-43d3-931b-3ae9103b7d3d/triggers/4e64abe0-49ef-11e5-a27a-eddc49e8c6f7', {form: {hello: true}});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment