mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
add sms_changed to pushbullet handler
This commit is contained in:
parent
34262e2fb0
commit
ea729546d4
@ -3,9 +3,7 @@ module.exports = function(RED) {
|
||||
"use strict";
|
||||
var PushBullet = require('pushbullet');
|
||||
var fs = require('fs');
|
||||
var util = require('util');
|
||||
var when = require('when');
|
||||
var nodefn = require('when/node');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
function onError(err, node) {
|
||||
@ -129,7 +127,7 @@ module.exports = function(RED) {
|
||||
if (!closing) {
|
||||
tout = setTimeout(function() {
|
||||
stream.connect();
|
||||
},15000);
|
||||
}, 15000);
|
||||
}
|
||||
});
|
||||
stream.on('error', function(err) {
|
||||
@ -137,7 +135,7 @@ module.exports = function(RED) {
|
||||
if (!closing) {
|
||||
tout = setTimeout(function() {
|
||||
stream.connect();
|
||||
},15000);
|
||||
}, 15000);
|
||||
}
|
||||
});
|
||||
stream.connect();
|
||||
@ -229,10 +227,14 @@ module.exports = function(RED) {
|
||||
msg.payload = incoming.body;
|
||||
}
|
||||
else if (incoming.type === 'dismissal') {
|
||||
msg.topic = "dismissal";
|
||||
msg.topic = "Push dismissed";
|
||||
msg.payload = incoming.iden;
|
||||
}
|
||||
else if (incoming.type === 'sms_changed') {
|
||||
msg.topic = "SMS: "+ incoming.notifications[0].title;
|
||||
msg.payload = incoming.notifications[0].body;
|
||||
msg.message = incoming;
|
||||
}
|
||||
else {
|
||||
this.error("unknown push type: " + incoming.type + " content: " + JSON.stringify(incoming));
|
||||
return;
|
||||
@ -257,8 +259,7 @@ module.exports = function(RED) {
|
||||
try {
|
||||
pushkeys = RED.settings.pushbullet || require(process.env.NODE_RED_HOME+"/../pushkey.js");
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
catch(err) { }
|
||||
|
||||
var cred = RED.nodes.getCredentials(n.id);
|
||||
// get old apikey
|
||||
@ -327,7 +328,7 @@ module.exports = function(RED) {
|
||||
try {
|
||||
this.deviceid = this.credentials.deviceid;
|
||||
}
|
||||
catch(err) {}
|
||||
catch(err) { }
|
||||
}
|
||||
|
||||
if (configNode) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-pushbullet",
|
||||
"version" : "0.0.14",
|
||||
"version" : "0.0.15",
|
||||
"description" : "A Node-RED node to send alerts via Pushbullet",
|
||||
"dependencies" : {
|
||||
"pushbullet": "^2.4.0",
|
||||
|
Loading…
Reference in New Issue
Block a user