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";
|
"use strict";
|
||||||
var PushBullet = require('pushbullet');
|
var PushBullet = require('pushbullet');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var util = require('util');
|
|
||||||
var when = require('when');
|
var when = require('when');
|
||||||
var nodefn = require('when/node');
|
|
||||||
var EventEmitter = require('events').EventEmitter;
|
var EventEmitter = require('events').EventEmitter;
|
||||||
|
|
||||||
function onError(err, node) {
|
function onError(err, node) {
|
||||||
@ -129,7 +127,7 @@ module.exports = function(RED) {
|
|||||||
if (!closing) {
|
if (!closing) {
|
||||||
tout = setTimeout(function() {
|
tout = setTimeout(function() {
|
||||||
stream.connect();
|
stream.connect();
|
||||||
},15000);
|
}, 15000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stream.on('error', function(err) {
|
stream.on('error', function(err) {
|
||||||
@ -137,7 +135,7 @@ module.exports = function(RED) {
|
|||||||
if (!closing) {
|
if (!closing) {
|
||||||
tout = setTimeout(function() {
|
tout = setTimeout(function() {
|
||||||
stream.connect();
|
stream.connect();
|
||||||
},15000);
|
}, 15000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stream.connect();
|
stream.connect();
|
||||||
@ -229,10 +227,14 @@ module.exports = function(RED) {
|
|||||||
msg.payload = incoming.body;
|
msg.payload = incoming.body;
|
||||||
}
|
}
|
||||||
else if (incoming.type === 'dismissal') {
|
else if (incoming.type === 'dismissal') {
|
||||||
msg.topic = "dismissal";
|
|
||||||
msg.topic = "Push dismissed";
|
msg.topic = "Push dismissed";
|
||||||
msg.payload = incoming.iden;
|
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 {
|
else {
|
||||||
this.error("unknown push type: " + incoming.type + " content: " + JSON.stringify(incoming));
|
this.error("unknown push type: " + incoming.type + " content: " + JSON.stringify(incoming));
|
||||||
return;
|
return;
|
||||||
@ -257,8 +259,7 @@ module.exports = function(RED) {
|
|||||||
try {
|
try {
|
||||||
pushkeys = RED.settings.pushbullet || require(process.env.NODE_RED_HOME+"/../pushkey.js");
|
pushkeys = RED.settings.pushbullet || require(process.env.NODE_RED_HOME+"/../pushkey.js");
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) { }
|
||||||
}
|
|
||||||
|
|
||||||
var cred = RED.nodes.getCredentials(n.id);
|
var cred = RED.nodes.getCredentials(n.id);
|
||||||
// get old apikey
|
// get old apikey
|
||||||
@ -327,7 +328,7 @@ module.exports = function(RED) {
|
|||||||
try {
|
try {
|
||||||
this.deviceid = this.credentials.deviceid;
|
this.deviceid = this.credentials.deviceid;
|
||||||
}
|
}
|
||||||
catch(err) {}
|
catch(err) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configNode) {
|
if (configNode) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-pushbullet",
|
"name" : "node-red-node-pushbullet",
|
||||||
"version" : "0.0.14",
|
"version" : "0.0.15",
|
||||||
"description" : "A Node-RED node to send alerts via Pushbullet",
|
"description" : "A Node-RED node to send alerts via Pushbullet",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"pushbullet": "^2.4.0",
|
"pushbullet": "^2.4.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user