mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Pushover, add support for url and url_title
to close #240 Thanks @eisbehr
This commit is contained in:
parent
f63d8d6343
commit
735f610730
@ -55,6 +55,14 @@
|
|||||||
<option>none</option>
|
<option>none</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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">
|
<div class="form-row">
|
||||||
<label for="node-input-deviceid"><i class="fa fa-user"></i> User key</label>
|
<label for="node-input-deviceid"><i class="fa fa-user"></i> User key</label>
|
||||||
<input type="text" id="node-input-deviceid">
|
<input type="text" id="node-input-deviceid">
|
||||||
@ -76,8 +84,9 @@
|
|||||||
|
|
||||||
<script type="text/x-red" data-help-name="pushover">
|
<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>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>
|
<p>Optionally uses <code>msg.topic</code> to set the title, <code>msg.device</code> to set the device,
|
||||||
to set the priority, and <code>msg.sound</code> to set a named sound, if not already set in the properties.</p>
|
<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>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>
|
<p>Uses Pushover. See <i><a href="https://pushover.net" target="_new">this link</a></i> for more details.</p>
|
||||||
</script>
|
</script>
|
||||||
@ -90,7 +99,9 @@
|
|||||||
device: {value:""},
|
device: {value:""},
|
||||||
title: {value:""},
|
title: {value:""},
|
||||||
priority: {value:0},
|
priority: {value:0},
|
||||||
sound: {value:""}
|
sound: {value:""},
|
||||||
|
url: {value:""},
|
||||||
|
url_title: {value:""},
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
deviceid: {type:"text"},
|
deviceid: {type:"text"},
|
||||||
|
@ -48,6 +48,8 @@ module.exports = function(RED) {
|
|||||||
var pri = this.priority || msg.priority || 0;
|
var pri = this.priority || msg.priority || 0;
|
||||||
var dev = this.device || msg.device;
|
var dev = this.device || msg.device;
|
||||||
var sound = this.sound || msg.sound || null;
|
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 (isNaN(pri)) {pri=0;}
|
||||||
if (pri > 2) {pri = 2;}
|
if (pri > 2) {pri = 2;}
|
||||||
if (pri < -2) {pri = -2;}
|
if (pri < -2) {pri = -2;}
|
||||||
@ -65,6 +67,8 @@ module.exports = function(RED) {
|
|||||||
};
|
};
|
||||||
if (dev) { pushmsg.device = dev; }
|
if (dev) { pushmsg.device = dev; }
|
||||||
if (typeof(sound) === 'string') { pushmsg.sound = sound; }
|
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));
|
//node.log("Sending "+JSON.stringify(pushmsg));
|
||||||
pusher.send( pushmsg, function(err, response) {
|
pusher.send( pushmsg, function(err, response) {
|
||||||
if (err) { node.error("Pushover Error: "+err); }
|
if (err) { node.error("Pushover Error: "+err); }
|
||||||
|
@ -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
|
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.
|
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.
|
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.
|
Uses Pushover. See <a href="https://pushover.net" target="_new">Pushover.net</a> for more details.
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-pushover",
|
"name" : "node-red-node-pushover",
|
||||||
"version" : "0.0.7",
|
"version" : "0.0.8",
|
||||||
"description" : "A Node-RED node to send alerts via Pushover",
|
"description" : "A Node-RED node to send alerts via Pushover",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"pushover-notifications" : "0.2.2"
|
"pushover-notifications" : "~0.2.3"
|
||||||
},
|
},
|
||||||
"repository" : {
|
"repository" : {
|
||||||
"type":"git",
|
"type":"git",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user