So, my weekend hack project came to me in the form of a tweet. Thanks to Christian Hambly for the idea:
My weekend project set, silent doorbell! : https://t.co/rbvz34P4As
— Christian Hambly (@ChristianHambly) 7 January 2017
Cc @mattclementsuk @bseymour
Myself and my eldest set about installing Node, developing the required code mainly based upon the original article, and working with Pushover which I have already used previously for notifications, the final code looks as follows:
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'),
exec = require('child_process').exec;
dash.on('detected', function() {
console.log('Button pushed!');
send_pushover_notification();
});
console.log('Ready');
We have a server fitted in the loft which I installed Node onto, then installed PM2 in order to run the application as a service.
The eldest installed Pushover on his iPod Touch which means he knows exactly when the doorbell rings!
The final result:
Also worth considering when it comes out in the UK Amazon IOT Button