node-red-contrib-knx-ultimate 2.1.43 → 2.1.44

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,10 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
+ <p>
10
+ <b>Version 2.1.44</b> - August 2023<br/>
11
+ - HUE Light: now it correctly sets the KNX brightness if you turn on/off the light via HUE app.<br/>
12
+ </p>
9
13
  <p>
10
14
  <b>Version 2.1.43</b> - August 2023<br/>
11
15
  - HUE Light: Moved some options to the "Behaviour" tab and fixed a race condition in the color setting, when some options are in conflict each other.<br/>
@@ -534,7 +534,7 @@
534
534
  <div id="tabs-6">
535
535
  <p>
536
536
  <div class="form-row">
537
- <label for="node-input-linkBrightnessToSwitchStatus" style="width:400px;">
537
+ <label for="node-input-linkBrightnessToSwitchStatus" style="width:260px;">
538
538
  <i class="fa fa-tag"></i> Link color/bright. to on/off switch
539
539
  </label>
540
540
  <select id="node-input-linkBrightnessToSwitchStatus">
@@ -1,3 +1,5 @@
1
+ /* eslint-disable max-len */
2
+ /* eslint-disable no-lonely-if */
1
3
  module.exports = function (RED) {
2
4
  const dptlib = require('../KNXEngine/src/dptlib');
3
5
  const hueColorConverter = require('./utils/hueColorConverter');
@@ -338,6 +340,17 @@ module.exports = function (RED) {
338
340
  if (_event.id === config.hueDevice) {
339
341
  if (_event.hasOwnProperty('on')) {
340
342
  node.updateKNXLightState(_event.on.on);
343
+ if (config.linkBrightnessToSwitchStatus === undefined || config.linkBrightnessToSwitchStatus === 'yes') {
344
+ // In case of switch off, set the dim to zero
345
+ if (_event.on.on === false) {
346
+ node.updateKNXBrightnessState(0);
347
+ } else {
348
+ // Restore the previous brightness value
349
+ try {
350
+ node.updateKNXBrightnessState(node.currentHUEDevice.dimming.brightness);
351
+ } catch (error) { /* empty */ }
352
+ }
353
+ }
341
354
  if (node.currentHUEDevice !== undefined) node.currentHUEDevice.on = _event.on; // Update the internal object representing the current light
342
355
  }
343
356
  if (_event.hasOwnProperty('color')) {
@@ -366,7 +379,7 @@ module.exports = function (RED) {
366
379
  }
367
380
  }
368
381
  } catch (error) {
369
- node.status({ fill: 'red', shape: 'dot', text: `HUE->KNX error ${knxMsgPayload.topic} ${error.message}` || '' + ` (${new Date().getDate()}, ${new Date().toLocaleTimeString()})` });
382
+ node.status({ fill: 'red', shape: 'dot', text: `HUE->KNX error ${knxMsgPayload.topic} ${error.message} (${new Date().getDate()}, ${new Date().toLocaleTimeString()})` });
370
383
  }
371
384
  };
372
385
 
@@ -388,24 +401,26 @@ module.exports = function (RED) {
388
401
  }
389
402
  };
390
403
  node.updateKNXLightState = function (_value) {
391
- const knxMsgPayload = {};
392
- knxMsgPayload.topic = config.GALightState;
393
- knxMsgPayload.dpt = config.dptLightState;
394
- knxMsgPayload.payload = _value;
395
- if (config.GALightState !== undefined && config.GALightState !== '') {
396
- if (node.currentKNXGALightState !== knxMsgPayload.payload) { // Check not to have already sent the value
404
+ try {
405
+ const knxMsgPayload = {};
406
+ knxMsgPayload.topic = config.GALightState;
407
+ knxMsgPayload.dpt = config.dptLightState;
408
+ knxMsgPayload.payload = _value;
409
+ if (config.GALightState !== undefined && config.GALightState !== '') {
410
+ if (node.currentKNXGALightState !== knxMsgPayload.payload) { // Check not to have already sent the value
397
411
  // Send to KNX bus
398
- if (knxMsgPayload.topic !== '' && knxMsgPayload.topic !== undefined) {
399
- node.server.writeQueueAdd({
400
- grpaddr: knxMsgPayload.topic, payload: knxMsgPayload.payload, dpt: knxMsgPayload.dpt, outputtype: 'write', nodecallerid: node.id,
412
+ if (knxMsgPayload.topic !== '' && knxMsgPayload.topic !== undefined) {
413
+ node.server.writeQueueAdd({
414
+ grpaddr: knxMsgPayload.topic, payload: knxMsgPayload.payload, dpt: knxMsgPayload.dpt, outputtype: 'write', nodecallerid: node.id,
415
+ });
416
+ }
417
+ node.setNodeStatusHue({
418
+ fill: 'blue', shape: 'ring', text: 'HUE->KNX State', payload: knxMsgPayload.payload,
401
419
  });
402
420
  }
403
- node.setNodeStatusHue({
404
- fill: 'blue', shape: 'ring', text: 'HUE->KNX State', payload: knxMsgPayload.payload,
405
- });
406
421
  }
407
- }
408
- node.currentKNXGALightState = knxMsgPayload.payload; // Stores the current value
422
+ node.currentKNXGALightState = knxMsgPayload.payload; // Stores the current value
423
+ } catch (error) { /* empty */ }
409
424
  };
410
425
 
411
426
  node.updateKNXLightHSVState = function (_value) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.1.43",
6
+ "version": "2.1.44",
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 handling.",
8
8
  "dependencies": {
9
9
  "binary-parser": "2.2.1",