mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Pushover TTL (#1013)
* TTL Functionality Pick up msg.ttl and pass it to REST API, checking it is a positive integer first. * Update help doc Reference ttl parameter in api docs
This commit is contained in:
parent
21b92d4894
commit
51dc002a70
@ -86,6 +86,7 @@
|
|||||||
<p><code>msg.sound</code>: set the notification sound, <i><a href="https://pushover.net/api#sounds" target="_new">see the available options</a></i></p>
|
<p><code>msg.sound</code>: set the notification sound, <i><a href="https://pushover.net/api#sounds" target="_new">see the available options</a></i></p>
|
||||||
<p><code>msg.retry</code>: set retry interval for Emergency priority (2) messages, <i><a href="https://pushover.net/api#priority" target="_new">see details</a></i></p>
|
<p><code>msg.retry</code>: set retry interval for Emergency priority (2) messages, <i><a href="https://pushover.net/api#priority" target="_new">see details</a></i></p>
|
||||||
<p><code>msg.expire</code>: set retry duration for Emergency priority (2) messages, <i><a href="https://pushover.net/api#priority" target="_new">see details</a></i></p>
|
<p><code>msg.expire</code>: set retry duration for Emergency priority (2) messages, <i><a href="https://pushover.net/api#priority" target="_new">see details</a></i></p>
|
||||||
|
<p><code>msg.ttl</code>: set time to live duration on anything except Emergency priority (2) messages, <i><a href="https://pushover.net/api#ttl" target="_new">see details</a></i></p>
|
||||||
<p><code>msg.callback</code>: set the callback url for Emergency priority (2) messages, <i><a href="https://pushover.net/api/receipts#callback" target="_new">see details</a></i></p>
|
<p><code>msg.callback</code>: set the callback url for Emergency priority (2) messages, <i><a href="https://pushover.net/api/receipts#callback" target="_new">see details</a></i></p>
|
||||||
<p><code>msg.tags</code>: set tags for Emergency priority (2) messages, <i><a href="https://pushover.net/api/receipts#cancel_by_tag" target="_new">see details</a></i></p>
|
<p><code>msg.tags</code>: set tags for Emergency priority (2) messages, <i><a href="https://pushover.net/api/receipts#cancel_by_tag" target="_new">see details</a></i></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>
|
||||||
|
@ -41,6 +41,7 @@ module.exports = function(RED) {
|
|||||||
var attachment = msg.attachment || null;
|
var attachment = msg.attachment || null;
|
||||||
var retry = msg.retry || 30;
|
var retry = msg.retry || 30;
|
||||||
var expire = msg.expire || 600;
|
var expire = msg.expire || 600;
|
||||||
|
var ttl = msg.ttl || null;
|
||||||
var callback = msg.callback || null;
|
var callback = msg.callback || null;
|
||||||
var tags = msg.tags || null;
|
var tags = msg.tags || null;
|
||||||
if (isNaN(pri)) {pri=0;}
|
if (isNaN(pri)) {pri=0;}
|
||||||
@ -62,6 +63,10 @@ module.exports = function(RED) {
|
|||||||
expire = 10800;
|
expire = 10800;
|
||||||
node.warn("Expire time too high, using maximum setting of 10800s (3 hours) retry duration");
|
node.warn("Expire time too high, using maximum setting of 10800s (3 hours) retry duration");
|
||||||
}
|
}
|
||||||
|
if (!Number.isInteger(ttl) || ttl<=0) {
|
||||||
|
ttl = null;
|
||||||
|
node.warn("No valid number for TTL found, not set");
|
||||||
|
}
|
||||||
if (typeof msg.payload === 'undefined') { msg.payload = "(undefined msg.payload)"; }
|
if (typeof msg.payload === 'undefined') { msg.payload = "(undefined msg.payload)"; }
|
||||||
if (typeof(msg.payload) === 'object') {
|
if (typeof(msg.payload) === 'object') {
|
||||||
msg.payload = JSON.stringify(msg.payload);
|
msg.payload = JSON.stringify(msg.payload);
|
||||||
@ -74,6 +79,7 @@ module.exports = function(RED) {
|
|||||||
priority: pri,
|
priority: pri,
|
||||||
retry: retry,
|
retry: retry,
|
||||||
expire: expire,
|
expire: expire,
|
||||||
|
ttl: ttl,
|
||||||
html: html
|
html: html
|
||||||
};
|
};
|
||||||
if (dev) { pushmsg.device = dev; }
|
if (dev) { pushmsg.device = dev; }
|
||||||
|
Loading…
Reference in New Issue
Block a user