diff --git a/nodes/social/57-prowl.html b/nodes/social/57-prowl.html index d7a870854..6a897f79e 100644 --- a/nodes/social/57-prowl.html +++ b/nodes/social/57-prowl.html @@ -32,8 +32,10 @@ diff --git a/nodes/social/57-prowl.js b/nodes/social/57-prowl.js index 4874eaa49..675fead36 100644 --- a/nodes/social/57-prowl.js +++ b/nodes/social/57-prowl.js @@ -16,17 +16,23 @@ var RED = require("../../red/red"); var Prowl = require('node-prowl'); +var util = require('util'); -// pushkey.js just needs to be like (with the quotes) -// module.exports = {prowl:'My-API-KEY'} +// Either add a line like this to settings.js +// prowl: {prowlkey:'My-API-KEY'}, +// or create pushkey.js in dir ABOVE node-red, it just needs to be like +// module.exports = {prowlkey:'My-API-KEY'} try { var pushkey = require("../../settings").prowl || require("../../../pushkey.js"); -} catch(err) { - throw new Error("Failed to load Prowl credentials"); +} +catch(err) { + util.log("[57-prowl.js] Error: Failed to load Prowl credentials"); } -var prowl = new Prowl(pushkey.prowl); +if (pushkey) { + var prowl = new Prowl(pushkey.prowlkey); +} function ProwlNode(n) { RED.nodes.createNode(this,n); @@ -41,14 +47,19 @@ function ProwlNode(n) { if (typeof(msg.payload) == 'object') { msg.payload = JSON.stringify(msg.payload); } - try { - prowl.push(msg.payload, titl, { priority: pri }, function( err, remaining ){ - if ( err ) node.error(err); - node.log( remaining + ' calls to Prowl api during current hour.' ); - }); + if (pushkey) { + try { + prowl.push(msg.payload, titl, { priority: pri }, function(err, remaining) { + if (err) node.error(err); + node.log( remaining + ' calls to Prowl api during current hour.' ); + }); + } + catch (err) { + node.error(err); + } } - catch (err) { - node.error(err); + else { + node.warn("Prowl credentials not set/found. See node info."); } }); } diff --git a/nodes/social/57-pushbullet.html b/nodes/social/57-pushbullet.html index 1d082d92e..320202970 100644 --- a/nodes/social/57-pushbullet.html +++ b/nodes/social/57-pushbullet.html @@ -16,13 +16,9 @@