Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # node-red-contrib-boolean-logic-ultimate
  2. [![NPM version][npm-version-image]][npm-url]
  3. [![NPM downloads per month][npm-downloads-month-image]][npm-url]
  4. [![NPM downloads total][npm-downloads-total-image]][npm-url]
  5. [![MIT License][license-image]][license-url]
  6. [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
  7. [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square)](https://www.paypal.me/techtoday)
  8. ## DESCRIPTION
  9. The node performs Boolean logic on the incoming payloads.<br/>
  10. The node performs 3 checks (<b>AND,OR,XOR</b>) on the incoming boolean payloads and outputs the result at the same time, as follow:<br/>
  11. - Output "AND": true or false<br/>
  12. - Output "OR": true or false<br/>
  13. - Output "XOR": true or false<br/>
  14. The node can have a persistent input: 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.
  15. ## ADDITIONAL FUNCTIONS
  16. * Filter ouput results (outputs only true or trye/false)
  17. * Trigger mode selection (Can output a payload only by single input's topic trigger and after evaluation ot other inputs, or can oputput a payload by change of every input)
  18. ## CHANGELOG
  19. * See <a href="https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/blob/master/CHANGELOG.md">here the changelog</a>
  20. ## CONFIGURATION
  21. <p>
  22. The node expects a fixed number of topics (configured in the settings) on which it will operate. It will only output a value
  23. 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/>
  24. 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/>
  25. <br/>
  26. ***Number of different topics to evaluate***
  27. Set the number of different topics to be evaluated. The node will output a message to the flow, after this number of different topics arrives.<br/>
  28. <b> Remember: each input topic must be different. For example, if you set this field to 3, the node expects 3 different topics.</b><br/>
  29. ***Filter output result***
  30. <ol>
  31. <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>
  32. <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>
  33. </ol>
  34. <br/>
  35. <b>Trigger mode</b><br />
  36. The node can acts ad a standard boolean logic or as single topic triggered boolean logic.<br/>
  37. As single topic triggered boolean logic, the node will evaluate the inputs (and thus will output a payload) only if a specified topic input arrives.<br/>
  38. In a coding perspectives, it acts as follows:<br/>
  39. <code>
  40. if (msg.topic == specified topic)<br/>
  41. {<br/>
  42. If (all other inputs are true) -> outputs true otherwise false<br/>
  43. }<br/>
  44. </code>
  45. <ol>
  46. <li>All topics: standard behaviour, the node will output <b>true</b> and <b>false</b> by evaluating all inputs. Each input change will trigger the node output.</li>
  47. <li>Single topic + eval other inputs: <u>only whenever the node receives a msg input with the <b>specified topic</b> (having payload = true)</u>, it starts the evaluation of all other inputs as well and outputs the evaluated payload. If the node receives a msg input other than the <b>specified topic</b>), it only retains it's value for the boolean evaluation.</li>
  48. </ol>
  49. <b>If input states are undefined</b><br />
  50. Every time you create a node or modify the node, all inputs are set to undefined. This means that the node will wait the arrive of all topics (for example 3 topics, if you've selected 3 topics in the option), before it can output a payload. This can be a problem if your logic must be operative as soon as you deploy the flow. To overcome this problem, you can "initialize" all the undefined inputs with True or False.
  51. <ol>
  52. <li>Leave undefined: Standard behaviour, the node will wait all the "undefined" topics to arrive, then starts a flow with the result.</li>
  53. <li>True or False: The node is immediately operative, by force the initialization of the "undefined" inputs with "true" or "false".</li>
  54. </ol>
  55. <br/>
  56. <br/><br/>
  57. <b>Remember latest input values after reboot</b><br />
  58. 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/>
  59. Every time you modify the node's config, <b>the retained values are cleared</b>.<br/>
  60. <br/>
  61. All incoming msg.payloads are converted into a boolean value according to the following rules (this applies to all boolean logic nodes):
  62. <ol>
  63. <li>Boolean values are taken as-is.</li>
  64. <li>For numbers, 0 evaluates to false, all other numbers evaluates to true.</li>
  65. <li>Strings are converted to numbers if they match the format of a decimal value, then the same rule as for numbers are applied. If it does not match, it evaluates to false. Also, the string "true" evaluates to true.</li>
  66. </ol>
  67. <br>
  68. The XOR operation operates in a one, and only one mode, i.e. (A ^ B) ^ C ... ^ n
  69. </p>
  70. <p>
  71. # OTHER USEFUL NODES
  72. **Interrupt Flow**
  73. Whenever this 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.
  74. **Invert Ultimate**
  75. Outputs the inverted input. For example true -> false
  76. **Filter Ultimate**
  77. This node has 2 outputs.<br />
  78. If the input payload is true, the node will send <code>true</code> on output 1 and nothing on oputput 2<br />
  79. If the input payload is false, the node will send nothing on output 1, and <code>false</code> on oputput 2<br />
  80. [license-image]: https://img.shields.io/badge/license-MIT-blue.svg
  81. [license-url]: https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/master/LICENSE
  82. [npm-url]: https://npmjs.org/package/node-red-contrib-boolean-logic-ultimate
  83. [npm-version-image]: https://img.shields.io/npm/v/node-red-contrib-boolean-logic-ultimate.svg
  84. [npm-downloads-month-image]: https://img.shields.io/npm/dm/node-red-contrib-boolean-logic-ultimate.svg
  85. [npm-downloads-total-image]: https://img.shields.io/npm/dt/node-red-contrib-boolean-logic-ultimate.svg