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.

95 lines (83 loc) 3.75 kB
<script type="text/javascript"> RED.nodes.registerType('KalmanFilterUltimate', { category: 'Boolean Logic Ultimate', color: '#ff8080', defaults: { name: { value: "Kalman" }, payloadPropName: { value: "payload", required: false }, translatorConfig: { type: "translator-config", required: false }, measurementNoise: { value: 0.01 }, processNoise: { value: 3 } }, inputs: 1, outputs: 1, icon: "swap.png", label: function () { return this.name || "KalmanFilter"; }, paletteLabel: function () { return "KalmanFilter"; }, oneditprepare: function () { const payloadField = $("#node-input-payloadPropName"); if (payloadField.val() === "") payloadField.val("payload"); payloadField.typedInput({ default: 'msg', types: ['msg'] }); const measurementField = $("#node-input-measurementNoise"); if (measurementField.val() === "" && this.r !== undefined) measurementField.val(this.r); const processField = $("#node-input-processNoise"); if (processField.val() === "" && this.q !== undefined) processField.val(this.q); } }); </script> <script type="text/html" data-template-name="KalmanFilterUltimate"> <div class="form-row"> <b>Kalman Filter 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/uGNmaHyQpbc"><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 for="node-input-measurementNoise"><i class="icon-tag"></i> Measurement noise (R)</label> <input type="text" id="node-input-measurementNoise" placeholder="0.01"> </div> <div class="form-row"> <label for="node-input-processNoise"><i class="icon-tag"></i> Process noise (Q)</label> <input type="text" id="node-input-processNoise" placeholder="3"> </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="KalmanFilterUltimate"> <p>Outputs the Kalman filtered input.</p> Please refer to [this](https://github.com/wouterbulten/kalmanjs) link, on how it works. |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"* | | Measurement noise | Kalman's <code>R</code> parameter. | | Process noise | Kalman's <code>Q</code> parameter. | | Translator Input | Translates the incoming <code>payload</code> value, to true/false. This allows the compatibility with, for example, **HomeAssistant** nodes. | <br/> ### Inputs : reset (any) : by passing msg.reset, the Kalman filter will be reset. : payload (number) : the payload containing the number. If you've changed the incoming evaluation property in the ***Input*** field, the number to be evaluated must be put in such message's property, instead of the *payload* property. <br/> [Find it useful?](https://www.paypal.me/techtoday) </script>