node-red-contrib-dmx-for-ha 0.6.21 → 0.6.23
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/ha-mqtt-button.html +1 -1
- package/nodes/ha-mqtt-button.js +0 -2
- package/nodes/ha-mqtt-config.html +24 -1
- package/nodes/ha-mqtt-config.js +3 -1
- package/nodes/ha-mqtt-dmx-group.html +1 -1
- package/nodes/ha-mqtt-dmx-group.js +0 -2
- package/nodes/ha-mqtt-dmx.html +1 -1
- package/nodes/ha-mqtt-dmx.js +16 -9
- package/nodes/ha-mqtt-pir.html +1 -1
- package/nodes/ha-mqtt-pir.js +0 -2
- package/nodes/ha-mqtt-relay.html +1 -1
- package/nodes/ha-mqtt-relay.js +0 -2
- package/package.json +1 -1
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
</div>
|
|
314
314
|
|
|
315
315
|
<div style="margin-top:16px; padding-top:8px; border-top:1px solid #444; color:#666; font-size:0.8em; text-align:right;">
|
|
316
|
-
node-red-contrib-dmx-for-ha v0.6.
|
|
316
|
+
node-red-contrib-dmx-for-ha v0.6.23
|
|
317
317
|
</div>
|
|
318
318
|
|
|
319
319
|
</script>
|
package/nodes/ha-mqtt-button.js
CHANGED
|
@@ -22,7 +22,6 @@ module.exports = function (RED) {
|
|
|
22
22
|
if (!broker) { node.error('Button: no MQTT broker in config'); return; }
|
|
23
23
|
|
|
24
24
|
broker.register(node);
|
|
25
|
-
if (broker.client && broker.client.setMaxListeners) broker.client.setMaxListeners(0);
|
|
26
25
|
|
|
27
26
|
// ── Auto-discovery based on Discovery Mode ────────────────────
|
|
28
27
|
const discoveryMode = config.discoveryMode || 'enabled';
|
|
@@ -316,7 +315,6 @@ module.exports = function (RED) {
|
|
|
316
315
|
|
|
317
316
|
// ── Cleanup ───────────────────────────────────────────────
|
|
318
317
|
node.on('close', function (done) {
|
|
319
|
-
unregisterFixtureId();
|
|
320
318
|
broker.unsubscribe(S._activeBtnTopic || S.subscribeTopic, node.id);
|
|
321
319
|
broker.unsubscribe(uiBtnCmdTopic, node.id);
|
|
322
320
|
broker.deregister(node, done);
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
enabledDefault: { value: 'true' },
|
|
24
24
|
diskDelay: { value: '10' },
|
|
25
25
|
transitionRateLimit: { value: '1' },
|
|
26
|
-
transitionHaUiTime: { value:
|
|
26
|
+
transitionHaUiTime: { value: 1, validate: RED.validators.number() },
|
|
27
|
+
offTransition: { value: 1, validate: RED.validators.number() },
|
|
27
28
|
flashShort: { value: '1' },
|
|
28
29
|
flashLong: { value: '10' },
|
|
29
30
|
dmxFloor: { value: '3' },
|
|
@@ -205,6 +206,28 @@
|
|
|
205
206
|
min="1" style="width:70px" />
|
|
206
207
|
</div>
|
|
207
208
|
|
|
209
|
+
<div class="form-row">
|
|
210
|
+
<label for="node-config-input-transitionHaUiTime">
|
|
211
|
+
<i class="fa fa-clock-o"></i> Default ON transition
|
|
212
|
+
</label>
|
|
213
|
+
<input type="number" id="node-config-input-transitionHaUiTime"
|
|
214
|
+
min="0" max="60" step="0.1" style="width:70px" />
|
|
215
|
+
<span style="margin-left:8px; color:#999; font-size:0.85em;">
|
|
216
|
+
Seconds. Applied when HA sends ON without a transition time. 0 = snap on. Default: 1
|
|
217
|
+
</span>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<div class="form-row">
|
|
221
|
+
<label for="node-config-input-offTransition">
|
|
222
|
+
<i class="fa fa-clock-o"></i> Default OFF transition
|
|
223
|
+
</label>
|
|
224
|
+
<input type="number" id="node-config-input-offTransition"
|
|
225
|
+
min="0" max="60" step="0.1" style="width:70px" />
|
|
226
|
+
<span style="margin-left:8px; color:#999; font-size:0.85em;">
|
|
227
|
+
Seconds. Applied when HA sends OFF without a transition time. 0 = snap off. Default: 1
|
|
228
|
+
</span>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
208
231
|
<div class="form-row">
|
|
209
232
|
<label style="width:100%; font-weight:bold; color:#999; font-size:0.85em; text-transform:uppercase; letter-spacing:0.05em;">
|
|
210
233
|
<i class="fa fa-sliders"></i> DMX Channel Limits
|
package/nodes/ha-mqtt-config.js
CHANGED
|
@@ -63,7 +63,8 @@ module.exports = function (RED) {
|
|
|
63
63
|
this.transitionHaUiTime = parseFloat(config.transitionHaUiTime) || 1;
|
|
64
64
|
|
|
65
65
|
// DMX channel limits
|
|
66
|
-
this.dmxFloor
|
|
66
|
+
this.dmxFloor = parseInt(config.dmxFloor) >= 0 ? parseInt(config.dmxFloor) : 3;
|
|
67
|
+
this.offTransition = parseFloat(config.offTransition) >= 0 ? parseFloat(config.offTransition) : 1;
|
|
67
68
|
|
|
68
69
|
// ── Topic builder — omits empty zone segment ─────────────────────────
|
|
69
70
|
this.buildTopic = function() {
|
|
@@ -92,6 +93,7 @@ module.exports = function (RED) {
|
|
|
92
93
|
transitionRateLimit: this.transitionRateLimit,
|
|
93
94
|
transitionHaUiTime: this.transitionHaUiTime,
|
|
94
95
|
dmxFloor: this.dmxFloor,
|
|
96
|
+
offTransition: this.offTransition,
|
|
95
97
|
};
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -317,7 +317,7 @@
|
|
|
317
317
|
</div>
|
|
318
318
|
|
|
319
319
|
<div style="margin-top:16px; padding-top:8px; border-top:1px solid #444; color:#666; font-size:0.8em; text-align:right;">
|
|
320
|
-
node-red-contrib-dmx-for-ha v0.6.
|
|
320
|
+
node-red-contrib-dmx-for-ha v0.6.23
|
|
321
321
|
</div>
|
|
322
322
|
|
|
323
323
|
</script>
|
|
@@ -25,7 +25,6 @@ module.exports = function (RED) {
|
|
|
25
25
|
if (!broker) { node.error('DMX Group: no MQTT broker in config'); return; }
|
|
26
26
|
|
|
27
27
|
broker.register(node);
|
|
28
|
-
if (broker.client && broker.client.setMaxListeners) broker.client.setMaxListeners(0);
|
|
29
28
|
|
|
30
29
|
// ── Auto-discovery based on Discovery Mode ────────────────────
|
|
31
30
|
const discoveryMode = config.discoveryMode || 'enabled';
|
|
@@ -418,7 +417,6 @@ module.exports = function (RED) {
|
|
|
418
417
|
|
|
419
418
|
// ── Cleanup ───────────────────────────────────────────────
|
|
420
419
|
node.on('close', function (done) {
|
|
421
|
-
unregisterFixtureId();
|
|
422
420
|
if (diskTimer) clearTimeout(diskTimer);
|
|
423
421
|
broker.unsubscribe(cmdTopic, node.id);
|
|
424
422
|
broker.deregister(node, done);
|
package/nodes/ha-mqtt-dmx.html
CHANGED
|
@@ -584,7 +584,7 @@
|
|
|
584
584
|
</div>
|
|
585
585
|
|
|
586
586
|
<div style="margin-top:16px; padding-top:8px; border-top:1px solid #444; color:#666; font-size:0.8em; text-align:right;">
|
|
587
|
-
node-red-contrib-dmx-for-ha v0.6.
|
|
587
|
+
node-red-contrib-dmx-for-ha v0.6.23
|
|
588
588
|
</div>
|
|
589
589
|
|
|
590
590
|
</script>
|
package/nodes/ha-mqtt-dmx.js
CHANGED
|
@@ -32,7 +32,6 @@ module.exports = function (RED) {
|
|
|
32
32
|
if (!broker) { node.error('DMX: no MQTT broker in config'); return; }
|
|
33
33
|
|
|
34
34
|
broker.register(node);
|
|
35
|
-
if (broker.client && broker.client.setMaxListeners) broker.client.setMaxListeners(0);
|
|
36
35
|
|
|
37
36
|
// ── Auto-discovery based on Discovery Mode ────────────────────
|
|
38
37
|
const discoveryMode = config.discoveryMode || 'enabled';
|
|
@@ -226,16 +225,15 @@ module.exports = function (RED) {
|
|
|
226
225
|
// ── DMX helpers ───────────────────────────────────────────
|
|
227
226
|
function scaleToDmx(colorValue, brightness) {
|
|
228
227
|
brightness = brightness !== undefined ? brightness : 255;
|
|
229
|
-
// Hard zero — never apply any floor when brightness is 0 (OFF)
|
|
230
|
-
if (brightness === 0) return 0;
|
|
231
228
|
const limited = Math.round((colorValue / 255) * (brightness / 255) * S.dmxLimiter);
|
|
232
229
|
const gamma = GAMMA_TABLE[Math.max(0, Math.min(255, limited))];
|
|
233
230
|
// Min output floor — only apply when both inputs are non-zero (intentionally on)
|
|
234
231
|
if (gamma === 0 && colorValue > 0 && brightness > 0 && S.minOutput > 0) {
|
|
235
232
|
return S.minOutput;
|
|
236
233
|
}
|
|
237
|
-
// DMX floor — snap up if
|
|
238
|
-
|
|
234
|
+
// DMX floor — snap up if intentionally on (colorValue >= 3) and below floor
|
|
235
|
+
// colorValue 1-2 is HA colour wheel bleed — allow to go to 0
|
|
236
|
+
if (colorValue >= 3 && gamma < S.dmxFloor) return S.dmxFloor;
|
|
239
237
|
// Note: ceiling is handled by S.dmxLimiter in scaleToDmx above
|
|
240
238
|
return gamma;
|
|
241
239
|
}
|
|
@@ -422,7 +420,13 @@ module.exports = function (RED) {
|
|
|
422
420
|
const progress = Math.min(1, tick / totalTicks);
|
|
423
421
|
const channels = fromChannels.map(function ([ch, from], i) {
|
|
424
422
|
const to = toChannels[i] ? toChannels[i][1] : 0;
|
|
425
|
-
|
|
423
|
+
const raw = Math.round(from + (to - from) * progress);
|
|
424
|
+
// Floor: if target is ON, snap low values up to floor
|
|
425
|
+
// if target is OFF, jump from floor directly to 0
|
|
426
|
+
const floored = raw <= 0 ? 0
|
|
427
|
+
: raw < S.dmxFloor ? (to <= 0 ? 0 : S.dmxFloor)
|
|
428
|
+
: raw;
|
|
429
|
+
return [ch, floored];
|
|
426
430
|
});
|
|
427
431
|
sendDmxChannels(channels);
|
|
428
432
|
if (tick >= totalTicks) {
|
|
@@ -501,9 +505,13 @@ module.exports = function (RED) {
|
|
|
501
505
|
|
|
502
506
|
const toChannels = buildColorChannels(0, r, g, b, w, ww);
|
|
503
507
|
|
|
504
|
-
|
|
508
|
+
// OFF transition: use HA payload time, or config offTransition default
|
|
509
|
+
const offDuration = (payload && payload.transition && payload.transition > 0)
|
|
510
|
+
? payload.transition
|
|
511
|
+
: (cfg.offTransition || 0);
|
|
512
|
+
if (S.transitions && offDuration > 0) {
|
|
505
513
|
const fromChannels = buildColorChannels(brightness, r, g, b, w, ww);
|
|
506
|
-
runTransition(fromChannels, toChannels,
|
|
514
|
+
runTransition(fromChannels, toChannels, offDuration);
|
|
507
515
|
} else {
|
|
508
516
|
sendDmxChannels(toChannels);
|
|
509
517
|
}
|
|
@@ -867,7 +875,6 @@ module.exports = function (RED) {
|
|
|
867
875
|
|
|
868
876
|
// ── Cleanup ───────────────────────────────────────────────
|
|
869
877
|
node.on('close', function (done) {
|
|
870
|
-
unregisterFixtureId();
|
|
871
878
|
clearChannelRegistry();
|
|
872
879
|
stopEffect();
|
|
873
880
|
if (diskTimer) clearTimeout(diskTimer);
|
package/nodes/ha-mqtt-pir.html
CHANGED
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
</div>
|
|
319
319
|
|
|
320
320
|
<div style="margin-top:16px; padding-top:8px; border-top:1px solid #444; color:#666; font-size:0.8em; text-align:right;">
|
|
321
|
-
node-red-contrib-dmx-for-ha v0.6.
|
|
321
|
+
node-red-contrib-dmx-for-ha v0.6.23
|
|
322
322
|
</div>
|
|
323
323
|
|
|
324
324
|
</script>
|
package/nodes/ha-mqtt-pir.js
CHANGED
|
@@ -22,7 +22,6 @@ module.exports = function (RED) {
|
|
|
22
22
|
if (!broker) { node.error('PIR: no MQTT broker in config'); return; }
|
|
23
23
|
|
|
24
24
|
broker.register(node);
|
|
25
|
-
if (broker.client && broker.client.setMaxListeners) broker.client.setMaxListeners(0);
|
|
26
25
|
|
|
27
26
|
// ── Auto-discovery based on Discovery Mode ────────────────────
|
|
28
27
|
const discoveryMode = config.discoveryMode || 'enabled';
|
|
@@ -350,7 +349,6 @@ module.exports = function (RED) {
|
|
|
350
349
|
|
|
351
350
|
// ── Cleanup ───────────────────────────────────────────────
|
|
352
351
|
node.on('close', function (done) {
|
|
353
|
-
unregisterFixtureId();
|
|
354
352
|
cancelWarmup();
|
|
355
353
|
broker.unsubscribe(S._activePirTopic || S.subscribeTopic, node.id);
|
|
356
354
|
broker.deregister(node, done);
|
package/nodes/ha-mqtt-relay.html
CHANGED
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
</div>
|
|
302
302
|
|
|
303
303
|
<div style="margin-top:16px; padding-top:8px; border-top:1px solid #444; color:#666; font-size:0.8em; text-align:right;">
|
|
304
|
-
node-red-contrib-dmx-for-ha v0.6.
|
|
304
|
+
node-red-contrib-dmx-for-ha v0.6.23
|
|
305
305
|
</div>
|
|
306
306
|
|
|
307
307
|
</script>
|
package/nodes/ha-mqtt-relay.js
CHANGED
|
@@ -25,7 +25,6 @@ module.exports = function (RED) {
|
|
|
25
25
|
if (!broker) { node.error('Relay: no MQTT broker in config'); return; }
|
|
26
26
|
|
|
27
27
|
broker.register(node);
|
|
28
|
-
if (broker.client && broker.client.setMaxListeners) broker.client.setMaxListeners(0);
|
|
29
28
|
|
|
30
29
|
// ── Auto-discovery based on Discovery Mode ────────────────────
|
|
31
30
|
const discoveryMode = config.discoveryMode || 'enabled';
|
|
@@ -454,7 +453,6 @@ module.exports = function (RED) {
|
|
|
454
453
|
|
|
455
454
|
// ── Cleanup ───────────────────────────────────────────────
|
|
456
455
|
node.on('close', function (done) {
|
|
457
|
-
unregisterFixtureId();
|
|
458
456
|
stopEffect();
|
|
459
457
|
if (diskTimer) clearTimeout(diskTimer);
|
|
460
458
|
broker.unsubscribe(cmdTopic, node.id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-dmx-for-ha",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.23",
|
|
4
4
|
"description": "DMX lighting control for Home Assistant via Node-RED and MQTT. Place a node, fill in the settings, deploy. Full HA device registry integration with RGBW/RGBWW/CCT/brightness colour modes, transitions, effects, and group control.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red",
|