node-red-contrib-knx-ultimate 2.2.20 → 2.2.22
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 +6 -0
- package/nodes/hue-config.js +30 -6
- package/nodes/knxUltimateHueBattery.html +2 -2
- package/nodes/knxUltimateHueButton.html +2 -2
- package/nodes/knxUltimateHueLight.html +632 -546
- package/nodes/knxUltimateHueLight.js +89 -52
- package/nodes/knxUltimateHueLightSensor.html +3 -2
- package/nodes/knxUltimateHueMotion.html +2 -2
- package/nodes/knxUltimateHueScene.html +2 -2
- package/nodes/knxUltimateHueTapDial.html +2 -2
- package/nodes/knxUltimateHueTemperatureSensor.html +2 -2
- package/nodes/utils/hueColorConverter.js +195 -36
- package/package.json +1 -2
- package/resources/iro@5 +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
# CHANGELOG
|
|
8
8
|
|
|
9
|
+
**Version 2.2.22** - November 2023<br/>
|
|
10
|
+
- 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
|
+
- NEW: HUE Light: now you can choose the "switch on" behaviour between color and temperature (in Kelvin) + brightness.<br/>
|
|
12
|
+
- The fontawesome JS is now locally referenced.<br/>
|
|
13
|
+
- WARNING: the new HUE Light options are to be considered **BETA (= in testing with user feedback)**.<br/>
|
|
14
|
+
|
|
9
15
|
**Version 2.2.20** - November 2023<br/>
|
|
10
16
|
- Fixed a cross site js script loading, affecting the node running under HomeAssistant.<br/>
|
|
11
17
|
|
package/nodes/hue-config.js
CHANGED
|
@@ -319,14 +319,26 @@ module.exports = (RED) => {
|
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
321
|
|
|
322
|
-
//
|
|
322
|
+
// Get current color in HEX (used in html)
|
|
323
323
|
node.getColorFromHueLight = (_lightId) => {
|
|
324
324
|
try {
|
|
325
325
|
const oLight = node.hueAllResources.filter((a) => a.id === _lightId)[0];
|
|
326
|
-
const
|
|
326
|
+
const retRGB = hueColorConverter.ColorConverter.xyBriToRgb(oLight.color.xy.x, oLight.color.xy.y, oLight.dimming.brightness);
|
|
327
|
+
const ret = "#" + hueColorConverter.ColorConverter.rgbHex(retRGB.r, retRGB.g, retRGB.b).toString();
|
|
328
|
+
return ret;
|
|
329
|
+
} catch (error) {
|
|
330
|
+
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.warn(`KNXUltimateHue: hueEngine: getColorFromHueLight: error ${error.message}`);
|
|
331
|
+
return {};
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
// Get current Kelvin (used in html)
|
|
335
|
+
node.getKelvinFromHueLight = (_lightId) => {
|
|
336
|
+
try {
|
|
337
|
+
const oLight = node.hueAllResources.filter((a) => a.id === _lightId)[0];
|
|
338
|
+
const ret = { kelvin: hueColorConverter.ColorConverter.mirekToKelvin(oLight.color_temperature.mirek), brightness: Math.round(oLight.dimming.brightness, 0) };
|
|
327
339
|
return JSON.stringify(ret);
|
|
328
340
|
} catch (error) {
|
|
329
|
-
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`KNXUltimateHue: hueEngine:
|
|
341
|
+
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`KNXUltimateHue: hueEngine: getKelvinFromHueLight: error ${error.message}`);
|
|
330
342
|
return {};
|
|
331
343
|
}
|
|
332
344
|
};
|
|
@@ -391,8 +403,16 @@ module.exports = (RED) => {
|
|
|
391
403
|
|
|
392
404
|
RED.httpAdmin.get("/knxUltimateGetHueColor", RED.auth.needsPermission("hue-config.read"), (req, res) => {
|
|
393
405
|
try {
|
|
394
|
-
const
|
|
395
|
-
res.json(
|
|
406
|
+
const hexColor = node.getColorFromHueLight(req.query.id);
|
|
407
|
+
res.json(hexColor);
|
|
408
|
+
} catch (error) {
|
|
409
|
+
res.json("Select the device first!");
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
RED.httpAdmin.get("/knxUltimateGetKelvinColor", RED.auth.needsPermission("hue-config.read"), (req, res) => {
|
|
413
|
+
try {
|
|
414
|
+
const jKelvin = node.getKelvinFromHueLight(req.query.id);
|
|
415
|
+
res.json(jKelvin);
|
|
396
416
|
} catch (error) {
|
|
397
417
|
res.json("Select the device first!");
|
|
398
418
|
}
|
|
@@ -402,6 +422,10 @@ module.exports = (RED) => {
|
|
|
402
422
|
try {
|
|
403
423
|
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
|
404
424
|
const serverNode = RED.nodes.getNode(req.query.nodeID); // Retrieve node.id of the config node.
|
|
425
|
+
if (serverNode === null) {
|
|
426
|
+
RED.log.error(`Warn KNXUltimateGetResourcesHUE serverNode is null`);
|
|
427
|
+
res.json({ devices: `serverNode not set` });
|
|
428
|
+
}
|
|
405
429
|
const jRet = serverNode.getResources(req.query.rtype);
|
|
406
430
|
if (jRet !== undefined) {
|
|
407
431
|
res.json(jRet);
|
|
@@ -410,7 +434,7 @@ module.exports = (RED) => {
|
|
|
410
434
|
}
|
|
411
435
|
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
|
412
436
|
} catch (error) {
|
|
413
|
-
RED.log.error(`Errore KNXUltimateGetResourcesHUE non gestito ${error.message}`);
|
|
437
|
+
//RED.log.error(`Errore KNXUltimateGetResourcesHUE non gestito ${error.message}`);
|
|
414
438
|
res.json({ devices: error.message });
|
|
415
439
|
// (async () => {
|
|
416
440
|
// await node.initHUEConnection();
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<script type="text/javascript" src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
|
|
2
|
+
|
|
1
3
|
<script type="text/javascript">
|
|
2
4
|
RED.nodes.registerType('knxUltimateHueBattery', {
|
|
3
5
|
category: "KNX Ultimate",
|
|
@@ -227,8 +229,6 @@
|
|
|
227
229
|
|
|
228
230
|
|
|
229
231
|
</script>
|
|
230
|
-
<script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
|
|
231
|
-
crossorigin="anonymous"></script>
|
|
232
232
|
|
|
233
233
|
<script type="text/markdown" data-help-name="knxUltimateHueBattery">
|
|
234
234
|
This node lets you get the battery level from your HUE device. Here you can get the HUE battery level events, that represents a percentage 0-100% value, evetytime the
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<script type="text/javascript" src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
|
|
2
|
+
|
|
1
3
|
<script type="text/javascript">
|
|
2
4
|
RED.nodes.registerType('knxUltimateHueButton', {
|
|
3
5
|
category: "KNX Ultimate",
|
|
@@ -404,8 +406,6 @@
|
|
|
404
406
|
|
|
405
407
|
|
|
406
408
|
</script>
|
|
407
|
-
<script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
|
|
408
|
-
crossorigin="anonymous"></script>
|
|
409
409
|
|
|
410
410
|
<script type="text/markdown" data-help-name="knxUltimateHueButton">
|
|
411
411
|
This node lets you get the events from your HUE button.
|