node-red-contrib-boolean-logic-ultimate 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
# CHANGELOG
|
|
5
5
|
|
|
6
|
+
<p>
|
|
7
|
+
<b>Version 1.2.2</b> September 2025<br/>
|
|
8
|
+
- KalmanFilterUltimate: renamed configuration fields for R/Q parameters to measurement/process noise to avoid reserved-property conflicts.</br>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
6
11
|
<p>
|
|
7
12
|
<b>Version 1.2.1</b> September 2025<br/>
|
|
8
13
|
- NEW: PresenceSimulatorUltimate to replay configurable message sequences and simulate occupancy.<br/>
|
package/README.md
CHANGED
|
@@ -534,7 +534,8 @@ Please refer to [this](https://github.com/wouterbulten/kalmanjs) link, on how it
|
|
|
534
534
|
| Property | Description |
|
|
535
535
|
| ---------------- | ---------------------------------------------------------------------------------------------------- |
|
|
536
536
|
| 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"* |
|
|
537
|
-
|
|
|
537
|
+
| Measurement noise | Kalman's <code>R</code> parameter. |
|
|
538
|
+
| Process noise | Kalman's <code>Q</code> parameter. |
|
|
538
539
|
| Translator Input | Translates the incoming <code>payload</code> value, to true/false. This allows the compatibility with, for example, **HomeAssistant** nodes. |
|
|
539
540
|
|
|
540
541
|
<br/>
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
payloadPropName: { value: "payload", required: false },
|
|
10
10
|
translatorConfig: { type: "translator-config", required: false },
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
measurementNoise: { value: 0.01 },
|
|
12
|
+
processNoise: { value: 3 }
|
|
13
13
|
},
|
|
14
14
|
inputs: 1,
|
|
15
15
|
outputs: 1,
|
|
@@ -22,8 +22,15 @@
|
|
|
22
22
|
return "KalmanFilter";
|
|
23
23
|
},
|
|
24
24
|
oneditprepare: function () {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const payloadField = $("#node-input-payloadPropName");
|
|
26
|
+
if (payloadField.val() === "") payloadField.val("payload");
|
|
27
|
+
payloadField.typedInput({ default: 'msg', types: ['msg'] });
|
|
28
|
+
|
|
29
|
+
const measurementField = $("#node-input-measurementNoise");
|
|
30
|
+
if (measurementField.val() === "" && this.r !== undefined) measurementField.val(this.r);
|
|
31
|
+
|
|
32
|
+
const processField = $("#node-input-processNoise");
|
|
33
|
+
if (processField.val() === "" && this.q !== undefined) processField.val(this.q);
|
|
27
34
|
}
|
|
28
35
|
});
|
|
29
36
|
</script>
|
|
@@ -44,13 +51,13 @@
|
|
|
44
51
|
<input type="text" id="node-input-payloadPropName">
|
|
45
52
|
</div>
|
|
46
53
|
<div class="form-row">
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
<label for="node-input-measurementNoise"><i class="icon-tag"></i> Measurement noise (R)</label>
|
|
55
|
+
<input type="text" id="node-input-measurementNoise" placeholder="0.01">
|
|
56
|
+
</div>
|
|
57
|
+
<div class="form-row">
|
|
58
|
+
<label for="node-input-processNoise"><i class="icon-tag"></i> Process noise (Q)</label>
|
|
59
|
+
<input type="text" id="node-input-processNoise" placeholder="3">
|
|
60
|
+
</div>
|
|
54
61
|
<div class="form-row">
|
|
55
62
|
<br />
|
|
56
63
|
<b>Translator</b>
|
|
@@ -70,7 +77,8 @@ Please refer to [this](https://github.com/wouterbulten/kalmanjs) link, on how it
|
|
|
70
77
|
|Property|Description|
|
|
71
78
|
|--|--|
|
|
72
79
|
| 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"* |
|
|
73
|
-
|
|
|
80
|
+
| Measurement noise | Kalman's <code>R</code> parameter. |
|
|
81
|
+
| Process noise | Kalman's <code>Q</code> parameter. |
|
|
74
82
|
| Translator Input | Translates the incoming <code>payload</code> value, to true/false. This allows the compatibility with, for example, **HomeAssistant** nodes. |
|
|
75
83
|
|
|
76
84
|
<br/>
|
|
@@ -84,4 +92,4 @@ Please refer to [this](https://github.com/wouterbulten/kalmanjs) link, on how it
|
|
|
84
92
|
|
|
85
93
|
[Find it useful?](https://www.paypal.me/techtoday)
|
|
86
94
|
|
|
87
|
-
</script>
|
|
95
|
+
</script>
|
|
@@ -6,9 +6,27 @@ module.exports = function (RED) {
|
|
|
6
6
|
const KalmanFilter = require('kalmanjs');
|
|
7
7
|
var kalmanFilter = undefined;
|
|
8
8
|
|
|
9
|
+
function resolveNoise(preferred, legacy, fallback) {
|
|
10
|
+
const getNumeric = (value) => {
|
|
11
|
+
if (value === undefined || value === "") return undefined;
|
|
12
|
+
const parsed = Number(value);
|
|
13
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const primary = getNumeric(preferred);
|
|
17
|
+
if (primary !== undefined) return primary;
|
|
18
|
+
|
|
19
|
+
const legacyValue = getNumeric(legacy);
|
|
20
|
+
if (legacyValue !== undefined) return legacyValue;
|
|
21
|
+
|
|
22
|
+
return fallback;
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
function initFilter() {
|
|
10
26
|
try {
|
|
11
|
-
|
|
27
|
+
const measurementNoise = resolveNoise(config.measurementNoise, config.r, 0.01);
|
|
28
|
+
const processNoise = resolveNoise(config.processNoise, config.q, 3);
|
|
29
|
+
kalmanFilter = new KalmanFilter({ R: measurementNoise, Q: processNoise });
|
|
12
30
|
} catch (error) {
|
|
13
31
|
}
|
|
14
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-boolean-logic-ultimate",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "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.",
|
|
5
5
|
"author": "Supergiovane (https://github.com/Supergiovane)",
|
|
6
6
|
"dependencies": {
|