node-red-contrib-knx-ultimate 2.2.39 → 2.3.0

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.3.0** - Jan 2024<br/>
10
+ - HUE Light: partially rewrote code to cloneDeep(oHUEDevice) not to duplicate the brightness status of a single ligh, at node-red restart. https://github.com/Supergiovane/node-red-contrib-knx-ultimate/issues/312#issue-2064480332 <br/>
11
+
12
+ **Version 2.2.40** - Jan 2024<br/>
13
+ - HUE Light: fixed an issue with initial status read from HUE Bridge (on/off status was incorrectly set).<br/>
14
+
9
15
  **Version 2.2.39** - Jan 2024<br/>
10
16
  - Fixed DPT 9.001 issue when sending numbers having > 2 decimals.<br/>
11
17
  - HUE Light node: fixed an issue in dimming, when the minimum dim level is set to the minimum level defined by the HUE bridge.<br/>
@@ -7,6 +7,7 @@ const dptlib = require("../KNXEngine/src/dptlib");
7
7
  const HueClass = require("./utils/hueEngine").classHUE;
8
8
  const loggerEngine = require("./utils/sysLogger");
9
9
  const hueColorConverter = require("./utils/hueColorConverter");
10
+ const cloneDeep = require("lodash/cloneDeep");
10
11
 
11
12
  function getRandomIntInclusive(min, max) {
12
13
  min = Math.ceil(min);
@@ -206,7 +207,7 @@ module.exports = (RED) => {
206
207
  shape: "ring",
207
208
  text: "Ready :-)",
208
209
  });
209
- _node.currentHUEDevice = oHUEDevice;
210
+ _node.currentHUEDevice = cloneDeep(oHUEDevice);
210
211
  if (_node.initializingAtStart === true) _node.handleSendHUE(oHUEDevice);
211
212
  }
212
213
  }
@@ -417,7 +418,7 @@ module.exports = (RED) => {
417
418
  if (node.hueAllResources !== undefined && node.hueAllResources !== null && _Node.initializingAtStart === true) {
418
419
  const oHUEDevice = node.hueAllResources.filter((a) => a.id === _Node.hueDevice)[0];
419
420
  if (oHUEDevice !== undefined) {
420
- _Node.currentHUEDevice = oHUEDevice;
421
+ _Node.currentHUEDevice = cloneDeep(oHUEDevice);
421
422
  _Node.handleSendHUE(oHUEDevice);
422
423
  // Add _Node to the clients array
423
424
  _Node.setNodeStatusHue({
@@ -87,14 +87,14 @@ module.exports = function (RED) {
87
87
  node.context().global.set(node.name + '_WRITE', [], node.contextStorage) // Delete the var
88
88
  for (let index = 0; index < oContext.length; index++) {
89
89
  const element = oContext[index]
90
- if (!element.hasOwnProperty('address')) {
90
+ if (element.hasOwnProperty('address') === false) {
91
91
  node.setNodeStatus({ fill: 'RED', shape: 'dot', text: 'NO Group Address set', payload: '', GA: '', dpt: '', devicename: '' })
92
92
  RED.log.error('knxUltimateGlobalContext: No group address set in node ' + node.id)
93
93
  oContext = null // 21/03/2022
94
94
  node.goTimerGo()
95
95
  return
96
96
  }
97
- if (!element.hasOwnProperty('payload')) {
97
+ if (element.hasOwnProperty('payload') === false) {
98
98
  node.setNodeStatus({ fill: 'RED', shape: 'dot', text: 'NO payload set', payload: '', GA: '', dpt: '', devicename: '' })
99
99
  RED.log.error('knxUltimateGlobalContext: No payload set for address ' + element.address + ' in node ' + node.id)
100
100
  oContext = null // 21/03/2022
@@ -103,7 +103,7 @@ module.exports = function (RED) {
103
103
  }
104
104
 
105
105
  // 13/09/2021 retrieve the datapoint if not specified
106
- if (!element.hasOwnProperty('dpt') || element.dpt === undefined || element.dpt === '') {
106
+ if (element.hasOwnProperty('dpt') === false || element.dpt === undefined || element.dpt === '') {
107
107
  try {
108
108
  const sDPT = node.server.csv.find(item => item.ga === element.address).dpt
109
109
  element.dpt = sDPT
@@ -667,7 +667,7 @@ module.exports = function (RED) {
667
667
  // In case of switch off, set the dim to zero
668
668
  if (_event.on.on === false && (config.updateKNXBrightnessStatusOnHUEOnOff === undefined || config.updateKNXBrightnessStatusOnHUEOnOff === "onhueoff")) {
669
669
  node.updateKNXBrightnessState(0);
670
- //node.currentHUEDevice.dimming.brightness = 0;
670
+ if (_event.dimming !== undefined) delete _event.dimming; // Remove event.dimming, because has beem handled by this function and i don't want the function below to take care of it.
671
671
  } else if (_event.on.on === true && node.currentHUEDevice.on.on === false) {
672
672
  // Turn on always update the dimming KNX Status value as well.
673
673
  let brightVal = 50;
@@ -689,7 +689,7 @@ module.exports = function (RED) {
689
689
  if (node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === false && _event.dimming.brightness === 0) {
690
690
  // Do nothing, because the light is off and the dimming also is 0
691
691
  } else {
692
- 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);
692
+ 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);
693
693
  node.updateKNXBrightnessState(_event.dimming.brightness);
694
694
  // If the brightness reaches zero, the hue lamp "on" property must be set to zero as well
695
695
  if (_event.dimming.brightness === 0 && node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === true) {
@@ -715,7 +715,7 @@ module.exports = function (RED) {
715
715
  shape: "dot",
716
716
  text: `HUE->KNX error ${node.id} ${error.message}. Seee Log`,
717
717
  });
718
- RED.log.error(`knxUltimateHueLight: node.handleSendHUE = (_event): ${error.message}`);
718
+ RED.log.error(`knxUltimateHueLight: node.handleSendHUE = (_event): ${error.stack}`);
719
719
  }
720
720
  };
721
721
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.39",
6
+ "version": "2.3.0",
7
7
  "description": "Control your KNX intallation via Node-Red! A bunch of KNX nodes, with integrated Philips HUE control and ETS group address importer. Easy to use and highly configurable.",
8
8
  "dependencies": {
9
9
  "binary-parser": "2.2.1",