@bldgblocks/node-red-contrib-control 0.2.2 → 0.2.3
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/nodes/alarm-collector.html +2 -2
- package/nodes/alarm-collector.js +33 -50
- package/nodes/alarm-service.js +1 -1
- package/nodes/boolean-to-number-block.html +13 -4
- package/nodes/boolean-to-number-block.js +6 -2
- package/nodes/call-status-block.js +29 -3
- package/nodes/changeover-block.html +31 -25
- package/nodes/changeover-block.js +26 -7
- package/nodes/comment-block.html +48 -9
- package/nodes/comment-block.js +65 -6
- package/nodes/contextual-label-block.js +3 -2
- package/nodes/convert-block.js +1 -1
- package/nodes/edge-block.html +6 -3
- package/nodes/edge-block.js +4 -3
- package/nodes/enum-switch-block.html +1 -1
- package/nodes/global-setter.html +18 -11
- package/nodes/global-setter.js +62 -45
- package/nodes/hysteresis-block.js +1 -1
- package/nodes/interpolate-block.js +2 -2
- package/nodes/negate-block.js +2 -2
- package/nodes/network-point-register.js +11 -2
- package/nodes/network-service-write.js +7 -11
- package/nodes/on-change-block.js +1 -8
- package/nodes/priority-block.js +6 -6
- package/nodes/rate-limit-block.js +6 -6
- package/nodes/round-block.js +1 -1
- package/nodes/scale-range-block.js +1 -1
- package/nodes/tstat-block.html +21 -13
- package/nodes/tstat-block.js +32 -1
- package/nodes/units-block.js +1 -1
- package/nodes/utils.js +11 -1
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ module.exports = function(RED) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// Set initial status
|
|
38
|
-
utils.setStatusOK(node,
|
|
38
|
+
utils.setStatusOK(node, `${node.currentValue.toFixed(2)}`);
|
|
39
39
|
|
|
40
40
|
let updateTimer = null;
|
|
41
41
|
|
|
@@ -58,7 +58,7 @@ module.exports = function(RED) {
|
|
|
58
58
|
node.lastUpdate = now;
|
|
59
59
|
const msg = RED.util.cloneMessage(node.lastInputMsg);
|
|
60
60
|
msg.payload = node.currentValue;
|
|
61
|
-
utils.setStatusOK(node,
|
|
61
|
+
utils.setStatusOK(node, `${node.currentValue.toFixed(2)}`);
|
|
62
62
|
node.send(msg);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -151,7 +151,7 @@ module.exports = function(RED) {
|
|
|
151
151
|
|
|
152
152
|
if (node.mode === "rate-limit") {
|
|
153
153
|
node.targetValue = inputValue;
|
|
154
|
-
utils.setStatusOK(node, `
|
|
154
|
+
utils.setStatusOK(node, `target: ${node.targetValue.toFixed(2)}`);
|
|
155
155
|
updateRateLimitOutput();
|
|
156
156
|
startTimer();
|
|
157
157
|
} else if (node.mode === "threshold") {
|
|
@@ -159,15 +159,15 @@ module.exports = function(RED) {
|
|
|
159
159
|
if (diff > node.threshold) {
|
|
160
160
|
msg.payload = inputValue;
|
|
161
161
|
node.currentValue = inputValue;
|
|
162
|
-
utils.setStatusChanged(node,
|
|
162
|
+
utils.setStatusChanged(node, `${node.currentValue.toFixed(2)}`);
|
|
163
163
|
send(msg);
|
|
164
164
|
} else {
|
|
165
|
-
utils.setStatusUnchanged(node,
|
|
165
|
+
utils.setStatusUnchanged(node, `${node.currentValue.toFixed(2)}`);
|
|
166
166
|
}
|
|
167
167
|
} else if (node.mode === "full-value") {
|
|
168
168
|
node.currentValue = inputValue;
|
|
169
169
|
msg.payload = inputValue;
|
|
170
|
-
utils.setStatusChanged(node,
|
|
170
|
+
utils.setStatusChanged(node, `${node.currentValue.toFixed(2)}`);
|
|
171
171
|
send(msg);
|
|
172
172
|
}
|
|
173
173
|
|
package/nodes/round-block.js
CHANGED
|
@@ -122,7 +122,7 @@ module.exports = function(RED) {
|
|
|
122
122
|
node.lastInput = inputValue;
|
|
123
123
|
const out = calculate(inputValue, node.inMin, node.inMax, node.outMin, node.outMax, node.clamp);
|
|
124
124
|
msg.payload = out;
|
|
125
|
-
utils.setStatusOK(node,
|
|
125
|
+
utils.setStatusOK(node, `${out.toFixed(2)}`);
|
|
126
126
|
send(msg);
|
|
127
127
|
|
|
128
128
|
if (done) done();
|
package/nodes/tstat-block.html
CHANGED
|
@@ -129,76 +129,84 @@
|
|
|
129
129
|
]
|
|
130
130
|
}, "msg", "flow", "global"],
|
|
131
131
|
typeField: "#node-input-algorithmType"
|
|
132
|
-
})
|
|
132
|
+
});
|
|
133
133
|
|
|
134
134
|
$("#node-input-setpoint").typedInput({
|
|
135
135
|
default: "num",
|
|
136
136
|
types: ["num", "msg", "flow", "global"],
|
|
137
137
|
typeField: "#node-input-setpointType"
|
|
138
|
-
})
|
|
138
|
+
});
|
|
139
139
|
|
|
140
140
|
$("#node-input-heatingSetpoint").typedInput({
|
|
141
141
|
default: "num",
|
|
142
142
|
types: ["num", "msg", "flow", "global"],
|
|
143
143
|
typeField: "#node-input-heatingSetpointType"
|
|
144
|
-
})
|
|
144
|
+
});
|
|
145
145
|
|
|
146
146
|
$("#node-input-coolingSetpoint").typedInput({
|
|
147
147
|
default: "num",
|
|
148
148
|
types: ["num", "msg", "flow", "global"],
|
|
149
149
|
typeField: "#node-input-coolingSetpointType"
|
|
150
|
-
})
|
|
150
|
+
});
|
|
151
151
|
|
|
152
152
|
$("#node-input-coolingOn").typedInput({
|
|
153
153
|
default: "num",
|
|
154
154
|
types: ["num", "msg", "flow", "global"],
|
|
155
155
|
typeField: "#node-input-coolingOnType"
|
|
156
|
-
})
|
|
156
|
+
});
|
|
157
157
|
|
|
158
158
|
$("#node-input-coolingOff").typedInput({
|
|
159
159
|
default: "num",
|
|
160
160
|
types: ["num", "msg", "flow", "global"],
|
|
161
161
|
typeField: "#node-input-coolingOffType"
|
|
162
|
-
})
|
|
162
|
+
});
|
|
163
163
|
|
|
164
164
|
$("#node-input-heatingOff").typedInput({
|
|
165
165
|
default: "num",
|
|
166
166
|
types: ["num", "msg", "flow", "global"],
|
|
167
167
|
typeField: "#node-input-heatingOffType"
|
|
168
|
-
})
|
|
168
|
+
});
|
|
169
169
|
|
|
170
170
|
$("#node-input-heatingOn").typedInput({
|
|
171
171
|
default: "num",
|
|
172
172
|
types: ["num", "msg", "flow", "global"],
|
|
173
173
|
typeField: "#node-input-heatingOnType"
|
|
174
|
-
})
|
|
174
|
+
});
|
|
175
175
|
|
|
176
176
|
$("#node-input-diff").typedInput({
|
|
177
177
|
default: "num",
|
|
178
178
|
types: ["num", "msg", "flow", "global"],
|
|
179
179
|
typeField: "#node-input-diffType"
|
|
180
|
-
})
|
|
180
|
+
});
|
|
181
181
|
|
|
182
182
|
$("#node-input-anticipator").typedInput({
|
|
183
183
|
default: "num",
|
|
184
184
|
types: ["num", "msg", "flow", "global"],
|
|
185
185
|
typeField: "#node-input-anticipatorType"
|
|
186
|
-
})
|
|
186
|
+
});
|
|
187
187
|
|
|
188
188
|
$("#node-input-ignoreAnticipatorCycles").typedInput({
|
|
189
189
|
default: "num",
|
|
190
190
|
types: ["num", "msg", "flow", "global"],
|
|
191
191
|
typeField: "#node-input-ignoreAnticipatorCyclesType"
|
|
192
|
-
})
|
|
192
|
+
});
|
|
193
193
|
|
|
194
194
|
$("#node-input-isHeating").typedInput({
|
|
195
195
|
default: "bool",
|
|
196
196
|
types: ["bool", "msg", "flow", "global"],
|
|
197
197
|
typeField: "#node-input-isHeatingType"
|
|
198
|
-
})
|
|
198
|
+
});
|
|
199
199
|
|
|
200
200
|
function toggleFields() {
|
|
201
|
-
const
|
|
201
|
+
const type = $("#node-input-algorithm").typedInput("type");
|
|
202
|
+
if (type !== "dropdown") {
|
|
203
|
+
// Dynamic source — hide all, resolved at runtime
|
|
204
|
+
$singleFields.hide();
|
|
205
|
+
$splitFields.hide();
|
|
206
|
+
$specifiedFields.hide();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const algorithm = $("#node-input-algorithm").typedInput("value");
|
|
202
210
|
if (algorithm === "single") {
|
|
203
211
|
$singleFields.show();
|
|
204
212
|
$splitFields.hide();
|
package/nodes/tstat-block.js
CHANGED
|
@@ -287,6 +287,13 @@ module.exports = function(RED) {
|
|
|
287
287
|
// ----------------------------------------------------------------
|
|
288
288
|
// 6. Startup suppression
|
|
289
289
|
// ----------------------------------------------------------------
|
|
290
|
+
// Prevent call state from accumulating during startup.
|
|
291
|
+
// Without this, above/below can latch ON while output is
|
|
292
|
+
// suppressed, then emit a false call the moment startup ends.
|
|
293
|
+
if (!node.startupComplete) {
|
|
294
|
+
above = false;
|
|
295
|
+
below = false;
|
|
296
|
+
}
|
|
290
297
|
const outputAbove = node.startupComplete ? above : false;
|
|
291
298
|
const outputBelow = node.startupComplete ? below : false;
|
|
292
299
|
|
|
@@ -324,7 +331,31 @@ module.exports = function(RED) {
|
|
|
324
331
|
? `<${onThreshold.toFixed(1)}`
|
|
325
332
|
: `>${onThreshold.toFixed(1)}`;
|
|
326
333
|
const suffix = !node.startupComplete ? " [startup]" : "";
|
|
327
|
-
|
|
334
|
+
let thresholdText, hysteresisText;
|
|
335
|
+
if (node.isHeating) {
|
|
336
|
+
thresholdText = `<${onThreshold.toFixed(1)}`;
|
|
337
|
+
if (outputBelow && input > onThreshold && input <= offThreshold) {
|
|
338
|
+
hysteresisText = ` (holding, off at >${offThreshold.toFixed(1)})`;
|
|
339
|
+
} else if (outputBelow && input < onThreshold) {
|
|
340
|
+
hysteresisText = " (on)";
|
|
341
|
+
} else if (!outputBelow && input > offThreshold) {
|
|
342
|
+
hysteresisText = " (off)";
|
|
343
|
+
} else {
|
|
344
|
+
hysteresisText = "";
|
|
345
|
+
}
|
|
346
|
+
} else {
|
|
347
|
+
thresholdText = `>${onThreshold.toFixed(1)}`;
|
|
348
|
+
if (outputAbove && input < onThreshold && input >= offThreshold) {
|
|
349
|
+
hysteresisText = ` (holding, off at <${offThreshold.toFixed(1)})`;
|
|
350
|
+
} else if (outputAbove && input > onThreshold) {
|
|
351
|
+
hysteresisText = " (on)";
|
|
352
|
+
} else if (!outputAbove && input < offThreshold) {
|
|
353
|
+
hysteresisText = " (off)";
|
|
354
|
+
} else {
|
|
355
|
+
hysteresisText = "";
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const text = `${input.toFixed(1)}° ${thresholdText} [${mode}] call:${call}${hysteresisText}${suffix}`;
|
|
328
359
|
|
|
329
360
|
if (outputAbove === lastAbove && outputBelow === lastBelow) {
|
|
330
361
|
utils.setStatusUnchanged(node, text);
|
package/nodes/units-block.js
CHANGED
|
@@ -38,7 +38,7 @@ module.exports = function(RED) {
|
|
|
38
38
|
|
|
39
39
|
const payloadPreview = input !== null ? (typeof input === "number" ? input.toFixed(2) : JSON.stringify(input).slice(0, 20)) : "none";
|
|
40
40
|
|
|
41
|
-
utils.setStatusOK(node,
|
|
41
|
+
utils.setStatusOK(node, `${node.unit !== "" ? node.unit : "none"}`);
|
|
42
42
|
|
|
43
43
|
msg.units = node.unit;
|
|
44
44
|
send(msg);
|
package/nodes/utils.js
CHANGED
|
@@ -93,14 +93,24 @@ module.exports = function(RED) {
|
|
|
93
93
|
let value = state.defaultValue;
|
|
94
94
|
let priority = 'default';
|
|
95
95
|
|
|
96
|
+
// Check priorities 1-16 first (highest)
|
|
96
97
|
for (let i = 1; i <= 16; i++) {
|
|
97
98
|
// Check strictly for undefined/null, allow 0 or false
|
|
98
99
|
if (state.priority[i] !== undefined && state.priority[i] !== null) {
|
|
99
100
|
value = state.priority[i];
|
|
100
101
|
priority = String(i);
|
|
101
|
-
|
|
102
|
+
return { value, priority };
|
|
102
103
|
}
|
|
103
104
|
}
|
|
105
|
+
|
|
106
|
+
// Fall through to fallback slot if no priority is set
|
|
107
|
+
if (state.fallback !== undefined && state.fallback !== null) {
|
|
108
|
+
value = state.fallback;
|
|
109
|
+
priority = 'fallback';
|
|
110
|
+
return { value, priority };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Finally fall back to default
|
|
104
114
|
return { value, priority };
|
|
105
115
|
}
|
|
106
116
|
|