Pushover, add support for url and url_title

to close #240
Thanks @eisbehr
This commit is contained in:
Dave Conway-Jones 2016-10-17 22:56:24 +01:00
parent f63d8d6343
commit 735f610730
4 changed files with 24 additions and 5 deletions

View File

@ -55,6 +55,14 @@
<option>none</option>
</select>
</div>
<div class="form-row">
<label for="node-input-url"><i class="fa fa-link"></i> URL</label>
<input type="text" id="node-input-url" placeholder="optional url">
</div>
<div class="form-row">
<label for="node-input-url_title"><i class="fa fa-anchor"></i> URL title</label>
<input type="text" id="node-input-url_title" placeholder="optionas url title">
</div>
<div class="form-row">
<label for="node-input-deviceid"><i class="fa fa-user"></i> User key</label>
<input type="text" id="node-input-deviceid">
@ -76,8 +84,9 @@
<script type="text/x-red" data-help-name="pushover">
<p>Uses Pushover to push the <code>msg.payload</code> to a device that has the Pushover app installed.</p>
<p>Optionally uses <code>msg.topic</code> to set the title, <code>msg.device</code> to set the device, <code>msg.priority</code>
to set the priority, and <code>msg.sound</code> to set a named sound, if not already set in the properties.</p>
<p>Optionally uses <code>msg.topic</code> to set the title, <code>msg.device</code> to set the device,
<code>msg.priority</code> to set the priority, <code>msg.url</code> to add a web address and <code>msg.url_title</code>
to add a url title if not already set in the properties.</p>
<p>The User-key and API-token are stored in a separate credentials file.</p>
<p>Uses Pushover. See <i><a href="https://pushover.net" target="_new">this link</a></i> for more details.</p>
</script>
@ -90,7 +99,9 @@
device: {value:""},
title: {value:""},
priority: {value:0},
sound: {value:""}
sound: {value:""},
url: {value:""},
url_title: {value:""},
},
credentials: {
deviceid: {type:"text"},

View File

@ -48,6 +48,8 @@ module.exports = function(RED) {
var pri = this.priority || msg.priority || 0;
var dev = this.device || msg.device;
var sound = this.sound || msg.sound || null;
var url = this.url || msg.url || null;
var url_title = this.url_title || msg.url_title || null;
if (isNaN(pri)) {pri=0;}
if (pri > 2) {pri = 2;}
if (pri < -2) {pri = -2;}
@ -65,6 +67,8 @@ module.exports = function(RED) {
};
if (dev) { pushmsg.device = dev; }
if (typeof(sound) === 'string') { pushmsg.sound = sound; }
if (typeof(url) === 'string') { pushmsg.url = url; }
if (typeof(url_title) === 'string') { pushmsg.url_title = url_title; }
//node.log("Sending "+JSON.stringify(pushmsg));
pusher.send( pushmsg, function(err, response) {
if (err) { node.error("Pushover Error: "+err); }

View File

@ -19,6 +19,10 @@ Uses Pushover to push the `msg.payload` to a device that has the Pushover app in
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.
Optionally uses `msg.topic` to set the title, `msg.device` to set the device,
`msg.priority` to set the priority, `msg.url` to add a web address and `msg.url_title`
to add a url title - if not already set in the properties.
The User-key and API-token are stored in a separate credentials file.
Uses Pushover. See <a href="https://pushover.net" target="_new">Pushover.net</a> for more details.

View File

@ -1,9 +1,9 @@
{
"name" : "node-red-node-pushover",
"version" : "0.0.7",
"version" : "0.0.8",
"description" : "A Node-RED node to send alerts via Pushover",
"dependencies" : {
"pushover-notifications" : "0.2.2"
"pushover-notifications" : "~0.2.3"
},
"repository" : {
"type":"git",