UNPKG

node-red-contrib-boolean-logic-ultimate

Version:

A set of Node-RED enhanced boolean logic and utility nodes, flow interruption, blinker, debouncer, invert, filter, toggle etc.., with persistent values after reboot. Compatible also with Homeassistant values.

129 lines (117 loc) 6.29 kB
<script type="text/javascript"> RED.nodes.registerType('InterruptFlowUltimate', { category: 'Boolean Logic Ultimate', color: '#ff8080', defaults: { name: { value: "Interrupt Flow" }, triggertopic: { value: "trigger" }, initializewith: { value: "1" }, autoToggle: { value: "0" }, payloadPropName: { value: "payload", required: false }, translatorConfig: { type: "translator-config", required: false } }, inputs: 1, outputs: 1, outputLabels: function (i) { var ret = ""; switch (i) { case 0: return "True"; break; case 1: return "False"; break; default: break; } }, icon: "file-in.png", label: function () { return (this.name || "Interrupt") + " (" + this.triggertopic + ")"; }, paletteLabel: function () { return "Interrupt Flow"; }, oneditprepare: function () { if ($("#node-input-payloadPropName").val() === "") $("#node-input-payloadPropName").val("payload"); $("#node-input-payloadPropName").typedInput({ default: 'msg', types: ['msg'] }); } }); </script> <script type="text/html" data-template-name="InterruptFlowUltimate"> <div class="form-row"> <b>Interrupt Flow Ultimate</b>&nbsp&nbsp&nbsp&nbsp<span style="color:red"><i class="fa fa-question-circle"></i>&nbsp<a target="_blank" href="https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate"><u>Help online</u></a></span> &nbsp&nbsp&nbsp<span style="color:red"><i class="fa fa-youtube-play"></i>&nbsp<a target="_blank" href="https://youtu.be/1T1g0HCeYA8"><u>Youtube Sample</u></a></span> <br/> <br/> </div> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-triggertopic"><i class="icon-tag"></i> Trigger by topic</label> <input type="text" id="node-input-triggertopic" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-payloadPropName"><i class="fa fa-ellipsis-h"></i> Input</label> <input type="text" id="node-input-payloadPropName"> </div> <div><i>Whenever the node receives a msg with false from this topic,<br/> it stops output messages to the flow.<br/>As soon it receives a message with true from this topic,<br/>the output messages start to flow out again. <br/>The node will output the current stored message<br/>plus an added property "isReplay = true",<br/>as soon as it receives a "play" = true from this topic.</br> The node will clear the current stored message, as soon as it receives a "msg.reset = true" from this topic. </i></div> <br/> <div class="form-row"> <label style="width:160px" for="node-input-initializewith"><i class="fa fa-home"></i> At node-red start</label> <select type="text" id="node-input-initializewith" placeholder=""> <option value="1">Pass telegrams</option> <option value="0">Block telegrams</option> </select> </div> <div class="form-row"> <label style="width:160px" for="node-input-autoToggle"><i class="fa fa-hourglass-o"></i> Then</label> <select type="text" id="node-input-autoToggle" placeholder=""> <option value="0">Nothing</option> <option value="10">Toggle above option after 10 seconds</option> <option value="20">Toggle above option after 20 seconds</option> <option value="30">Toggle above option after 30 seconds</option> <option value="40">Toggle above option after 40 seconds</option> <option value="50">Toggle above option after 50 seconds</option> <option value="60">Toggle above option after 60 seconds</option> <option value="90">Toggle above option after 90 seconds</option> <option value="120">Toggle above option after 120 seconds</option> </select> </div> <div class="form-row"> <br /> <b>Translator</b> <br/> <label for="node-input-translatorConfig" > <font color="green" size="4px"><i class="fa fa-sign-in" aria-hidden="true"></i></font> Input </label> <input type="text" id="node-input-translatorConfig" /> </div> </script> <script type="text/markdown" data-help-name="InterruptFlowUltimate"> <p>The interrupt flows is able to stop the input messages to exiting the node.</p> **Configuration** |Property|Description| |--|--| | Trigger by topic | Whenever the node receives a payload = false from this 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. The node will output the current stored message plus an added property "isReplay = true", as soon as it receives a ***msg.play = true*** from this topic. The node will clear the current stored message, as soon as it receives a ***msg.reset = true*** from this topic. | | Input | It's the msg property to be evaluated. *By default, it is "payload", but you can also specify other properties, for example "payload.value"* | | Then | This property, allow you to auto toggle the selected start state (pass or block) after a timer has elapsed. You can choose from some pre-defined delays. If you have, for example, an Homekit-Bridged nodeset with a thermostat node or security system node in your flow, once node-red restarts, these homekit nodes output a default message to the flow. Just put an InterruptFlow node with a "block at start" behaviour and a toggle delay enabled behind homekit nodes, to temporary stop the chained nodes to receive the unwanted startup message.| | Translator Input | Translates the incoming <code>payload</code> value, to true/false. This allows the compatibility with, for example, **HomeAssistant** nodes. | <br/> * Input messages Explanation of the input msg, having the <code>msg.topic</code> equal to the *Trigger by topic* property: Pass <code>msg.payload = true</code> to allow messages to pass through</br> Pass <code>msg.payload = false</code> to prevent messages from passing through</br> Pass <code>msg.play = true</code> to replay the last stored message</br> Pass <code>msg.reset = true</code> to clear the last stored message</br> <br/> <br/> [SEE THE README FOR FULL HELP AND SAMPLES](https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate) [Find it useful?](https://www.paypal.me/techtoday) </script>