From d913171f40eb4b87fd5e4964972a66198bdfbb08 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sat, 20 Aug 2022 18:56:34 +0100 Subject: [PATCH] Pushbullet - Fix sms missing notifications issue to close #936 --- social/pushbullet/57-pushbullet.js | 13 +++++++++---- social/pushbullet/package.json | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/social/pushbullet/57-pushbullet.js b/social/pushbullet/57-pushbullet.js index 7e6f0ba1..b2068edb 100644 --- a/social/pushbullet/57-pushbullet.js +++ b/social/pushbullet/57-pushbullet.js @@ -221,8 +221,14 @@ module.exports = function(RED) { msg.payload = incoming.iden; } else if (incoming.type === 'sms_changed') { - msg.topic = "SMS: "+ incoming.notifications[0].title; - msg.payload = incoming.notifications[0].body; + if (incoming.notifications && incoming.notifications.length > 0) { + msg.topic = "SMS: "+ incoming.notifications[0].title; + msg.payload = incoming.notifications[0].body; + } + else { + msg.topic = "SMS: "; + msg.payload = ""; + } msg.message = incoming; } else { @@ -244,12 +250,11 @@ module.exports = function(RED) { function PushbulletOut(n) { RED.nodes.createNode(this, n); - var self = this; - this.title = n.title; this.chan = n.chan; this.pushtype = n.pushtype; this.pusher = null; + var self = this; var configNode; diff --git a/social/pushbullet/package.json b/social/pushbullet/package.json index 6054b93d..a7f2f337 100644 --- a/social/pushbullet/package.json +++ b/social/pushbullet/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pushbullet", - "version" : "0.0.17", + "version" : "0.0.19", "description" : "A Node-RED node to send alerts via Pushbullet", "dependencies" : { "pushbullet": "^2.4.0",