UNPKG

node-red-contrib-boolean-logic-ultimate

Version:

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

111 lines (102 loc) 5.78 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 } }, 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 "InterruptFlowUltimate"; }, oneditprepare: function () { if ($("#node-input-payloadPropName").val() === "") $("#node-input-payloadPropName").val("payload"); $("#node-input-payloadPropName").typedInput({ default: 'msg', types: ['msg'] }); } }); </script> <script type="text/x-red" 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> With 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> </script> <script type="text/markdown" data-help-name="InterruptFlowUltimate"> [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) The interrupt flows is able to stop the input messages to exiting the node. ### NODE 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. | | With Input | Set the property where the input payload is. *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.| **INPUT MSG WITH "TRIGGER" TOPIC** 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> from a message having the "trigger" topic, to replay the last stored message</br> Pass <code>msg.reset = true</code> from a message having the "trigger" topic, to clear the last stored message</br> </script>