node-red-contrib-knx-ultimate 2.1.0 → 2.1.2

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,14 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
+ <p>
10
+ <b>Version 2.1.2</b> - June 2023<br/>
11
+ - NEW: Hue Hue Light node, added BLINK option.<br/>
12
+ </p>
13
+ <p>
14
+ <b>Version 2.1.1</b> - June 2023<br/>
15
+ - NEW: Hue Tap Dial node: setting a color datapoint(232.600), the rotary dial will send a random color to the KNX group address.<br/>
16
+ </p>
9
17
  <p>
10
18
  <b>Version 2.1.0</b> - June 2023<br/>
11
19
  - HUE nodes exited the BETA version. You can now start using HUE nodes.<br/>
@@ -36,6 +36,10 @@
36
36
  GALightBrightnessState: { value: "" },
37
37
  dptLightBrightnessState: { value: "" },
38
38
 
39
+ nameLightBlink: { value: "" },
40
+ GALightBlink: { value: "" },
41
+ dptLightBlink: { value: "" },
42
+
39
43
  hueDevice: { value: "" }
40
44
  },
41
45
  inputs: 0,
@@ -395,6 +399,52 @@
395
399
 
396
400
 
397
401
 
402
+ // DPT Blink command
403
+ // ########################
404
+ $.getJSON('knxUltimateDpts', (data) => {
405
+ data.forEach(dpt => {
406
+ if (dpt.value.startsWith("1.")) {
407
+ $("#node-input-dptLightBlink").append($("<option></option>")
408
+ .attr("value", dpt.value)
409
+ .text(dpt.text))
410
+ }
411
+ });
412
+ $("#node-input-dptLightBlink").val(this.dptLightSwitch)
413
+ })
414
+
415
+ // Autocomplete suggestion with ETS csv File
416
+ $("#node-input-GALightBlink").autocomplete({
417
+ minLength: 1,
418
+ source: function (request, response) {
419
+ //$.getJSON("csv", request, function( data, status, xhr ) {
420
+ $.getJSON("knxUltimatecsv?nodeID=" + oNodeServer.id, (data) => {
421
+ response($.map(data, function (value, key) {
422
+ var sSearch = (value.ga + " (" + value.devicename + ") DPT" + value.dpt);
423
+ if (fullSearch(sSearch, request.term + " 1.")) {
424
+ return {
425
+ label: value.ga + " # " + value.devicename + " # " + value.dpt, // Label for Display
426
+ value: value.ga // Value
427
+ }
428
+ } else {
429
+ return null;
430
+ }
431
+ }));
432
+ });
433
+ }, select: function (event, ui) {
434
+ // Sets Datapoint and device name automatically
435
+ var sDevName = ui.item.label.split("#")[1].trim();
436
+ try {
437
+ sDevName = sDevName.substr(sDevName.indexOf(")") + 1).trim();
438
+ } catch (error) {
439
+ }
440
+ $('#node-input-nameLightBlink').val(sDevName);
441
+ var optVal = $("#node-input-dptLightBlink option:contains('" + ui.item.label.split("#")[2].trim() + "')").attr('value');
442
+ // Select the option value
443
+ $("#node-input-dptLightBlink").val(optVal);
444
+ }
445
+ });
446
+ // ########################
447
+
398
448
 
399
449
 
400
450
  // Autocomplete suggestion with HUE Lights
@@ -567,7 +617,7 @@
567
617
  </div>
568
618
  </div>
569
619
  <div class="form-row">
570
- <label for="node-input-nameLightBrightnessState" style="width:100px;"><i class="fa fa-play-circle-o"></i>Brightness Status</label>
620
+ <label for="node-input-nameLightBrightnessState" style="width:100px;"><i class="fa fa-play-circle-o"></i> Brightness Status</label>
571
621
 
572
622
  <label for="node-input-GALightBrightnessState" style="width:20px;"><span data-i18n="knxUltimateHueLight.node-input-GALightState"></span></label>
573
623
  <input type="text" id="node-input-GALightBrightnessState" placeholder="Ex: 1/1/1" style="width:70px;margin-left: 5px; text-align: left;">
@@ -578,6 +628,21 @@
578
628
  <label for="node-input-nameLightBrightnessState" style="width:50px; margin-left: 0px; text-align: right;"><span data-i18n="knxUltimateHueLight.node-input-name"></span></label>
579
629
  <input type="text" id="node-input-nameLightBrightnessState" style="width:200px;margin-left: 5px; text-align: left;">
580
630
  </div>
631
+ <br/>
632
+ <br/>
633
+ </div>
634
+ <div class="form-row">
635
+ <label for="node-input-nameLightBlink" style="width:100px;"><i class="fa fa-play-circle-o"></i> Blink</label>
636
+
637
+ <label for="node-input-GALightBlink" style="width:20px;"><span data-i18n="knxUltimateHueLight.node-input-GALightState"></span></label>
638
+ <input type="text" id="node-input-GALightBlink" placeholder="Ex: 1/1/1" style="width:70px;margin-left: 5px; text-align: left;">
639
+
640
+ <label for="node-input-dptLightBlink" style="width:40px; margin-left: 0px; text-align: right;">DPT</label>
641
+ <select id="node-input-dptLightBlink" style="width:140px;"></select>
642
+
643
+ <label for="node-input-nameLightBlink" style="width:50px; margin-left: 0px; text-align: right;"><span data-i18n="knxUltimateHueLight.node-input-name"></span></label>
644
+ <input type="text" id="node-input-nameLightBlink" style="width:200px;margin-left: 5px; text-align: left;">
645
+ </div>
581
646
 
582
647
  <br/>
583
648
  <br/>
@@ -611,6 +676,7 @@ Start typing in the GA field, the name or group address of your KNX device, the
611
676
  | Color Status | Link this to the light's color status group address. Accepted datapoint is RGB triplet (r,g,b)|
612
677
  | Brightness | This command is used to change the absolute HUE light's brightness |
613
678
  | Brightness Status| Link this to the light's brightness status group address |
679
+ | Blink| *true* Blink the light, *false* Stop blinking. Blinks the light on and off. Useful for signalling. It is compatible with all HUE lights. |
614
680
 
615
681
  <br/>
616
682
 
@@ -71,6 +71,23 @@ module.exports = function (RED) {
71
71
  state = bright > 0 ? { on: { on: true }, dimming: { brightness: bright }, color: { xy: retXY } } : { on: { on: false } }
72
72
  node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, state)
73
73
  break
74
+ case config.GALightBlink:
75
+ const gaVal = dptlib.fromBuffer(msg.knx.rawValue, dptlib.resolve(config.dptLightSwitch))
76
+ if (gaVal) {
77
+ node.timerBlink = setInterval(() => {
78
+ if (node.blinkValue === undefined) node.blinkValue = true
79
+ node.blinkValue = !node.blinkValue
80
+ msg.payload = node.blinkValue
81
+ //state = msg.payload === true ? { on: { on: true } } : { on: { on: false } }
82
+ state = msg.payload === true ? { on: { on: true }, dimming: { brightness: 100 } } : { on: { on: false } }
83
+ node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, state)
84
+ node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, state)
85
+ }, 600);
86
+ } else {
87
+ if (node.timerBlink !== undefined) clearInterval(node.timerBlink)
88
+ node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: false } })
89
+ }
90
+ break
74
91
  default:
75
92
  break
76
93
  }
@@ -69,7 +69,7 @@
69
69
  // ########################
70
70
  $.getJSON('knxUltimateDpts', (data) => {
71
71
  data.forEach(dpt => {
72
- if (dpt.value.startsWith("3.007") || dpt.value.startsWith("5.00")) {
72
+ if (dpt.value.startsWith("3.007") || dpt.value.startsWith("5.001") || dpt.value.startsWith("232.600")) {
73
73
  $("#node-input-dptrepeat").append($("<option></option>")
74
74
  .attr("value", dpt.value)
75
75
  .text(dpt.text))
@@ -87,7 +87,7 @@
87
87
  response($.map(data, function (value, key) {
88
88
  var sSearch = (value.ga + " (" + value.devicename + ") DPT" + value.dpt);
89
89
  if (fullSearch(sSearch, request.term)) {
90
- if (value.dpt.startsWith('5.001') || value.dpt.startsWith('3.007')) {
90
+ if (value.dpt.startsWith('5.001') || value.dpt.startsWith('3.007') || value.dpt.startsWith("232.600")) {
91
91
  return {
92
92
  label: value.ga + " # " + value.devicename + " # " + value.dpt, // Label for Display
93
93
  value: value.ga // Value
@@ -231,8 +231,8 @@
231
231
 
232
232
  The Tap Dial device has 4 buttons and 1 rotary knob.
233
233
  You can find the 4 buttons in the **Hue Button node**, not here!
234
- The rotary service of the Tap Dial, can send a DIM (Datapoint 3.007) or absolute brightness (Datapoint 5.001) to the KNX bus,
235
- to the selected group address.
234
+ The rotary service of the Tap Dial, can send a DIM (Datapoint 3.007), absolute brightness (Datapoint 5.001) to the KNX bus,
235
+ or a random color (Datapoint 232.600) to the selected group address.
236
236
 
237
237
  **General**
238
238
  |Property|Description|
@@ -249,7 +249,7 @@ Start typing in the GA field, the name or group address of your KNX device, the
249
249
 
250
250
  |Property|Description|
251
251
  |--|--|
252
- | Rotate | This command is used either to send DIM (increase/decrease) or true/false commands to the KNX group address. Only as info, in the HUE event chain, this is called *repeat* |
252
+ | Rotate | This command is used either to send DIM (increase/decrease), aboslute brightness, or a random color, depending on the selected datapoint. |
253
253
 
254
254
  ### Outputs
255
255
 
@@ -78,6 +78,17 @@ module.exports = function (RED) {
78
78
  //0 – maximum: 32767
79
79
  node.brightnessState < 100 ? node.brightnessState += 20 : node.brightnessState = 100
80
80
  knxMsgPayload.payload = node.brightnessState
81
+ } else if (knxMsgPayload.dpt.startsWith('232.600')) {
82
+ // Random color
83
+ knxMsgPayload.payload = { red: getRandomIntInclusive(0, 255), green: getRandomIntInclusive(0, 255), blue: getRandomIntInclusive(0, 255) }
84
+ function getRandomIntInclusive(min, max) {
85
+ min = Math.ceil(min);
86
+ max = Math.floor(max);
87
+ return Math.floor(Math.random() * (max - min + 1) + min); // The maximum is inclusive and the minimum is inclusive
88
+ }
89
+ // Send to KNX bus
90
+ if (knxMsgPayload.topic !== '' && knxMsgPayload.topic !== undefined) node.server.writeQueueAdd({ grpaddr: knxMsgPayload.topic, payload: knxMsgPayload.payload, dpt: knxMsgPayload.dpt, outputtype: 'write', nodecallerid: node.id })
91
+ if (knxMsgPayload.topic !== '' && knxMsgPayload.topic !== undefined) node.status({ fill: 'green', shape: 'dot', text: 'HUE->KNX start Dim' + ' (' + new Date().getDate() + ', ' + new Date().toLocaleTimeString() + ')' })
81
92
  }
82
93
  } else if (_event.relative_rotary.last_event.rotation.direction === 'counter_clock_wise') {
83
94
  if (knxMsgPayload.dpt.startsWith('3.007')) {
@@ -91,6 +102,17 @@ module.exports = function (RED) {
91
102
  } else if (knxMsgPayload.dpt.startsWith('5.001')) {
92
103
  node.brightnessState > 0 ? node.brightnessState -= 20 : node.brightnessState = 0
93
104
  knxMsgPayload.payload = node.brightnessState
105
+ } else if (knxMsgPayload.dpt.startsWith('232.600')) {
106
+ // Random color
107
+ knxMsgPayload.payload = { red: getRandomIntInclusive(0, 255), green: getRandomIntInclusive(0, 255), blue: getRandomIntInclusive(0, 255) }
108
+ function getRandomIntInclusive(min, max) {
109
+ min = Math.ceil(min);
110
+ max = Math.floor(max);
111
+ return Math.floor(Math.random() * (max - min + 1) + min); // The maximum is inclusive and the minimum is inclusive
112
+ }
113
+ // Send to KNX bus
114
+ if (knxMsgPayload.topic !== '' && knxMsgPayload.topic !== undefined) node.server.writeQueueAdd({ grpaddr: knxMsgPayload.topic, payload: knxMsgPayload.payload, dpt: knxMsgPayload.dpt, outputtype: 'write', nodecallerid: node.id })
115
+ if (knxMsgPayload.topic !== '' && knxMsgPayload.topic !== undefined) node.status({ fill: 'green', shape: 'dot', text: 'HUE->KNX start Dim' + ' (' + new Date().getDate() + ', ' + new Date().toLocaleTimeString() + ')' })
94
116
  }
95
117
  }
96
118
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=14.0.0"
5
5
  },
6
- "version": "2.1.0",
6
+ "version": "2.1.2",
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
  "mkdirp": "1.0.4",
@@ -1,17 +0,0 @@
1
- {
2
- // Usare IntelliSense per informazioni sui possibili attributi.
3
- // Al passaggio del mouse vengono visualizzate le descrizioni degli attributi esistenti.
4
- // Per altre informazioni, visitare: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "node",
9
- "request": "launch",
10
- "name": "Avvia programma",
11
- "skipFiles": [
12
- "<node_internals>/**"
13
- ],
14
- "program": "${workspaceFolder}/nodes/utils/hueUtils.js"
15
- }
16
- ]
17
- }