Browse Source

Fixed crappy intert node

master
Massimo 5 years ago
parent
commit
5bf0346d1b
5 changed files with 16 additions and 10 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +3
    -1
      boolean-logic-ultimate/BooleanLogicUltimate.html
  3. +3
    -3
      boolean-logic-ultimate/InvertUltimate.html
  4. +5
    -5
      boolean-logic-ultimate/InvertUltimate.js
  5. +1
    -1
      package.json

+ 4
- 0
CHANGELOG.md View File

# node-red-contrib-boolean-logic-ultimate # node-red-contrib-boolean-logic-ultimate
<p> <p>
<b>Version 0.0.6</b><br/>
- Fixed crappy "Invert" node.<br/>
</p>
<p>
<b>Version 0.0.5</b><br/> <b>Version 0.0.5</b><br/>
- Bypass persistency if node-red user hasn't permissions to write to the filesystem.<br/> - Bypass persistency if node-red user hasn't permissions to write to the filesystem.<br/>
</p> </p>

+ 3
- 1
boolean-logic-ultimate/BooleanLogicUltimate.html View File

icon: "serial.png", icon: "serial.png",
label: label:
function() { function() {
var label = "Logic" + " [" + this.inputCount + "]";
var label = "Logic" + (this.filtertrue=="both" ? "" : " filtered" ) + " [" + this.inputCount + "]";
if( this.name !== undefined && this.name.length > 0 ) { if( this.name !== undefined && this.name.length > 0 ) {
label = label + " (" + this.name + ")"; label = label + " (" + this.name + ")";
} }
- Output "AND": true or false<br/> - Output "AND": true or false<br/>
- Output "OR": true or false<br/> - Output "OR": true or false<br/>
- Output "XOR": true or false<br/> - Output "XOR": true or false<br/>
<br/> <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/>
<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>
</ol> </ol>
<b>filtered</b>: shown on label, means that the node will pass out only <code>true</code> values (Output only 'true' results). <br/>
<br/><br/> <br/><br/>
<b>Remember latest input values after reboot</b><br /> <b>Remember latest input values after reboot</b><br />
If checked, the input values are retained after a node-red reboot. That means, that if you reboot your node-red, you don't need to wait all inputs to arrive and initialize the node, before the node can output a payload.<br/> If checked, the input values are retained after a node-red reboot. That means, that if you reboot your node-red, you don't need to wait all inputs to arrive and initialize the node, before the node can output a payload.<br/>

+ 3
- 3
boolean-logic-ultimate/InvertUltimate.html View File

<script type="text/javascript"> <script type="text/javascript">
RED.nodes.registerType('InvertUltimate',{ RED.nodes.registerType('InvertUltimate',{
category: 'boolean logic ultimate',
category: 'boolean logic',
color: '#ff8080', color: '#ff8080',
defaults: { defaults: {
name: { name: {
value: "InvertUltimate"
value: "Invert"
} }
}, },
inputs:1, inputs:1,
icon: "serial.png", icon: "serial.png",
label: label:
function() { function() {
return this.name||"InvertUltimate";
return this.name||"Invert";
}, },
paletteLabel: function() { paletteLabel: function() {
return "InvertUltimate"; return "InvertUltimate";

+ 5
- 5
boolean-logic-ultimate/InvertUltimate.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"});
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)}); node.status( {fill: "green" ,shape: "dot" ,text: !ToBoolean(payload)});
return({ topic: topic, payload: !ToBoolean(payload) });
node.send({ topic: topic, payload: !ToBoolean(payload) });
return;
} }
}); });
node.status( {fill: "grey" ,shape: "dot" ,text: payload});


function ToBoolean( value ) { function ToBoolean( value ) {
var res = false; var res = false;

+ 1
- 1
package.json View File

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

Loading…
Cancel
Save