Pushbullet - Fix sms missing notifications issue

to close #936
This commit is contained in:
Dave Conway-Jones 2022-08-20 18:56:34 +01:00
parent e5e8a33d80
commit d913171f40
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 10 additions and 5 deletions

View File

@ -221,8 +221,14 @@ module.exports = function(RED) {
msg.payload = incoming.iden; msg.payload = incoming.iden;
} }
else if (incoming.type === 'sms_changed') { else if (incoming.type === 'sms_changed') {
msg.topic = "SMS: "+ incoming.notifications[0].title; if (incoming.notifications && incoming.notifications.length > 0) {
msg.payload = incoming.notifications[0].body; msg.topic = "SMS: "+ incoming.notifications[0].title;
msg.payload = incoming.notifications[0].body;
}
else {
msg.topic = "SMS: ";
msg.payload = "";
}
msg.message = incoming; msg.message = incoming;
} }
else { else {
@ -244,12 +250,11 @@ module.exports = function(RED) {
function PushbulletOut(n) { function PushbulletOut(n) {
RED.nodes.createNode(this, n); RED.nodes.createNode(this, n);
var self = this;
this.title = n.title; this.title = n.title;
this.chan = n.chan; this.chan = n.chan;
this.pushtype = n.pushtype; this.pushtype = n.pushtype;
this.pusher = null; this.pusher = null;
var self = this;
var configNode; var configNode;

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-pushbullet", "name" : "node-red-node-pushbullet",
"version" : "0.0.17", "version" : "0.0.19",
"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",