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.

88 lines (80 loc) 3.8 kB
<script type="text/javascript"> RED.nodes.registerType('InjectUltimate', { category: 'common', color: '#ff8080', defaults: { name: { value: "Inject", }, topic: { value: "1", }, curVal: { value: true, } }, inputs: 0, outputs: 3, outputLabels: ["True", "False", "Toggle"], icon: "inject.svg", button: { onclick: function () { // Called when the button is clicked if (this.changed) { return RED.notify(RED._("notification.warning", { message: RED._("notification.warnings.undeployedChanges") }), "warning"); } var node = this; $.ajax({ url: "InjectUltimate/" + this.id, type: "POST", success: function (resp) { RED.notify(node._("inject.success", { label: label }), { type: "success", id: "inject" }); }, error: function (jqXHR, textStatus, errorThrown) { if (jqXHR.status == 404) { RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.not-deployed") }), "error"); } else if (jqXHR.status == 500) { RED.notify(node._("common.notification.error", { message: node._("inject.errors.failed") }), "error"); } else if (jqXHR.status == 0) { RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.no-response") }), "error"); } else { RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.unexpected", { status: jqXHR.status, message: textStatus }) }), "error"); } } }); }, enabled: function () { return !this.changed } }, label: function () { return this.name + " " + this.topic; }, paletteLabel: function () { return "InjectUltimate"; } }); </script> <script type="text/x-red" data-template-name="InjectUltimate"> <div class="form-row"> <b>Inject 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/sYc6L5QQrTw"><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-topic"><i class="fa fa-tasks"></i> Topic</label> <input type="text" id="node-input-topic" placeholder="Topic"> </div> </script> <script type="text/markdown" data-help-name="InjectUltimate"> [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 pourpose of this node is to send a message with payload TRUE on the first output, FALSE on second output and a TOGGLE (true/false) on the third output, by pressing the pushbutton.<br /> This is useful if you need to simply test your flow. </script>