node-red-contrib-knx-ultimate 2.2.27 → 2.2.28

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,6 +6,12 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
+ **Version 2.2.28** - November 2023<br/>
10
+ This is an interim version, to quick fix some issues. Please report any issue with HUE Nodes, on gitHub.<br/>
11
+ - HUE Light: fixed an issue where dimming down with the light switched off, causes the brightness status to jump to 100%, thus the light remains off.<br/>
12
+ - HUE Light: Fixed some errors, if all devices belonging to a group, have only the dimming capability.<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.27** - November 2023<br/>
10
16
  This is an interim version, to quick fix some issues. Please report any issue with HUE Nodes, on gitHub.<br/>
11
17
  - HUE Light: the UI now changes, to adapt to lamp type.<br/>
@@ -497,7 +497,7 @@ module.exports = (RED) => {
497
497
  }
498
498
  res.json(oLight);
499
499
  } catch (error) {
500
- if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`KNXUltimateHue: hueEngine: knxUltimateGetLightObject: error ${error.message}`);
500
+ if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`KNXUltimateHue: hueEngine: knxUltimateGetLightObject: error ${error.message}. Resources still loading. Try later.`);
501
501
  res.json({});
502
502
  }
503
503
  });
@@ -258,8 +258,8 @@ module.exports = function (RED) {
258
258
  let gamut = null;
259
259
  if (
260
260
  node.currentHUEDevice !== undefined
261
- && node.currentHUEDevice.hasOwnProperty("color")
262
- && node.currentHUEDevice.color.hasOwnProperty("gamut_type")
261
+ && node.currentHUEDevice.color !== undefined
262
+ && node.currentHUEDevice.color.gamut_type !== undefined
263
263
  ) {
264
264
  gamut = node.currentHUEDevice.color.gamut_type;
265
265
  }
@@ -325,8 +325,8 @@ module.exports = function (RED) {
325
325
  let gamut = null;
326
326
  if (
327
327
  node.currentHUEDevice !== undefined
328
- && node.currentHUEDevice.hasOwnProperty("color")
329
- && node.currentHUEDevice.color.hasOwnProperty("gamut_type")
328
+ && node.currentHUEDevice.color !== undefined
329
+ && node.currentHUEDevice.color.gamut_type !== undefined
330
330
  ) {
331
331
  gamut = node.currentHUEDevice.color.gamut_type;
332
332
  }
@@ -431,7 +431,7 @@ module.exports = function (RED) {
431
431
  if (node.brightnessStep > maxDimLevelLight) node.brightnessStep = maxDimLevelLight;
432
432
  hueTelegram = { dimming: { brightness: node.brightnessStep }, dynamics: { duration: _dimSpeedInMillisecs } };
433
433
  // Switch on the light if off
434
- if (node.currentHUEDevice.hasOwnProperty("on") !== undefined && node.currentHUEDevice.on.on === false) {
434
+ if (node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === false) {
435
435
  hueTelegram.on = { on: true };
436
436
  }
437
437
  node.serverHue.hueManager.writeHueQueueAdd(node.hueDevice, hueTelegram, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
@@ -439,6 +439,7 @@ module.exports = function (RED) {
439
439
  }, _dimSpeedInMillisecs);
440
440
  }
441
441
  if (_KNXbrightness_delta > 0 && _KNXaction === 0) {
442
+ if (node.currentHUEDevice.on.on === false) return; // Don't dim down, if the light is already off.
442
443
  // DIM DOWN
443
444
  if (node.timerStepDim !== undefined) clearInterval(node.timerStepDim);
444
445
  node.timerStepDim = setInterval(() => {
@@ -447,7 +448,7 @@ module.exports = function (RED) {
447
448
  if (node.brightnessStep < minDimLevelLight) node.brightnessStep = minDimLevelLight;
448
449
  hueTelegram = { dimming: { brightness: node.brightnessStep }, dynamics: { duration: _dimSpeedInMillisecs } };
449
450
  // Switch off the light if on
450
- if (node.currentHUEDevice.hasOwnProperty("on") !== undefined && node.currentHUEDevice.on.on === true && node.brightnessStep === 0) {
451
+ if (node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === true && node.brightnessStep === 0) {
451
452
  hueTelegram.on = { on: false };
452
453
  }
453
454
  node.serverHue.hueManager.writeHueQueueAdd(node.hueDevice, hueTelegram, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
@@ -465,7 +466,7 @@ module.exports = function (RED) {
465
466
  let hueTelegram = {};
466
467
  _dimSpeedInMillisecs = _dimSpeedInMillisecs === undefined || _dimSpeedInMillisecs === "" ? 5000 : _dimSpeedInMillisecs;
467
468
  let delta = 0;
468
- if (!node.currentHUEDevice.color_temperature.hasOwnProperty("mirek")) delta = 347 - Math.round(173, 0); // Unable to read the mirek, set medium as default
469
+ if (node.currentHUEDevice.color_temperature.mirek === undefined) delta = 347 - Math.round(173, 0); // Unable to read the mirek, set medium as default
469
470
  // We have also minDimLevelLight and maxDimLevelLight to take care of.
470
471
  // Mirek limits are not taken in consideration.
471
472
  // Maximum mirek is 347
@@ -476,12 +477,12 @@ module.exports = function (RED) {
476
477
  return;
477
478
  }
478
479
  if (_KNXbrightness_delta > 0 && _KNXaction === 1) {
479
- if (node.currentHUEDevice.color_temperature.hasOwnProperty("mirek")) delta = 347 - Math.round(node.currentHUEDevice.color_temperature.mirek, 0);
480
+ if (node.currentHUEDevice.color_temperature.mirek !== undefined) delta = 347 - Math.round(node.currentHUEDevice.color_temperature.mirek, 0);
480
481
  dimDirection = "up";
481
482
  }
482
483
  if (_KNXbrightness_delta > 0 && _KNXaction === 0) {
483
484
  // Set the minumum delta, taking care of the minimum brightness specified either in the HUE lamp itself, or specified by the user (parameter node.minDimLevelLight)
484
- if (node.currentHUEDevice.color_temperature.hasOwnProperty("mirek")) delta = Math.round(node.currentHUEDevice.color_temperature.mirek, 0);
485
+ if (node.currentHUEDevice.color_temperature.mirek !== undefined) delta = Math.round(node.currentHUEDevice.color_temperature.mirek, 0);
485
486
  dimDirection = "down";
486
487
  }
487
488
  // Calculate the dimming time based on delta
@@ -491,7 +492,7 @@ module.exports = function (RED) {
491
492
 
492
493
  hueTelegram = { color_temperature_delta: { action: dimDirection, mirek_delta: delta }, dynamics: { duration: _dimSpeedInMillisecs } };
493
494
  // Switch on the light if off
494
- if (node.currentHUEDevice.hasOwnProperty("on") !== undefined && node.currentHUEDevice.on.on === false && dimDirection === "up") {
495
+ if (node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === false && dimDirection === "up") {
495
496
  hueTelegram.on = { on: true };
496
497
  }
497
498
  node.serverHue.hueManager.writeHueQueueAdd(node.hueDevice, hueTelegram, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
@@ -536,7 +537,7 @@ module.exports = function (RED) {
536
537
  } catch (error) { }
537
538
  }
538
539
 
539
- if (_event.hasOwnProperty("on")) {
540
+ if (_event.on !== undefined) {
540
541
  node.updateKNXLightState(_event.on.on);
541
542
  // In case of switch off, set the dim to zero
542
543
  if (_event.on.on === false && (config.updateKNXBrightnessStatusOnHUEOnOff === undefined || config.updateKNXBrightnessStatusOnHUEOnOff === "onhueoff")) {
@@ -544,7 +545,7 @@ module.exports = function (RED) {
544
545
  //node.currentHUEDevice.dimming.brightness = 0;
545
546
  } else if (_event.on.on === true && node.currentHUEDevice.on.on === false) {
546
547
  // Turn on always update the dimming KNX Status value as well.
547
- let brightVal = 100;
548
+ let brightVal = 50;
548
549
  if (node.currentHUEDevice.dimming !== undefined && node.currentHUEDevice.dimming.brightness !== undefined) brightVal = node.currentHUEDevice.dimming.brightness;
549
550
  node.updateKNXBrightnessState(brightVal);
550
551
  }
@@ -556,17 +557,17 @@ module.exports = function (RED) {
556
557
  node.currentHUEDevice.color = _event.color;
557
558
  }
558
559
 
559
- if (_event.hasOwnProperty("dimming") && _event.dimming.brightness !== undefined) {
560
+ if (_event.dimming !== undefined && _event.dimming.brightness !== undefined) {
560
561
  // Once upon n a time, the light transmit the brightness value of 0.39.
561
562
  // To avoid wrongly turn light state on, exit
562
563
  if (_event.dimming.brightness < 1) _event.dimming.brightness = 0;
563
- if (node.currentHUEDevice.hasOwnProperty("on") && node.currentHUEDevice.on.on === false && _event.dimming.brightness === 0) {
564
+ if (node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === false && _event.dimming.brightness === 0) {
564
565
  // Do nothing, because the light is off and the dimming also is 0
565
566
  } else {
566
- 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);
567
+ if (node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === false && (!_event.on !== undefined || (_event.on !== undefined && _event.on.on === true))) node.updateKNXLightState(_event.dimming.brightness > 0);
567
568
  node.updateKNXBrightnessState(_event.dimming.brightness);
568
569
  // If the brightness reaches zero, the hue lamp "on" property must be set to zero as well
569
- if (_event.dimming.brightness === 0 && node.currentHUEDevice.hasOwnProperty("on") && node.currentHUEDevice.on.on === true) {
570
+ if (_event.dimming.brightness === 0 && node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === true) {
570
571
  node.serverHue.hueManager.writeHueQueueAdd(
571
572
  node.hueDevice,
572
573
  { on: { on: false } },
@@ -577,7 +578,7 @@ module.exports = function (RED) {
577
578
  node.currentHUEDevice.dimming.brightness = _event.dimming.brightness;
578
579
  }
579
580
  }
580
- if (_event.hasOwnProperty("color_temperature") && _event.color_temperature.mirek !== undefined) {
581
+ if (_event.color_temperature !== undefined && _event.color_temperature.mirek !== undefined) {
581
582
  node.updateKNXLightHSVState(_event.color_temperature.mirek);
582
583
  node.updateKNXLightKelvinState(_event.color_temperature.mirek);
583
584
  node.currentHUEDevice.color_temperature.mirek = _event.color_temperature.mirek;
@@ -686,7 +687,7 @@ module.exports = function (RED) {
686
687
 
687
688
  node.updateKNXLightColorState = function updateKNXLightColorState(_value, _outputtype = "write") {
688
689
  if (config.GALightColorState !== undefined && config.GALightColorState !== "") {
689
- if (!_value.hasOwnProperty('xy') || _value.xy.x === undefined) return;
690
+ if (_value.xy === undefined || _value.xy.x === undefined) return;
690
691
  const knxMsgPayload = {};
691
692
  knxMsgPayload.topic = config.GALightColorState;
692
693
  knxMsgPayload.dpt = config.dptLightColorState;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.27",
6
+ "version": "2.2.28",
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",