Bladeren bron

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

master
Massimo 5 jaren geleden
bovenliggende
commit
fb7d34bd0c
4 gewijzigde bestanden met toevoegingen van 22 en 9 verwijderingen
  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 Bestand weergeven

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

+ 2
- 1
README.md Bestand weergeven

@@ -29,7 +29,8 @@ The node expects a fixed number of topics (configured in the settings) on which
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/>
<br/>
<b>Filter output result</b><br />

***Filter output result***
<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 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 Bestand weergeven

@@ -3,7 +3,7 @@ module.exports = function(RED) {
RED.nodes.createNode(this,config);
this.config = config;
var node = this;
node.status( {fill: "grey" ,shape: "dot" ,text: "Waiting"});
setNodeStatus( {fill: "grey" ,shape: "dot" ,text: "Waiting"});
this.on('input', function (msg) {
var sTopic = node.config.name;
if (msg.hasOwnProperty("topic")){
@@ -22,18 +22,22 @@ module.exports = function(RED) {
payload: false
};
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]);
} else
{
node.status( {fill: "green" ,shape: "dot" ,text: "(Send) null,false"});
setNodeStatus( {fill: "green" ,shape: "dot" ,text: "(Send) null,false"});
node.send([null, msgFalse]);
}
return;
}
});
function setNodeStatus({fill, shape, text})
{
node.status({fill: fill,shape: shape,text: text + " (Last " + new Date().toLocaleString() + ")"})
}

function ToBoolean( value ) {
var res = false;
@@ -56,6 +60,6 @@ module.exports = function(RED) {
};
}
RED.nodes.registerType("FilterUltimate",FilterUltimate);
}

+ 10
- 3
boolean-logic-ultimate/InvertUltimate.js Bestand weergeven

@@ -4,13 +4,13 @@ module.exports = function(RED) {
this.config = config;
var node = this;
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) {
var topic = msg.topic || "";
var payload = msg.payload;
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) });
return;
}
@@ -37,7 +37,14 @@ module.exports = function(RED) {
return res;
};
}

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

Laden…
Annuleren
Opslaan