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.

109 lines (99 loc) 4.54 kB
<script type="text/javascript"> RED.nodes.registerType('RailwaySwitchUltimate', { category: 'boolean logic ultimate', color: '#ff8080', defaults: { name: { value: "Railway Switch" }, triggertopic: { value: "trigger" }, initializewith: { value: "0" }, autoToggle: { value: "0" }, payloadPropName: { value: "payload", required: false } }, inputs: 1, outputs: 2, outputLabels: function (i) { var ret = ""; switch (i) { case 0: return "Upper PIN"; break; case 1: return "Lower PIN"; break; default: break; } }, icon: "font-awesome/fa-train", label: function () { return (this.name || "Switch") + " (" + this.triggertopic + ")"; }, paletteLabel: function () { return "RailwaySwitchUltimate"; }, 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="RailwaySwitchUltimate"> <div class="form-row"> <b>Railway Switch 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/1SjYE7d04u4"><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> Switcher 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>An input msg having this topic and msg true or false<br/>will trigger the railway switch between the two output PINs<br/> false switches to the upper PIN<br/> true switches to the lower PIN<br/> </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="" style="width:250px"> <option value="0">Flow messages to the upper PIN</option> <option value="1">Flow messages to the lower PIN</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="" style="width:250px"> <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="RailwaySwitchUltimate"> [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 railway switcher, switches the input msg flow to one ot the two outputs (upper or lower). |Property|Description| |--|--| | Switcher topic | Whenever the node receives a payload from this **topic**, it switches the input messages to an output. | | 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 after some time. | **INPUT MSG WITH "TRIGGER" TOPIC** Pass <code>msg.payload = false</code> switches the msg input to the UPPER output</br> Pass <code>msg.payload = true</code> switches the msg input to the LOWER output</br> </script>