UNPKG

node-red-contrib-trigger-empty

Version:

Sends On on input of an On trigger, and when for all On triggers an Off was received off, Send Off

47 lines (43 loc) 1.85 kB
<script type="text/javascript"> RED.nodes.registerType('trigger-empty',{ category: 'function', color: '#a6bfcf', defaults: { name: {value:""}, topic:{value:"Topic"}, on_payload:{value:"On"}, off_payload:{value:"Off"} }, inputs:1, outputs:1, align: "right", icon: "function.png", label: function() { return this.name||this.topic||"trigger-empty"; } }); </script> <script type="text/x-red" data-template-name="trigger-empty"> <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="icon-tag"></i> Out Topic</label> <input type="text" id="node-input-topic" placeholder="Topic"> </div> <div class="form-row"> <label for="node-input-on_payload"><i class="icon-tag"></i> On payload</label> <input type="text" id="node-input-on_payload" placeholder="On"> </div> <div class="form-row"> <label for="node-input-off_payload"><i class="icon-tag"></i> Off payload</label> <input type="text" id="node-input-off_payload" placeholder="Off"> </div> </script> <script type="text/x-red" data-help-name="trigger-empty"> <p>A node that directly send an "On" on the given topic, when it receives an "On", on a topic. Stores the "On" per topic and if all topics that send an "On" have send an "Off", sends an "Off" on the given topic. So basically a dynamic OR gate for topics. The actual "On" and "Off" value can be entered in Config. The send value is (case-insensitive) checked against the on or off value. The entered value is send.</p> </script>