Bläddra i källkod

Interrupt Flow node added

master
Massimo 5 år sedan
förälder
incheckning
de13a2cbed
3 ändrade filer med 12 tillägg och 7 borttagningar
  1. +4
    -0
      CHANGELOG.md
  2. +7
    -6
      boolean-logic-ultimate/InterruptFlowUltimate.js
  3. +1
    -1
      package.json

+ 4
- 0
CHANGELOG.md Visa fil

@@ -1,5 +1,9 @@
# node-red-contrib-boolean-logic-ultimate

<p>
<b>Version 1.0.10</b><br/>
- Fix a possible issue in the "Interrupt Flow", if the trigger topic contains special characters.</br>
</p>
<p>
<b>Version 1.0.9</b><br/>
- Added "Interrupt Flow" node. Whenever the node receives a payload = false from a specific topic, it stops output messages to the flow. As soon it receives payload = true from this topic, the output messages start to flow out again.</br>

+ 7
- 6
boolean-logic-ultimate/InterruptFlowUltimate.js Visa fil

@@ -7,15 +7,16 @@ module.exports = function(RED) {
node.bInviaMessaggio = true; // Send the message or not
this.on('input', function (msg) {
var sTriggerTopic = node.config.triggertopic || "trigger"; // Topic controlling the bInviaMessaggio
if (msg.hasOwnProperty("topic")) {
// 06/11/2019
if (msg.topic==sTriggerTopic && ToBoolean(msg.payload)===true) {
var sTriggerTopic = node.config.triggertopic.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '') || "trigger"; // Topic controlling the bInviaMessaggio
var sIncomingTopic = "";
if (msg.hasOwnProperty("topic")) {
// 06/11/2019
sIncomingTopic = msg.topic.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, ''); // Cut unwanted Characters
if (sIncomingTopic == sTriggerTopic && ToBoolean(msg.payload) === true) {
node.bInviaMessaggio = true;
setNodeStatus({ fill: "green", shape: "dot", text: "-> pass" });
return;
} else if (msg.topic==sTriggerTopic && ToBoolean(msg.payload)===false){
} else if (sIncomingTopic==sTriggerTopic && ToBoolean(msg.payload)===false){
node.bInviaMessaggio = false;
setNodeStatus({ fill: "red", shape: "dot", text: "|| stop" });
return;

+ 1
- 1
package.json Visa fil

@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-boolean-logic-ultimate",
"version": "1.0.9",
"version": "1.0.10",
"description": "A set of Node-RED enhanced boolean logic, with persisten values after reboot and more",
"author": "Supergiovane (https://github.com/Supergiovane)",
"dependencies": {

Laddar…
Avbryt
Spara