node-red-contrib-knx-ultimate 2.2.24 → 2.2.25
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 +7 -0
- package/nodes/hue-config.js +44 -23
- package/nodes/knxUltimate-config.js +2 -2
- package/nodes/knxUltimateHueLight.html +30 -12
- package/nodes/knxUltimateHueLight.js +103 -47
- package/nodes/utils/hueEngine.js +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
# CHANGELOG
|
|
8
8
|
|
|
9
|
+
**Version 2.2.25** - November 2023<br/>
|
|
10
|
+
- HUE Light: fixed settings of some behaviour options.<br/>
|
|
11
|
+
- You can now query the HUE Light node stati, via a "read" telegram sent to the KNX stati group address. ("Status" is Latin, not English, so the plural is "stati" and not "statuses" nor "status"). Other HUE nodes will follow asap.<br/>
|
|
12
|
+
- Fixed some little bugs.<br/>
|
|
13
|
+
- Fixed an issue where in some circumstances, the HUE Light turn off by itself.<br/>
|
|
14
|
+
- WARNING: the new HUE Light options are to be considered **BETA (= in testing with user feedback)**.<br/>
|
|
15
|
+
|
|
9
16
|
**Version 2.2.24** - November 2023<br/>
|
|
10
17
|
- HUE Light: added DPT 9.002 for direct kelvin selection, with HUE range (2000K-6535K). There is another DPT 7.600 with the KNX scale (0K-6553K) avaiable.<br/>
|
|
11
18
|
- NEW: HUE Light: now you can choose the "switch on" behaviour between color and temperature (in Kelvin) + brightness.<br/>
|
package/nodes/hue-config.js
CHANGED
|
@@ -111,29 +111,30 @@ module.exports = (RED) => {
|
|
|
111
111
|
});
|
|
112
112
|
// Connected
|
|
113
113
|
node.hueManager.on("connected", () => {
|
|
114
|
-
node.linkStatus
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
114
|
+
if (node.linkStatus === "disconnected") {
|
|
115
|
+
node.linkStatus = "connected";
|
|
116
|
+
// Start the timer to do initial read.
|
|
117
|
+
if (node.timerDoInitialRead !== null) clearTimeout(node.timerDoInitialRead);
|
|
118
|
+
node.timerDoInitialRead = setTimeout(() => {
|
|
119
|
+
(async () => {
|
|
120
|
+
try {
|
|
121
|
+
await node.loadResourcesFromHUEBridge();
|
|
122
|
+
} catch (error) {
|
|
123
|
+
node.linkStatus = "disconnected";
|
|
124
|
+
node.nodeClients.forEach((_oClient) => {
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
_oClient.setNodeStatusHue({
|
|
127
|
+
fill: "red",
|
|
128
|
+
shape: "ring",
|
|
129
|
+
text: "HUE",
|
|
130
|
+
payload: error.message,
|
|
131
|
+
});
|
|
132
|
+
}, 1000);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
})();
|
|
136
|
+
}, 6000); // 17/02/2020 Do initial read of all nodes requesting initial read
|
|
137
|
+
}
|
|
137
138
|
});
|
|
138
139
|
|
|
139
140
|
node.hueManager.on("disconnected", () => {
|
|
@@ -204,6 +205,25 @@ module.exports = (RED) => {
|
|
|
204
205
|
//})();
|
|
205
206
|
};
|
|
206
207
|
|
|
208
|
+
node.getFirstLightInGroup = function getFirstLightInGroup(_groupID) {
|
|
209
|
+
if (node.hueAllResources === undefined) return;
|
|
210
|
+
// Find the group
|
|
211
|
+
const group = node.hueAllResources.filter((a) => a.id === _groupID)[0];
|
|
212
|
+
if (group === null || group === undefined) return;
|
|
213
|
+
const owner = node.hueAllResources.filter((a) => a.id === group.owner.rid)[0];
|
|
214
|
+
if (owner.children !== undefined && owner.children.length > 0) {
|
|
215
|
+
const firstLightId = owner.children.find((a) => a.rtype === "light").rid;
|
|
216
|
+
if (firstLightId !== undefined && firstLightId !== null) {
|
|
217
|
+
const firstLight = node.hueAllResources.find((a) => a.id === firstLightId);
|
|
218
|
+
if (firstLight !== null && firstLight !== undefined) {
|
|
219
|
+
return firstLight;
|
|
220
|
+
} else {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
207
227
|
// Returns the cached devices (node.hueAllResources) by type.
|
|
208
228
|
node.getResources = function getResources(_rtype) {
|
|
209
229
|
try {
|
|
@@ -425,6 +445,7 @@ module.exports = (RED) => {
|
|
|
425
445
|
if (serverNode === null) {
|
|
426
446
|
RED.log.error(`Warn KNXUltimateGetResourcesHUE serverNode is null`);
|
|
427
447
|
res.json({ devices: `serverNode not set` });
|
|
448
|
+
return;
|
|
428
449
|
}
|
|
429
450
|
const jRet = serverNode.getResources(req.query.rtype);
|
|
430
451
|
if (jRet !== undefined) {
|
|
@@ -1244,7 +1244,7 @@ return msg;`,
|
|
|
1244
1244
|
devicename: msg.devicename,
|
|
1245
1245
|
});
|
|
1246
1246
|
input.handleSend(msg);
|
|
1247
|
-
} else if (input.topic
|
|
1247
|
+
} else if (input.topic === _dest) {
|
|
1248
1248
|
// 04/02/2020 Watchdog implementation
|
|
1249
1249
|
if (input.hasOwnProperty("isWatchDog")) {
|
|
1250
1250
|
// Is a watchdog node
|
|
@@ -1333,7 +1333,7 @@ return msg;`,
|
|
|
1333
1333
|
devicename: msg.devicename,
|
|
1334
1334
|
});
|
|
1335
1335
|
input.handleSend(msg);
|
|
1336
|
-
} else if (input.topic
|
|
1336
|
+
} else if (input.topic === _dest) {
|
|
1337
1337
|
// 04/02/2020 Watchdog implementation
|
|
1338
1338
|
if (input.hasOwnProperty("isWatchDog")) {
|
|
1339
1339
|
// Is a watchdog node
|
|
@@ -105,6 +105,27 @@
|
|
|
105
105
|
var oNodeServer = RED.nodes.node($("#node-input-server").val()); // Store the config-node
|
|
106
106
|
var oNodeServerHue = RED.nodes.node($("#node-input-serverHue").val()); // Store the config-node
|
|
107
107
|
|
|
108
|
+
// TIMER BLINK ####################################################
|
|
109
|
+
let blinkStatus = 2;
|
|
110
|
+
let timerBlinkBackground;
|
|
111
|
+
function blinkBackground(_elementIDwithHashAtTheBeginning) {
|
|
112
|
+
if (timerBlinkBackground !== undefined) clearInterval(timerBlinkBackground);
|
|
113
|
+
timerBlinkBackground = setInterval(() => {
|
|
114
|
+
if (isEven(blinkStatus)) $(_elementIDwithHashAtTheBeginning).css("background-color", "lightgreen");
|
|
115
|
+
if (!isEven(blinkStatus)) $(_elementIDwithHashAtTheBeginning).css("background-color", "");
|
|
116
|
+
blinkStatus += 1;
|
|
117
|
+
if (blinkStatus >= 14) {
|
|
118
|
+
clearInterval(timerBlinkBackground);
|
|
119
|
+
blinkStatus = 2;
|
|
120
|
+
$(_elementIDwithHashAtTheBeginning).css("background-color", "");
|
|
121
|
+
}
|
|
122
|
+
}, 100);
|
|
123
|
+
}
|
|
124
|
+
function isEven(n) {
|
|
125
|
+
return (n % 2 == 0);
|
|
126
|
+
}
|
|
127
|
+
// ################################################################
|
|
128
|
+
|
|
108
129
|
$("#tabs").tabs(); // Tabs gestione KNX
|
|
109
130
|
|
|
110
131
|
// 19/02/2020 Used to get the server sooner als deploy.
|
|
@@ -259,6 +280,7 @@
|
|
|
259
280
|
if ($("#node-input-specifySwitchOnBrightness").val() === "yes") {
|
|
260
281
|
$("#divColorsAtSwitchOn").show();
|
|
261
282
|
$("#divTemperatureAtSwitchOn").hide();
|
|
283
|
+
blinkBackground("#colorPickerDay");
|
|
262
284
|
} else if ($("#node-input-specifySwitchOnBrightness").val() === "temperature") {
|
|
263
285
|
$("#divColorsAtSwitchOn").hide();
|
|
264
286
|
$("#divTemperatureAtSwitchOn").show();
|
|
@@ -290,6 +312,8 @@
|
|
|
290
312
|
$("#divCCSBoxAtNightLighting").css({ border: "1px solid dimgrey", "border-radius": "12px", padding: "5px" }); // Add little box to better understand the property page
|
|
291
313
|
$("#divColorsAtSwitchOnNightTime").show();
|
|
292
314
|
$("#divTemperatureAtSwitchOnNightTime").hide();
|
|
315
|
+
blinkBackground("#colorPickerNight")
|
|
316
|
+
$("#getColorAtSwitchOnDayTimeButton").text("Get again");
|
|
293
317
|
} else if ($("#node-input-enableDayNightLighting").val() === "temperature") {
|
|
294
318
|
$("#divEnableDayNightLighting").show();
|
|
295
319
|
$("#divCCSBoxAtNightLighting").css({ border: "1px solid dimgrey", "border-radius": "12px", padding: "5px" }); // Add little box to better understand the property page
|
|
@@ -385,10 +409,7 @@
|
|
|
385
409
|
$.getJSON(sQuery + "?id=" + $("#node-input-hueDevice").val().split("#")[0], (data) => {
|
|
386
410
|
$("#node-input-colorAtSwitchOnDayTime").val(data);
|
|
387
411
|
$("#colorPickerDay").val(data);
|
|
388
|
-
|
|
389
|
-
setTimeout(() => {
|
|
390
|
-
$("#colorPickerDay").css("background-color", "");
|
|
391
|
-
}, 500);
|
|
412
|
+
blinkBackground("#colorPickerDay")
|
|
392
413
|
$("#getColorAtSwitchOnDayTimeButton").text("Get again");
|
|
393
414
|
});
|
|
394
415
|
});
|
|
@@ -402,10 +423,7 @@
|
|
|
402
423
|
$.getJSON(sQuery + "?id=" + $("#node-input-hueDevice").val().split("#")[0], (data) => {
|
|
403
424
|
$("#node-input-colorAtSwitchOnNightTime").val(data);
|
|
404
425
|
$("#colorPickerNight").val(data);
|
|
405
|
-
|
|
406
|
-
setTimeout(() => {
|
|
407
|
-
$("#colorPickerNight").css("background-color", "");
|
|
408
|
-
}, 500);
|
|
426
|
+
blinkBackground("#colorPickerNight")
|
|
409
427
|
$("#getColorAtSwitchOnNightTimeButton").text("Get again");
|
|
410
428
|
});
|
|
411
429
|
});
|
|
@@ -924,7 +942,7 @@
|
|
|
924
942
|
<i class="fa fa-tag"></i> KNX Brightness Status
|
|
925
943
|
</label>
|
|
926
944
|
<select id="node-input-updateKNXBrightnessStatusOnHUEOnOff">
|
|
927
|
-
<option value="onhueoff">When HUE light is Off
|
|
945
|
+
<option value="onhueoff">When HUE light is Off send 0%. When HUE On, restore previous value (Default KNX behaviour)</option>
|
|
928
946
|
<option value="no">Leave as is (default HUE behaviour)</option>
|
|
929
947
|
</select>
|
|
930
948
|
</div>
|
|
@@ -1103,9 +1121,9 @@ Start typing in the GA field, the name or group address of your KNX device, the
|
|
|
1103
1121
|
|
|
1104
1122
|
| Property | Description |
|
|
1105
1123
|
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1106
|
-
| KNX Brightness Status | Updates the KNX brightness group address status, whenever the HUE lamp is switched ON/OFF. The options are **When HUE light is Off
|
|
1107
|
-
| Switch on behaviour | It sets the behaviour of your lights when switched on. You can choose from differents behaviours.<br/>**Select color:** the light will be switched on with the color of your choice.<br/>**Select temperature and brightness:** the light will be switched on with the temperature (Kelvin) and brightness (0-100) of your choice.<br>**Last status:** the light will be switched on in the last status. |
|
|
1108
|
-
| Night Lighting | It allows to set a particular light color/brightness at nighttime.
|
|
1124
|
+
| KNX Brightness Status | Updates the KNX brightness group address status, whenever the HUE lamp is switched ON/OFF. The options are **When HUE light is Off send 0%. When HUE On, restore previous value (Default KNX behaviour)** and **Leave as is (default HUE behaviour)**. If you have KNX dimmer with brightness status, like MDT, the suggested option is ***When HUE light is Off send 0%. When HUE On, restore previous value (Default KNX behaviour)*** |
|
|
1125
|
+
| Switch on behaviour | It sets the behaviour of your lights when switched on. You can choose from differents behaviours.<br/>**Select color:** the light will be switched on with the color of your choice. To change color, just CLICK on the color selector (under the *Select color* control).<br/>**Select temperature and brightness:** the light will be switched on with the temperature (Kelvin) and brightness (0-100) of your choice.<br>**Last status:** the light will be switched on in the last status. |
|
|
1126
|
+
| Night Lighting | It allows to set a particular light color/brightness at nighttime. The options are the same as the daytime. You could select either a temperature/brightness or color. A cozy temperature of 2700 Kelvin, with a brightness of 10% or 20%, is a good choice for bathroom's night light.|
|
|
1109
1127
|
| Day/Night | Select the group address used to set the day/night behaviour. The group address value is _true_ if daytime, _false_ if nighttime. |
|
|
1110
1128
|
| Invert day/night values | Invert the values of _Day/Night_ group address. Default value is **unchecked**. |
|
|
1111
1129
|
| Dim Speed (ms) | The dimming speed, in Milliseconds. This applies to the **light** and also to the **tunable white** dimming datapoints. It' calculated from 0% to 100%. |
|
|
@@ -15,7 +15,7 @@ module.exports = function (RED) {
|
|
|
15
15
|
node.name = config.name === undefined ? "Hue" : config.name;
|
|
16
16
|
node.outputtopic = node.name;
|
|
17
17
|
node.dpt = "";
|
|
18
|
-
node.notifyreadrequest =
|
|
18
|
+
node.notifyreadrequest = true;
|
|
19
19
|
node.notifyreadrequestalsorespondtobus = "false";
|
|
20
20
|
node.notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized = "";
|
|
21
21
|
node.notifyresponse = false;
|
|
@@ -335,6 +335,36 @@ module.exports = function (RED) {
|
|
|
335
335
|
default:
|
|
336
336
|
break;
|
|
337
337
|
}
|
|
338
|
+
|
|
339
|
+
// I must respond to query requests (read request) sent from the KNX BUS
|
|
340
|
+
|
|
341
|
+
if (msg.knx.event === "GroupValue_Read" && node.currentHUEDevice !== undefined) {
|
|
342
|
+
let ret;
|
|
343
|
+
switch (msg.knx.destination) {
|
|
344
|
+
case config.GALightState:
|
|
345
|
+
ret = node.currentHUEDevice.on.on;
|
|
346
|
+
if (ret !== undefined) node.updateKNXLightState(ret, "response");
|
|
347
|
+
break;
|
|
348
|
+
case config.GALightColorState:
|
|
349
|
+
ret = node.currentHUEDevice.color.xy;
|
|
350
|
+
if (ret !== undefined) node.updateKNXLightColorState(node.currentHUEDevice.color, "response");
|
|
351
|
+
break;
|
|
352
|
+
case config.GALightHSVState:
|
|
353
|
+
ret = node.currentHUEDevice.color_temperature.mirek;
|
|
354
|
+
if (ret !== undefined) node.updateKNXLightHSVState(ret, "response");
|
|
355
|
+
break;
|
|
356
|
+
case config.GALightBrightnessState:
|
|
357
|
+
ret = node.currentHUEDevice.dimming.brightness;
|
|
358
|
+
if (ret !== undefined) node.updateKNXBrightnessState(ret, "response");
|
|
359
|
+
break;
|
|
360
|
+
case config.GALightKelvinState:
|
|
361
|
+
ret = node.currentHUEDevice.color_temperature.mirek;
|
|
362
|
+
if (ret !== undefined) node.updateKNXLightKelvinState(ret, "response");
|
|
363
|
+
break;
|
|
364
|
+
default:
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
338
368
|
} catch (error) {
|
|
339
369
|
node.status({
|
|
340
370
|
fill: "red",
|
|
@@ -464,6 +494,22 @@ module.exports = function (RED) {
|
|
|
464
494
|
// Output the msg to the flow
|
|
465
495
|
node.send(_event);
|
|
466
496
|
|
|
497
|
+
// As grouped_light doesn't contain all requested properties, i find the first light in the group, and use this below in the code
|
|
498
|
+
// If the event type is grouped light, and there are missing properties, i infer these missing properties from the first light in the group!
|
|
499
|
+
if ((_event.hasOwnProperty("color") || _event.hasOwnProperty("dimming")) && _event.type === 'grouped_light') {
|
|
500
|
+
try {
|
|
501
|
+
const firstLightInGroup = node.serverHue.getFirstLightInGroup(_event.id);
|
|
502
|
+
if (firstLightInGroup !== null && firstLightInGroup !== undefined) {
|
|
503
|
+
if (_event.color === undefined || Object.keys(_event.color).length === 0) {
|
|
504
|
+
_event.color = firstLightInGroup.color;
|
|
505
|
+
}
|
|
506
|
+
if (_event.color_temperature === undefined || Object.keys(_event.color_temperature).length === 0) {
|
|
507
|
+
_event.color_temperature = firstLightInGroup.color_temperature;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
} catch (error) { }
|
|
511
|
+
}
|
|
512
|
+
|
|
467
513
|
if (_event.hasOwnProperty("on")) {
|
|
468
514
|
node.updateKNXLightState(_event.on.on);
|
|
469
515
|
// In case of switch off, set the dim to zero
|
|
@@ -472,17 +518,16 @@ module.exports = function (RED) {
|
|
|
472
518
|
&& (config.updateKNXBrightnessStatusOnHUEOnOff === undefined || config.updateKNXBrightnessStatusOnHUEOnOff === "onhueoff")
|
|
473
519
|
) {
|
|
474
520
|
node.updateKNXBrightnessState(0);
|
|
475
|
-
node.currentHUEDevice.dimming.brightness = 0;
|
|
521
|
+
//node.currentHUEDevice.dimming.brightness = 0;
|
|
476
522
|
}
|
|
477
523
|
node.currentHUEDevice.on.on = _event.on.on;
|
|
478
524
|
}
|
|
525
|
+
|
|
479
526
|
if (_event.hasOwnProperty("color")) {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
node.updateKNXLightColorState(_event.color);
|
|
483
|
-
node.currentHUEDevice.color = _event.color;
|
|
484
|
-
}
|
|
527
|
+
node.updateKNXLightColorState(_event.color);
|
|
528
|
+
node.currentHUEDevice.color = _event.color;
|
|
485
529
|
}
|
|
530
|
+
|
|
486
531
|
if (_event.hasOwnProperty("dimming") && _event.dimming.brightness !== undefined) {
|
|
487
532
|
// Every once on a time, the light transmit the brightness value of 0.39.
|
|
488
533
|
// To avoid wrongly turn light state on, exit
|
|
@@ -521,7 +566,7 @@ module.exports = function (RED) {
|
|
|
521
566
|
};
|
|
522
567
|
|
|
523
568
|
// Leave the name after "function", to avoid <anonymous function> in the stack trace, in caso of errors.
|
|
524
|
-
node.updateKNXBrightnessState = function updateKNXBrightnessState(_value) {
|
|
569
|
+
node.updateKNXBrightnessState = function updateKNXBrightnessState(_value, _outputtype = "write") {
|
|
525
570
|
if (config.GALightBrightnessState !== undefined && config.GALightBrightnessState !== "") {
|
|
526
571
|
const knxMsgPayload = {};
|
|
527
572
|
knxMsgPayload.topic = config.GALightBrightnessState;
|
|
@@ -529,13 +574,15 @@ module.exports = function (RED) {
|
|
|
529
574
|
knxMsgPayload.payload = _value;
|
|
530
575
|
// Send to KNX bus
|
|
531
576
|
if (knxMsgPayload.topic !== "" && knxMsgPayload.topic !== undefined) {
|
|
532
|
-
node.server.
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
577
|
+
if (node.server !== null && node.server !== undefined) {
|
|
578
|
+
node.server.writeQueueAdd({
|
|
579
|
+
grpaddr: knxMsgPayload.topic,
|
|
580
|
+
payload: knxMsgPayload.payload,
|
|
581
|
+
dpt: knxMsgPayload.dpt,
|
|
582
|
+
outputtype: _outputtype,
|
|
583
|
+
nodecallerid: node.id,
|
|
584
|
+
});
|
|
585
|
+
}
|
|
539
586
|
}
|
|
540
587
|
node.setNodeStatusHue({
|
|
541
588
|
fill: "blue",
|
|
@@ -546,7 +593,7 @@ module.exports = function (RED) {
|
|
|
546
593
|
}
|
|
547
594
|
};
|
|
548
595
|
|
|
549
|
-
node.updateKNXLightState = function
|
|
596
|
+
node.updateKNXLightState = function updateKNXLightState(_value, _outputtype = "write") {
|
|
550
597
|
try {
|
|
551
598
|
const knxMsgPayload = {};
|
|
552
599
|
knxMsgPayload.topic = config.GALightState;
|
|
@@ -557,13 +604,15 @@ module.exports = function (RED) {
|
|
|
557
604
|
// Check not to have already sent the value
|
|
558
605
|
// Send to KNX bus
|
|
559
606
|
if (knxMsgPayload.topic !== "" && knxMsgPayload.topic !== undefined) {
|
|
560
|
-
node.server.
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
607
|
+
if (node.server !== null && node.server !== undefined) {
|
|
608
|
+
node.server.writeQueueAdd({
|
|
609
|
+
grpaddr: knxMsgPayload.topic,
|
|
610
|
+
payload: knxMsgPayload.payload,
|
|
611
|
+
dpt: knxMsgPayload.dpt,
|
|
612
|
+
outputtype: _outputtype,
|
|
613
|
+
nodecallerid: node.id,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
567
616
|
}
|
|
568
617
|
node.setNodeStatusHue({
|
|
569
618
|
fill: "blue",
|
|
@@ -577,7 +626,7 @@ module.exports = function (RED) {
|
|
|
577
626
|
}
|
|
578
627
|
};
|
|
579
628
|
|
|
580
|
-
node.updateKNXLightHSVState = function
|
|
629
|
+
node.updateKNXLightHSVState = function updateKNXLightHSVState(_value, _outputtype = "write") {
|
|
581
630
|
if (config.GALightHSVState !== undefined && config.GALightHSVState !== "") {
|
|
582
631
|
const knxMsgPayload = {};
|
|
583
632
|
knxMsgPayload.topic = config.GALightHSVState;
|
|
@@ -588,13 +637,15 @@ module.exports = function (RED) {
|
|
|
588
637
|
}
|
|
589
638
|
// Send to KNX bus
|
|
590
639
|
if (knxMsgPayload.topic !== "" && knxMsgPayload.topic !== undefined) {
|
|
591
|
-
node.server.
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
640
|
+
if (node.server !== null && node.server !== undefined) {
|
|
641
|
+
node.server.writeQueueAdd({
|
|
642
|
+
grpaddr: knxMsgPayload.topic,
|
|
643
|
+
payload: knxMsgPayload.payload,
|
|
644
|
+
dpt: knxMsgPayload.dpt,
|
|
645
|
+
outputtype: _outputtype,
|
|
646
|
+
nodecallerid: node.id,
|
|
647
|
+
});
|
|
648
|
+
}
|
|
598
649
|
}
|
|
599
650
|
node.setNodeStatusHue({
|
|
600
651
|
fill: "blue",
|
|
@@ -605,7 +656,7 @@ module.exports = function (RED) {
|
|
|
605
656
|
}
|
|
606
657
|
};
|
|
607
658
|
|
|
608
|
-
node.updateKNXLightColorState = function updateKNXLightColorState(_value) {
|
|
659
|
+
node.updateKNXLightColorState = function updateKNXLightColorState(_value, _outputtype = "write") {
|
|
609
660
|
if (config.GALightColorState !== undefined && config.GALightColorState !== "") {
|
|
610
661
|
const knxMsgPayload = {};
|
|
611
662
|
knxMsgPayload.topic = config.GALightColorState;
|
|
@@ -615,15 +666,18 @@ module.exports = function (RED) {
|
|
|
615
666
|
_value.xy.y,
|
|
616
667
|
node.currentHUEDevice !== undefined ? node.currentHUEDevice.dimming.brightness : 100,
|
|
617
668
|
);
|
|
669
|
+
knxMsgPayload.payload = { red: knxMsgPayload.payload.r, green: knxMsgPayload.payload.g, blue: knxMsgPayload.payload.b };
|
|
618
670
|
// Send to KNX bus
|
|
619
671
|
if (knxMsgPayload.topic !== "" && knxMsgPayload.topic !== undefined) {
|
|
620
|
-
node.server.
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
672
|
+
if (node.server !== null && node.server !== undefined) {
|
|
673
|
+
node.server.writeQueueAdd({
|
|
674
|
+
grpaddr: knxMsgPayload.topic,
|
|
675
|
+
payload: knxMsgPayload.payload,
|
|
676
|
+
dpt: knxMsgPayload.dpt,
|
|
677
|
+
outputtype: _outputtype,
|
|
678
|
+
nodecallerid: node.id,
|
|
679
|
+
});
|
|
680
|
+
}
|
|
627
681
|
}
|
|
628
682
|
node.setNodeStatusHue({
|
|
629
683
|
fill: "blue",
|
|
@@ -634,7 +688,7 @@ module.exports = function (RED) {
|
|
|
634
688
|
}
|
|
635
689
|
};
|
|
636
690
|
|
|
637
|
-
node.updateKNXLightKelvinState = function updateKNXLightKelvinState(_value) {
|
|
691
|
+
node.updateKNXLightKelvinState = function updateKNXLightKelvinState(_value, _outputtype = "write") {
|
|
638
692
|
if (config.GALightKelvinState !== undefined && config.GALightKelvinState !== "") {
|
|
639
693
|
const knxMsgPayload = {};
|
|
640
694
|
knxMsgPayload.topic = config.GALightKelvinState;
|
|
@@ -646,13 +700,15 @@ module.exports = function (RED) {
|
|
|
646
700
|
}
|
|
647
701
|
// Send to KNX bus
|
|
648
702
|
if (knxMsgPayload.topic !== "" && knxMsgPayload.topic !== undefined) {
|
|
649
|
-
node.server.
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
703
|
+
if (node.server !== null && node.server !== undefined) {
|
|
704
|
+
node.server.writeQueueAdd({
|
|
705
|
+
grpaddr: knxMsgPayload.topic,
|
|
706
|
+
payload: knxMsgPayload.payload,
|
|
707
|
+
dpt: knxMsgPayload.dpt,
|
|
708
|
+
outputtype: _outputtype,
|
|
709
|
+
nodecallerid: node.id,
|
|
710
|
+
});
|
|
711
|
+
}
|
|
656
712
|
|
|
657
713
|
node.setNodeStatusHue({
|
|
658
714
|
fill: "blue",
|
package/nodes/utils/hueEngine.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"engines": {
|
|
4
4
|
"node": ">=16.0.0"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.2.
|
|
6
|
+
"version": "2.2.25",
|
|
7
7
|
"description": "Control your KNX intallation via Node-Red! Single Node KNX IN/OUT with optional ETS group address importer. Easy to use and highly configurable. With integrated Philips HUE devices control.",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"binary-parser": "2.2.1",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"simple-get": "4.0.1",
|
|
20
20
|
"xml2js": "0.6.0"
|
|
21
21
|
},
|
|
22
|
+
|
|
22
23
|
"node-red": {
|
|
23
24
|
"version": ">=2.0.0",
|
|
24
25
|
"nodes": {
|