Skip to content

Instantly share code, notes, and snippets.

@mattclements
Created January 8, 2017 09:37
Show Gist options
  • Save mattclements/3deaf5fde14cad9e402628683bc2fd0e to your computer and use it in GitHub Desktop.
Save mattclements/3deaf5fde14cad9e402628683bc2fd0e to your computer and use it in GitHub Desktop.
Doorbell
function send_pushover_notification() {
var push = require( 'pushover-notifications' );
var p = new push( {
user: "xxxx",
token: "xxxx"
});
var msg = {
message: "Somebody is at the door!",
title: "Doorbell",
sound: 'pushover',
priority: 1
};
p.send( msg, function( err, result ) {
if ( err ) {
return false;
}
if(result.status == 1) {
return true;
}
});
return false;
}
var dash_button = require('node-dash-button'),
dash = dash_button('xx:xx:xx:xx:xx:xx'), //REPLACE WITH YOUR ADDRESS
exec = require('child_process').exec;
dash.on('detected', function() {
console.log('Button pushed!');
send_pushover_notification();
});
console.log('Ready');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment