| @@ -3,6 +3,10 @@ | |||
| <a href="http://eepurl.com/gJm095" target="_blank">Subscribe to my channel.</a> Only news about my nodes, no spam, no ads. I'm a github developer, not a merchant. | |||
| <p> | |||
| <b>Version 1.0.20</b> August 2020<br/> | |||
| - NEW: Inject Node. The pourpose of this node is to speed up the testing of you flow, by issuing true/false command by pushbutton on the node itself. This node is simpler as the default node-red inject node.</br> | |||
| </p> | |||
| <p> | |||
| <b>Version 1.0.19</b> August 2020<br/> | |||
| - NEW: Simple Output node. The pourpose of this node is to send a message with payload TRUE on the first pin and FALSE on second pin, independently from the msg input.</br> | |||
| @@ -51,7 +51,7 @@ The node can have a persistent input: the input values are retained after a node | |||
| You can also set the default values of the topic inputs. | |||
| ## CONFIGURATION | |||
| ### CONFIGURATION | |||
| **Number of different topics to evaluate** | |||
| @@ -147,6 +147,20 @@ This is useful if you need to simply send a true or false payload. | |||
| </code> | |||
| </details> | |||
| # INJECT ULTIMATE | |||
| The pourpose of this node is to send a message with payload TRUE on the first pin, FALSE on second pin and a TOGGLE (true/false) on the third pin, by pressing the pushbutton.<br /> | |||
| This is useful if you need to simply test your flow. The node is simpler as the default node-red inject node. | |||
| <img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/master/img/Inject.png' width='60%'> | |||
| <details><summary>CLICK HERE, copy and paste it into your flow</summary> | |||
| <code> | |||
| [{"id":"13faaec9.cd80b9","type":"InjectUltimate","z":"81a64dae.012c18","name":"True","x":110,"y":1000,"wires":[["6557d19.c71abb"],[],[]]},{"id":"6557d19.c71abb","type":"debug","z":"81a64dae.012c18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":370,"y":1080,"wires":[]},{"id":"569b3820.b056e8","type":"InjectUltimate","z":"81a64dae.012c18","name":"False","x":110,"y":1080,"wires":[[],["6557d19.c71abb"],[]]},{"id":"189399f.c384f66","type":"InjectUltimate","z":"81a64dae.012c18","name":"Toggle","x":110,"y":1160,"wires":[[],[],["6557d19.c71abb"]]},{"id":"56119644.8c4bf8","type":"comment","z":"81a64dae.012c18","name":"Inject Ultimate. Simple and efficient.","info":"","x":180,"y":940,"wires":[]}] | |||
| </code> | |||
| </details> | |||
| [license-image]: https://img.shields.io/badge/license-MIT-blue.svg | |||
| [license-url]: https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/master/LICENSE | |||
| [npm-url]: https://npmjs.org/package/node-red-contrib-boolean-logic-ultimate | |||
| @@ -0,0 +1,82 @@ | |||
| <script type="text/javascript"> | |||
| RED.nodes.registerType('InjectUltimate', { | |||
| category: 'boolean logic ultimate', | |||
| color: '#ff8080', | |||
| defaults: { | |||
| name: { | |||
| value: "Inject", | |||
| }, | |||
| 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 || "Inject"; | |||
| }, | |||
| paletteLabel: function () { | |||
| return "InjectUltimate"; | |||
| } | |||
| }); | |||
| </script> | |||
| <script type="text/x-red" data-template-name="InjectUltimate"> | |||
| <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/x-red" data-help-name="InjectUltimate"> | |||
| <p> | |||
| <a href="https://www.paypal.me/techtoday" target="_blank"><img src='https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square' width='30%'></a> | |||
| and | |||
| <a href="http://eepurl.com/gJm095" target="_blank">Subscribe to my channel</a> for news about my nodes. | |||
| </p> | |||
| <p>This node sends TRUE on output 1, FALSE on putput 2 and a TOGGLED value (true/false) on output 3, on every click of the button.<br/> | |||
| The status indicator represents the output value. | |||
| </p> | |||
| <a href="https://www.paypal.me/techtoday" target="_blank"><img src='https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square' width='30%'></a> | |||
| </script> | |||
| @@ -0,0 +1,46 @@ | |||
| module.exports = function (RED) { | |||
| function InjectUltimate(config) { | |||
| RED.nodes.createNode(this, config); | |||
| this.config = config; | |||
| var node = this; | |||
| node.curVal = true; | |||
| node.topic = config.topic || "Inject"; | |||
| setNodeStatus({ fill: "grey", shape: "dot", text: "Waiting" }); | |||
| RED.httpAdmin.post("/InjectUltimate/:id", RED.auth.needsPermission("InjectUltimate.write"), function (req, res) { | |||
| var node = RED.nodes.getNode(req.params.id); | |||
| if (node != null) { | |||
| try { | |||
| node.buttonpressed(); | |||
| res.sendStatus(200); | |||
| } catch (err) { | |||
| res.sendStatus(500); | |||
| node.error(RED._("InjectUltimate.failed", { error: err.toString() })); | |||
| } | |||
| } else { | |||
| res.sendStatus(404); | |||
| } | |||
| }); | |||
| // 29/08/2020 triggered by button press | |||
| node.buttonpressed = () => { | |||
| setNodeStatus({ fill: "green", shape: "dot", text: "Sent true/false/" + node.curVal.toString() + " (next " + (!node.curVal).toString() + ")" }); | |||
| var msgTrue = { payload: true, topic: node.topic }; | |||
| var msgFalse = { payload: false, topic: node.topic }; | |||
| var msgToggled = { payload: node.curVal, topic: node.topic }; | |||
| node.curVal = !node.curVal; | |||
| node.send([msgTrue, msgFalse, msgToggled]); | |||
| } | |||
| function setNodeStatus({ fill, shape, text }) { | |||
| var dDate = new Date(); | |||
| node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" }) | |||
| } | |||
| } | |||
| RED.nodes.registerType("InjectUltimate", InjectUltimate); | |||
| } | |||
| @@ -47,8 +47,8 @@ | |||
| <a href="http://eepurl.com/gJm095" target="_blank">Subscribe to my channel</a> for news about my nodes. | |||
| </p> | |||
| <p>A node that emits the inverted input value.<br/> | |||
| The status indicator represents the output value. | |||
| <p>This node replaces the input payload by sendind a message with payload TRUE on output 1 and FALSE on output 2.<br/> | |||
| </p> | |||
| <a href="https://www.paypal.me/techtoday" target="_blank"><img src='https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square' width='30%'></a> | |||
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "name": "node-red-contrib-boolean-logic-ultimate", | |||
| "version": "1.0.19", | |||
| "version": "1.0.20", | |||
| "description": "A set of Node-RED enhanced boolean logic node, flow interruption node, blinker node, invert node, filter node, with persisten values after reboot and more.", | |||
| "author": "Supergiovane (https://github.com/Supergiovane)", | |||
| "dependencies": { | |||
| @@ -25,7 +25,8 @@ | |||
| "FilterUltimate": "boolean-logic-ultimate/FilterUltimate.js", | |||
| "InterruptFlowUltimate": "boolean-logic-ultimate/InterruptFlowUltimate.js", | |||
| "BlinkerUltimate": "boolean-logic-ultimate/BlinkerUltimate.js", | |||
| "SimpleOutputUltimate": "boolean-logic-ultimate/SimpleOutputUltimate.js" | |||
| "SimpleOutputUltimate": "boolean-logic-ultimate/SimpleOutputUltimate.js", | |||
| "InjectUltimate": "boolean-logic-ultimate/InjectUltimate.js" | |||
| } | |||
| } | |||