Tip: Leave title blank to set using msg.topic and msg.priority.
- Supports priorities 2, 1, 0, -1, and -2.
+
Tip: Leave title blank to set using msg.topic.
+ Leave device blank to send to all devices, or to set using msg.device.
+ Leave priority blank to set using msg.priority. Supports priorities 2, 1, 0, -1, and -2.
@@ -51,8 +57,9 @@
RED.nodes.registerType('pushover',{
category: 'output',
defaults: {
- title: {value:""},
name: {value:""},
+ device: {value:""},
+ title: {value:""},
priority: {value:0}
},
credentials: {
@@ -72,7 +79,7 @@
},
oneditprepare: function() {
$("#node-input-priority").spinner({
- min:-1,
+ min:-2,
max:2
});
}
diff --git a/social/pushover/57-pushover.js b/social/pushover/57-pushover.js
index 46badeed..9778e3fc 100644
--- a/social/pushover/57-pushover.js
+++ b/social/pushover/57-pushover.js
@@ -22,6 +22,7 @@ module.exports = function(RED) {
function PushoverNode(n) {
RED.nodes.createNode(this,n);
this.title = n.title;
+ this.device = n.device;
this.priority = n.priority;
var credentials = this.credentials;
if ((credentials) && (credentials.hasOwnProperty("pushkey"))) { this.pushkey = credentials.pushkey; }
@@ -43,6 +44,7 @@ module.exports = function(RED) {
this.on("input",function(msg) {
var titl = this.title || msg.topic || "Node-RED";
var pri = this.priority || msg.priority || 0;
+ var dev = this.device || msg.device;
if (isNaN(pri)) {pri=0;}
if (pri > 2) {pri = 2;}
if (pri < -2) {pri = -2;}
@@ -58,7 +60,8 @@ module.exports = function(RED) {
retry: 30,
expire: 600
};
- //console.log("Sending",pushmsg);
+ if (dev) { pushmsg.device = dev; }
+ //node.log("Sending "+JSON.stringify(pushmsg));
pusher.send( pushmsg, function(err, response) {
if (err) { node.error("Pushover Error: "+err); }
//console.log(response);
diff --git a/social/pushover/README.md b/social/pushover/README.md
index 3ff18ebc..b8b6cd94 100644
--- a/social/pushover/README.md
+++ b/social/pushover/README.md
@@ -16,7 +16,8 @@ Usage
Uses Pushover to push the msg.payload to a device that has the Pushover app installed.
-Optionally uses **msg.topic** to set the title, and **msg.priority** to set the priority, if not already set in the properties.
+Optionally uses **msg.topic** to set the title, **msg.device** to set the device
+and **msg.priority** to set the priority, if not already set in the properties.
The User-key and API-token are stored in a separate credentials file.
diff --git a/social/pushover/package.json b/social/pushover/package.json
index b10cb564..a3e98d44 100644
--- a/social/pushover/package.json
+++ b/social/pushover/package.json
@@ -1,6 +1,6 @@
{
"name" : "node-red-node-pushover",
- "version" : "0.0.4",
+ "version" : "0.0.5",
"description" : "A Node-RED node to send alerts via Pushover",
"dependencies" : {
"pushover-notifications" : "0.2.2"