Created
January 8, 2017 09:37
-
-
Save mattclements/3deaf5fde14cad9e402628683bc2fd0e to your computer and use it in GitHub Desktop.
Doorbell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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