node-red-contrib-knx-ultimate 2.2.38 → 2.2.40

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,8 +6,12 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
- **Version 2.2.38** - December 2023<br/>
10
- - NEW: HUE Light Node: added support for the HUE SMART PLUG.<br/>
9
+ **Version 2.2.40** - Jan 2024<br/>
10
+ - HUE Light: fixed an issue with initial status read from HUE Bridge (on/off status was incorrectly set).<br/>
11
+
12
+ **Version 2.2.39** - Jan 2024<br/>
13
+ - Fixed DPT 9.001 issue when sending numbers having > 2 decimals.<br/>
14
+ - 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/>
11
15
 
12
16
  **Version 2.2.37** - December 2023<br/>
13
17
  - HUE Light Node: you can now set the DIM direction for tunable white lights. Fixed some issues as well.<br/>
@@ -6,6 +6,10 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
+ <p>
10
+ <b>Version 1.0.43</b> - December 2023<br/>
11
+ - Fixed DPT 9.001 issue when sending numberso having > 2 decimals.<br/>
12
+ </p>
9
13
  <p>
10
14
  <b>Version 1.0.43</b> - October 2023<br/>
11
15
  - Added help description for DPT 3.001 DIMMING stop telegram.<br/>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "knxultimate",
3
3
  "description": "KNX IP protocol implementation for Node. This is the ENGINE of Node-Red KNX-Ultimate node.",
4
- "version": "1.0.43",
4
+ "version": "1.0.44",
5
5
  "engines": {
6
6
  "node": ">=14"
7
7
  },
@@ -38,6 +38,7 @@ exports.formatAPDU = function (value) {
38
38
  if (!isFinite(value)) {
39
39
  knxLog.get().warn('DPT9: cannot write non-numeric or undefined value')
40
40
  } else {
41
+ value = value.toFixed(2); // Fix issue with float having too many decimals.
41
42
  const arr = frexp(value)
42
43
  const mantissa = arr[0]; const exponent = arr[1]
43
44
  // find the minimum exponent that will upsize the normalized mantissa (0,5 to 1 range)
@@ -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
@@ -502,15 +502,21 @@ module.exports = function (RED) {
502
502
  if (node.brightnessStep === null || node.brightnessStep === undefined) node.brightnessStep = node.currentHUEDevice.dimming.brightness || 50;
503
503
  node.brightnessStep = Math.ceil(Number(node.brightnessStep));
504
504
 
505
- // Set the speed
506
- _dimSpeedInMillisecs /= numStep;
507
- numStep = Math.round((config.maxDimLevelLight - config.minDimLevelLight) / numStep, 0);
508
-
509
505
  // We have also minDimLevelLight and maxDimLevelLight to take care of.
510
- let minDimLevelLight = config.minDimLevelLight === undefined ? 10 : Number(config.minDimLevelLight);
511
- if (config.minDimLevelLight === "useHueLightLevel" && node.currentHUEDevice.dimming.min_dim_level === undefined) minDimLevelLight = 10;
506
+ let minDimLevelLight;
507
+ if (config.minDimLevelLight === undefined) {
508
+ minDimLevelLight = 10;
509
+ } else if (config.minDimLevelLight === "useHueLightLevel") {
510
+ minDimLevelLight = node.currentHUEDevice.dimming.min_dim_level === undefined ? 10 : node.currentHUEDevice.dimming.min_dim_level;
511
+ } else {
512
+ minDimLevelLight = Number(config.minDimLevelLight);
513
+ }
512
514
  const maxDimLevelLight = config.maxDimLevelLight === undefined ? 100 : Number(config.maxDimLevelLight);
513
515
 
516
+ // Set the speed
517
+ _dimSpeedInMillisecs /= numStep;
518
+ numStep = Math.round((maxDimLevelLight - minDimLevelLight) / numStep, 0);
519
+
514
520
  if (_KNXbrightness_Direction > 0 && _KNXaction === 1) {
515
521
  // DIM UP
516
522
  if (node.timerStepDim !== undefined) clearInterval(node.timerStepDim);
@@ -683,7 +689,7 @@ module.exports = function (RED) {
683
689
  if (node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === false && _event.dimming.brightness === 0) {
684
690
  // Do nothing, because the light is off and the dimming also is 0
685
691
  } else {
686
- 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);
687
693
  node.updateKNXBrightnessState(_event.dimming.brightness);
688
694
  // If the brightness reaches zero, the hue lamp "on" property must be set to zero as well
689
695
  if (_event.dimming.brightness === 0 && node.currentHUEDevice.on !== undefined && node.currentHUEDevice.on.on === true) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.38",
6
+ "version": "2.2.40",
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",