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.

89 lines (79 loc) 3.46 kB
<script type="text/javascript"> RED.nodes.registerType('toggleUltimate', { category: 'Boolean Logic Ultimate', color: '#ff8080', defaults: { name: { value: "Toggle" }, valueToToggle: { value: "true" }, payloadPropName: { value: "payload", required: false }, translatorConfig: { type: "translator-config", required: false } }, inputs: 1, outputs: 1, icon: "serial.png", label: function () { return this.name || "Toggle"; }, paletteLabel: function () { return "Toggle"; }, 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="toggleUltimate"> <div class="form-row"> <b>Toggle 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/VijkMBpt_CM"><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-payloadPropName"><i class="fa fa-ellipsis-h"></i> Input</label> <input type="text" id="node-input-payloadPropName"> </div> <div class="form-row"> <label style="width:160px" for="node-input-valueToToggle"><i class="fa fa-toggle-on"></i> Initial value</label> <select type="text" id="node-input-valueToToggle" placeholder=""> <option value="true">Initialize with True</option> <option value="false">Initialize with False</option> </select> </div> <!-- <div class="form-row"> <input type="checkbox" id="node-input-homeAssitantBoolean" style="display:inline-block; width:auto; vertical-align:top;"> &nbsp; <label style="width:85%" for="node-input-homeAssitantBoolean"> <i class="fa fa-home"></i>&nbsp;Output Home Assistant "on"/"off" instead of true/false </label> </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="toggleUltimate"> <p>The pourpose of this node is to toggle between true/false, everytime an inboud message arrives.</p> |Property|Description| |--|--| | 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"* | | Translator Input | Translates the incoming <code>payload</code> value, to true/false. This allows the compatibility with, for example, **HomeAssistant** nodes. | * Input message Any message that arrives on input, will be passwd through to the output with the payload toggled between true and false. <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>