Browse Source

Added the Last value change date/time in the status.

master
Massimo 5 years ago
parent
commit
fb7d34bd0c
4 changed files with 22 additions and 9 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +2
    -1
      README.md
  3. +9
    -5
      boolean-logic-ultimate/FilterUltimate.js
  4. +10
    -3
      boolean-logic-ultimate/InvertUltimate.js

+ 1
- 0
CHANGELOG.md View File

<b>Version 1.0.5</b><br/> <b>Version 1.0.5</b><br/>
- Added the Last value change date/time in the status.<br/> - Added the Last value change date/time in the status.<br/>
- Correction in the in-line help<br/> - Correction in the in-line help<br/>
- Better format of the README.md<br/>
</p> </p>
<p> <p>
<b>Version 1.0.4</b><br/> <b>Version 1.0.4</b><br/>

+ 2
- 1
README.md View File

when it has seen the expected number of topics. If it ever sees more than the configured number of topics it will log a message then reset its state and start over.<br/> when it has seen the expected number of topics. If it ever sees more than the configured number of topics it will log a message then reset its state and start over.<br/>
Changing the topic is usually only needed when chaining multiple boolean nodes after each other becuse the topics will then all be the same when delivered to the nodes further down the chain.<br/> Changing the topic is usually only needed when chaining multiple boolean nodes after each other becuse the topics will then all be the same when delivered to the nodes further down the chain.<br/>
<br/> <br/>
<b>Filter output result</b><br />

***Filter output result***
<ol> <ol>
<li>Output both 'true' and 'false' results: Standard behaviour, the node will output <b>true</b> and <b>false</b> whenever it receives an input and calculate the boolean logics as output.</li> <li>Output both 'true' and 'false' results: Standard behaviour, the node will output <b>true</b> and <b>false</b> whenever it receives an input and calculate the boolean logics as output.</li>
<li>Output only 'true' results: whenever the node receives an input, it outputs a payload <b>true</b> only if the result of the logic is true. <b>False</b> results are filtered out.</li> <li>Output only 'true' results: whenever the node receives an input, it outputs a payload <b>true</b> only if the result of the logic is true. <b>False</b> results are filtered out.</li>

+ 9
- 5
boolean-logic-ultimate/FilterUltimate.js View File

RED.nodes.createNode(this,config); RED.nodes.createNode(this,config);
this.config = config; this.config = config;
var node = this; var node = this;
node.status( {fill: "grey" ,shape: "dot" ,text: "Waiting"});
setNodeStatus( {fill: "grey" ,shape: "dot" ,text: "Waiting"});
this.on('input', function (msg) { this.on('input', function (msg) {
var sTopic = node.config.name; var sTopic = node.config.name;
if (msg.hasOwnProperty("topic")){ if (msg.hasOwnProperty("topic")){
payload: false payload: false
}; };
if (bRes === true) { if (bRes === true) {
node.status( {fill: "green" ,shape: "dot" ,text: "(Send) true,null"});
setNodeStatus( {fill: "green" ,shape: "dot" ,text: "(Send) true,null"});
node.send([msgTrue, null]); node.send([msgTrue, null]);
} else } else
{ {
node.status( {fill: "green" ,shape: "dot" ,text: "(Send) null,false"});
setNodeStatus( {fill: "green" ,shape: "dot" ,text: "(Send) null,false"});
node.send([null, msgFalse]); node.send([null, msgFalse]);
} }
return; return;
} }
}); });
function setNodeStatus({fill, shape, text})
{
node.status({fill: fill,shape: shape,text: text + " (Last " + new Date().toLocaleString() + ")"})
}


function ToBoolean( value ) { function ToBoolean( value ) {
var res = false; var res = false;
}; };
} }
RED.nodes.registerType("FilterUltimate",FilterUltimate); RED.nodes.registerType("FilterUltimate",FilterUltimate);
} }

+ 10
- 3
boolean-logic-ultimate/InvertUltimate.js View File

this.config = config; this.config = config;
var node = this; var node = this;
var decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/ var decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
node.status( {fill: "grey" ,shape: "dot" ,text: "waiting"});
setNodeStatus( {fill: "grey" ,shape: "dot" ,text: "Waiting"});
this.on('input', function(msg) { this.on('input', function(msg) {
var topic = msg.topic || ""; var topic = msg.topic || "";
var payload = msg.payload; var payload = msg.payload;
if (topic !== undefined && payload !== undefined) { if (topic !== undefined && payload !== undefined) {
node.status( {fill: "green" ,shape: "dot" ,text: !ToBoolean(payload)});
setNodeStatus( {fill: "green" ,shape: "dot" ,text: "(Send) " + !ToBoolean(payload)});
node.send({ topic: topic, payload: !ToBoolean(payload) }); node.send({ topic: topic, payload: !ToBoolean(payload) });
return; return;
} }
return res; return res;
}; };
}

function setNodeStatus({fill, shape, text})
{
node.status({fill: fill,shape: shape,text: text + " (Last " + new Date().toLocaleString() + ")"})
}
}
RED.nodes.registerType("InvertUltimate",InvertUltimate); RED.nodes.registerType("InvertUltimate",InvertUltimate);

Loading…
Cancel
Save