diff --git a/README.md b/README.md index a9d62fd..24b56d5 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ The node evaluates the following input `msg` types: ## Outputs The node contains two outputs: -- The **primary output** (upper output) emits an output `msg` at the **countdown start/stop** instant of time. These `msg.payload` contents are configurable +- The **primary output** (upper output) emits an output `msg` at the **countdown start/stop** instant of time. These `msg.payload` contents are configurable. If Option "Send Outputmessage on Reset" ist set, the message is send, when the timer is stopped. Otherwise, the Stop message will only by send, if the timer reaches zero. - The **secondary output** (lower output) emits the **remaining time every second** during the timer runs. The `msg.payload` holds the remaining counting value diff --git a/countdown.html b/countdown.html index 5ed5c95..a1b9e69 100644 --- a/countdown.html +++ b/countdown.html @@ -27,6 +27,12 @@ Restart countdown if message is received while running  +
+ + + Send Outputmessage on Reset  +
+
@@ -130,6 +136,7 @@

Details

payloadTimerStopType: { value: 'bool' }, timer: { value: 30, validate:RED.validators.number() }, resetWhileRunning: { value: false }, + outputOnReset: { value: true }, setTimeToNewWhileRunning: { value: true }, startCountdownOnControlMessage: { value: false } }, diff --git a/countdown.js b/countdown.js index e781a93..a4f9785 100644 --- a/countdown.js +++ b/countdown.js @@ -43,7 +43,7 @@ module.exports = function(RED) { } } - function stopTimer() { + function stopTimer(onReset = false) { node.status({ fill: "red", shape: "dot", text: "Stopped: " + timeout }); @@ -67,7 +67,15 @@ module.exports = function(RED) { if (node.config.payloadTimerStopType == "nul") { node.send([null, remainingTicksMsg]); } else { - node.send([msg, remainingTicksMsg]); + if (node.config.outputOnReset) { + node.send([msg, remainingTicksMsg]); + } else { + if (onReset) { + node.send([null, remainingTicksMsg]); + } else { + node.send([msg, remainingTicksMsg]); + } + } } endTicker(); @@ -147,7 +155,7 @@ module.exports = function(RED) { } if (msg.payload === false || msg.payload === 0) { - stopTimer(); + stopTimer(true); } else { if (ticker) { if (node.config.resetWhileRunning) { diff --git a/images/node-settings.png b/images/node-settings.png index 009124b..f30c996 100644 Binary files a/images/node-settings.png and b/images/node-settings.png differ diff --git a/package.json b/package.json index 4ed2c7f..825a7ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-countdown", - "version": "1.3.1", + "version": "1.3.2", "description": "A countdown that supports dynamic setting of (future) run time", "main": "countdown.js", "scripts": {},