node-red-contrib-knx-ultimate 2.2.21 → 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 CHANGED
@@ -6,11 +6,11 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
- **Version 2.2.21** - November 2023<br/>
10
- - HUE Light: added DPT 9.002 for direkt kelvin selection, with HUE range (2000K-6535K). There is another DPT 7.600 with the KNX scale (0K-6553K) avaiable.<br/>
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
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/>
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
14
 
15
15
  **Version 2.2.20** - November 2023<br/>
16
16
  - Fixed a cross site js script loading, affecting the node running under HomeAssistant.<br/>
@@ -422,6 +422,10 @@ module.exports = (RED) => {
422
422
  try {
423
423
  // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
424
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
+ }
425
429
  const jRet = serverNode.getResources(req.query.rtype);
426
430
  if (jRet !== undefined) {
427
431
  res.json(jRet);
@@ -430,7 +434,7 @@ module.exports = (RED) => {
430
434
  }
431
435
  // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
432
436
  } catch (error) {
433
- RED.log.error(`Errore KNXUltimateGetResourcesHUE non gestito ${error.message}`);
437
+ //RED.log.error(`Errore KNXUltimateGetResourcesHUE non gestito ${error.message}`);
434
438
  res.json({ devices: error.message });
435
439
  // (async () => {
436
440
  // await node.initHUEConnection();
@@ -74,7 +74,7 @@
74
74
  dptLightKelvinState: { value: "" },
75
75
 
76
76
  specifySwitchOnBrightness: { value: "yes" },
77
- colorAtSwitchOnDayTime: { value: '{"red":255, "green":255, "blue":255}' },
77
+ colorAtSwitchOnDayTime: { value: '{"red":255, "green":200, "blue":180}' },
78
78
 
79
79
  enableDayNightLighting: { value: "no" },
80
80
  colorAtSwitchOnNightTime: { value: '{"red":23, "green":4, "blue":0}' },
@@ -946,7 +946,7 @@
946
946
  <select id="node-input-enableDayNightLighting">
947
947
  <option value="temperature">Select temperature and brightness</option>
948
948
  <option value="yes">Select color</option>
949
- <option value="no">Last status</option>
949
+ <option value="no">No night lighting</option>
950
950
  </select>
951
951
  </div>
952
952
 
@@ -36,30 +36,32 @@ module.exports = function (RED) {
36
36
  node.hueDevice = config.hueDevice.split("#")[0];
37
37
  node.initializingAtStart = (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "yes");
38
38
  config.specifySwitchOnBrightness === undefined ? "yes" : config.specifySwitchOnBrightness;
39
+ config.colorAtSwitchOnDayTime = (config.colorAtSwitchOnDayTime === '' || config.colorAtSwitchOnDayTime === undefined) ? '{ "kelvin":3000, "brightness":100 }' : config.colorAtSwitchOnDayTime;
40
+ config.colorAtSwitchOnNightTime = (config.colorAtSwitchOnNightTime === '' || config.colorAtSwitchOnNightTime === undefined) ? '{ "kelvin":2700, "brightness":20 }' : config.colorAtSwitchOnNightTime;
41
+
39
42
  // Transform HEX in RGB and stringified json in json oblects.
40
43
  if (config.colorAtSwitchOnDayTime.indexOf("#") !== -1) {
41
- // Transform to rgb.
44
+ // Transform to rgb.
42
45
  try {
43
46
  config.colorAtSwitchOnDayTime = hueColorConverter.ColorConverter.hexRgb(config.colorAtSwitchOnDayTime.replace("#", ""));
44
47
  } catch (error) {
45
- config.colorAtSwitchOnDayTime = { red: 255, green: 255, blue: 255 };
48
+ config.colorAtSwitchOnDayTime = { kelvin: 3000, brightness: 100 };
46
49
  }
47
50
  } else {
48
51
  config.colorAtSwitchOnDayTime = JSON.parse(config.colorAtSwitchOnDayTime);
49
52
  }
50
53
  // Same thing, but with night color
51
54
  if (config.colorAtSwitchOnNightTime.indexOf("#") !== -1) {
52
- // Transform to rgb.
55
+ // Transform to rgb.
53
56
  try {
54
57
  config.colorAtSwitchOnNightTime = hueColorConverter.ColorConverter.hexRgb(config.colorAtSwitchOnNightTime.replace("#", ""));
55
58
  } catch (error) {
56
- config.colorAtSwitchOnNightTime = { red: 12, green: 0, blue: 10 };
59
+ config.colorAtSwitchOnNightTime = { kelvin: 2700, brightness: 20 };
57
60
  }
58
61
  } else {
59
62
  config.colorAtSwitchOnNightTime = JSON.parse(config.colorAtSwitchOnNightTime);
60
63
  }
61
64
 
62
-
63
65
  // Used to call the status update from the config node.
64
66
  node.setNodeStatus = ({
65
67
  fill, shape, text, payload,
@@ -486,10 +488,10 @@ module.exports = function (RED) {
486
488
  if (node.currentHUEDevice.hasOwnProperty("on") && node.currentHUEDevice.on.on === false && _event.dimming.brightness === 0) {
487
489
  // Do nothing, because the light is off and the dimming also is 0
488
490
  } else {
489
- if (node.currentHUEDevice.on.on === false && (!_event.hasOwnProperty("on") || (_event.hasOwnProperty("on") && _event.on.on === true))) node.updateKNXLightState(_event.dimming.brightness > 0);
491
+ if (node.currentHUEDevice.hasOwnProperty("on") && node.currentHUEDevice.on.on === false && (!_event.hasOwnProperty("on") || (_event.hasOwnProperty("on") && _event.on.on === true))) node.updateKNXLightState(_event.dimming.brightness > 0);
490
492
  node.updateKNXBrightnessState(_event.dimming.brightness);
491
493
  // If the brightness reaches zero, the hue lamp "on" property must be set to zero as well
492
- if (_event.dimming.brightness === 0) {
494
+ if (_event.dimming.brightness === 0 && node.currentHUEDevice.hasOwnProperty("on") && node.currentHUEDevice.on.on === true) {
493
495
  node.serverHue.hueManager.writeHueQueueAdd(
494
496
  node.hueDevice,
495
497
  { on: { on: false } },
@@ -512,6 +514,7 @@ module.exports = function (RED) {
512
514
  shape: "dot",
513
515
  text: `HUE->KNX error ${node.id} ${error.message}`,
514
516
  });
517
+ RED.log.error(`knxUltimateHueLight: node.handleSendHUE = (_event): ${error.message}`);
515
518
  }
516
519
  };
517
520
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.21",
6
+ "version": "2.2.22",
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",