node-red-contrib-knx-ultimate 2.2.10 → 2.2.11

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,7 +6,7 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
- <b>Version 2.2.10</b> - November 2023<br/>
9
+ <b>Version 2.2.11</b> - November 2023<br/>
10
10
  <p>
11
11
  - NEW: Hue Light: you can now enable the input/output PINs and send/receive commands to/from the light, via the msg flow, like msg.on={"on":true}. The option is "Node Input/Output PINs".<br/>
12
12
  - NEW: Hue Scene: you can now enable the input/output PINs and send/receive commands to/from the light, via the msg flow. The option is "Node Input/Output PINs".<br/>
@@ -346,14 +346,18 @@ module.exports = (RED) => {
346
346
  // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
347
347
  const serverNode = RED.nodes.getNode(req.query.nodeID); // Retrieve node.id of the config node.
348
348
  const jRet = serverNode.getResources(req.query.rtype);
349
- res.json(jRet);
349
+ if (jRet !== undefined) {
350
+ res.json(jRet);
351
+ } else {
352
+ res.json({ devices: [{ name: "I'm still connecting...Try in some seconds" }] });
353
+ }
350
354
  // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
351
355
  } catch (error) {
352
356
  RED.log.error(`Errore KNXUltimateGetResourcesHUE non gestito ${error.message}`);
353
357
  res.json({ devices: error.message });
354
- (async () => {
355
- await node.ConnectToHueBridge();
356
- })();
358
+ // (async () => {
359
+ // await node.ConnectToHueBridge();
360
+ // })();
357
361
  }
358
362
  });
359
363
 
@@ -94,47 +94,14 @@
94
94
  return this.name;
95
95
  },
96
96
  paletteLabel: "Hue Light",
97
- // button: {
98
- // enabled: function() {
99
- // // return whether or not the button is enabled, based on the current
100
- // // configuration of the node
101
- // return !node.changed
102
- // },
103
- // visible: function() {
104
- // // return whether or not the button is visible, based on the current
105
- // // configuration of the node
106
- // return node.hasButton
107
- // },
108
- // //toggle: "buttonState",
109
- // onclick: function() {}
110
- // },
111
- oneditprepare: prepareUI,
112
- oneditsave: function () {
113
- RED.sidebar.removeTab("tabNRColor");
114
- RED.sidebar.show("help");
115
- if ($("#node-input-enableNodePINS").val() === "yes") {
116
- this.outputs = 1;
117
- this.inputs = 1;
118
- } else {
119
- this.outputs = 0;
120
- this.inputs = 0;
121
- }
122
- },
123
- oneditcancel: function () {
124
- RED.sidebar.removeTab("tabNRColor");
125
- RED.sidebar.show("help");
126
- }
127
- });
128
-
129
-
130
- function prepareUI() {
131
- var node = this;
132
- var oNodeServer = RED.nodes.node($("#node-input-server").val()); // Store the config-node
133
- var oNodeServerHue = RED.nodes.node($("#node-input-serverHue").val()); // Store the config-node
97
+ oneditprepare: function () {
98
+ var node = this;
99
+ var oNodeServer = RED.nodes.node($("#node-input-server").val()); // Store the config-node
100
+ var oNodeServerHue = RED.nodes.node($("#node-input-serverHue").val()); // Store the config-node
134
101
 
135
- // Create the TAB in Node-Red
136
- // ####################################
137
- const content = `<html>
102
+ // Create the TAB in Node-Red
103
+ // ####################################
104
+ const content = `<html>
138
105
 
139
106
  <head>
140
107
  <div class="red-ui-sidebar-header">Color Selector</div>
@@ -169,403 +136,430 @@
169
136
  </html>
170
137
  `;
171
138
 
172
- // COLOR BAR HANDLING ###########################
173
- RED.sidebar.addTab({
174
- id: "tabNRColor",
175
- label: "Color Picker",
176
- name: "Color Picker",
177
- iconClass: "fa fa-pencil",
178
- content: content,
179
- enableOnEdit: true,
180
- });
181
-
182
- // Temperature
183
- this.kelvinPicker = new iro.ColorPicker("#kelvinPicker", {
184
- width: 250,
185
- color: "rgb(255, 0, 0)",
186
- borderWidth: 1,
187
- borderColor: "#fff",
188
- layoutDirection: "vertical",
189
- layout: [
190
- {
191
- component: iro.ui.Slider,
192
- options: {
193
- sliderType: "kelvin",
194
- sliderSize: 20,
195
- },
196
- },
197
- ],
198
- });
199
- // color:change callbacks receive the current color
200
- this.kelvinPicker.on("color:change", function (color) {
201
- const resultRGBForNode = '{"red": ' + color.rgb.r + ', "green": ' + color.rgb.g + ', "blue": ' + color.rgb.b + "}";
202
- $("#resultRGB").val(resultRGBForNode);
203
- $("#resultKelvin").val(Math.round(color.kelvin, 0));
204
- });
205
-
206
- $("#resultKelvin").on("keyup", function () {
207
- setIroColorKelvin();
208
- });
209
- function setIroColorKelvin() {
210
- try {
211
- const color = JSON.parse($("#resultKelvin").val());
212
- this.kelvinPicker.color.setChannel("kelvin", color);
213
- } catch (error) { }
214
- }
139
+ // COLOR BAR HANDLING ###########################
140
+ RED.sidebar.addTab({
141
+ id: "tabNRColor",
142
+ label: "Color Picker",
143
+ name: "Color Picker",
144
+ iconClass: "fa fa-pencil",
145
+ content: content,
146
+ enableOnEdit: true,
147
+ });
215
148
 
216
- // Color
217
- this.colorPicker = new iro.ColorPicker("#colorPicker", {
218
- width: 250,
219
- color: "rgb(255, 0, 0)",
220
- borderWidth: 1,
221
- borderColor: "#fff",
222
- layout: [
223
- {
224
- component: iro.ui.Box,
225
- },
226
- {
227
- component: iro.ui.Slider,
228
- options: {
229
- id: "hue-slider",
230
- sliderType: "hue",
149
+ // Temperature
150
+ this.kelvinPicker = new iro.ColorPicker("#kelvinPicker", {
151
+ width: 250,
152
+ color: "rgb(255, 0, 0)",
153
+ borderWidth: 1,
154
+ borderColor: "#fff",
155
+ layoutDirection: "vertical",
156
+ layout: [
157
+ {
158
+ component: iro.ui.Slider,
159
+ options: {
160
+ sliderType: "kelvin",
161
+ sliderSize: 20,
162
+ },
231
163
  },
232
- },
233
- ],
234
- });
235
- // color:change callbacks receive the current color
236
- this.colorPicker.on("color:change", function (color) {
237
- // Transform to compatible value for the node { "red": 255, "green": 255, "blue": 255 }
238
- const resultRGBForNode = '{"red": ' + color.rgb.r + ', "green": ' + color.rgb.g + ', "blue": ' + color.rgb.b + "}";
239
- $("#resultRGB").val(resultRGBForNode);
240
- });
241
-
242
- $("#resultRGB").on("keyup", function () {
243
- setIroColor();
244
- });
245
- function setIroColor() {
246
- try {
247
- const color = JSON.parse($("#resultRGB").val());
248
- this.colorPicker.color.setChannel("rgb", "r", color.red);
249
- this.colorPicker.color.setChannel("rgb", "g", color.green);
250
- this.colorPicker.color.setChannel("rgb", "b", color.blue);
251
- } catch (error) { }
252
- }
253
- // Copy to clipboard button
254
- $("#tabNRColor_colorSelectorTABApplyTextButton").on("click", function () {
255
- // const aa = $("#resultRGB").val()
256
- // navigator.clipboard.writeText(aa)
257
- const destTextBox = "#" + $("#tabNRColor_destinationTextbox").val();
258
- const resultRGB = $("#resultRGB").val();
259
- const resultKelvin = node.kelvinPicker.colors[0].kelvin;
260
- if (destTextBox === "#node-input-colorAtSwitchOnNightTime" || destTextBox === "#node-input-colorAtSwitchOnDayTime") {
261
- $(destTextBox).val(resultRGB);
262
- } else {
263
- $(destTextBox).val(resultKelvin);
164
+ ],
165
+ });
166
+ // color:change callbacks receive the current color
167
+ this.kelvinPicker.on("color:change", function (color) {
168
+ const resultRGBForNode = '{"red": ' + color.rgb.r + ', "green": ' + color.rgb.g + ', "blue": ' + color.rgb.b + "}";
169
+ $("#resultRGB").val(resultRGBForNode);
170
+ $("#resultKelvin").val(Math.round(color.kelvin, 0));
171
+ });
172
+
173
+ $("#resultKelvin").on("keyup", function () {
174
+ setIroColorKelvin();
175
+ });
176
+ function setIroColorKelvin() {
177
+ try {
178
+ const color = JSON.parse($("#resultKelvin").val());
179
+ this.kelvinPicker.color.setChannel("kelvin", color);
180
+ } catch (error) { }
264
181
  }
265
- // Flash the destination control
266
- $(destTextBox).css("background-color", "lightgreen");
267
- $("#tabNRColor_divApplyCancel").hide();
268
- RED.sidebar.show("help");
269
- setTimeout(() => {
270
- $(destTextBox).css("background-color", "");
271
- }, 500);
272
- });
273
- $("#tabNRColor_colorSelectorTABCancelTextButton").on("click", function () {
274
- $("#tabNRColor_destinationTextbox").val("");
275
- RED.sidebar.show("help");
276
- $("#tabNRColor_divApplyCancel").hide();
277
- });
278
- $("#node-input-colorAtSwitchOnDayTime").on("focus", function () {
279
- RED.sidebar.show("tabNRColor"); // Node-Red custom color TAB
280
- $("#tabNRColor_destinationTextbox").val("node-input-colorAtSwitchOnDayTime");
281
- $("#tabNRColor_divApplyCancel").show();
282
- const color = $("#node-input-colorAtSwitchOnDayTime").val();
283
- $("#resultRGB").val(color);
284
- setIroColor();
285
- });
286
- // $("#node-input-colorAtSwitchOnDayTime").on("blur", function () {
287
- // RED.sidebar.show("help");
288
- // });
289
- $("#node-input-colorAtSwitchOnNightTime").on("focus", function () {
290
- RED.sidebar.show("tabNRColor"); // Node-Red custom color TAB
291
- $("#tabNRColor_destinationTextbox").val("node-input-colorAtSwitchOnNightTime");
292
- $("#tabNRColor_divApplyCancel").show();
293
- const color = $("#node-input-colorAtSwitchOnNightTime").val();
294
- $("#resultRGB").val(color);
295
- setIroColor();
296
- });
297
- // ####################################
298
-
299
- $("#tabs").tabs(); // Tabs gestione KNX
300
-
301
- // 19/02/2020 Used to get the server sooner als deploy.
302
- $("#node-input-server").change(function () {
303
- try {
304
- oNodeServer = RED.nodes.node($(this).val());
305
- } catch (error) { }
306
- });
307
- // 19/02/2020 Used to get the server sooner als deploy.
308
- $("#node-input-serverHue").change(function () {
309
- try {
310
- oNodeServerHue = RED.nodes.node($(this).val());
311
- } catch (error) { }
312
- });
313
-
314
- // 31/03/2020 Search Helper
315
- function fullSearch(sourceText, searchString) {
316
- // This searches for all words in a string
317
- var aSearchWords = searchString.toLowerCase().split(" ");
318
- var i = 0;
319
- for (let index = 0; index < aSearchWords.length; index++) {
320
- if (sourceText.toLowerCase().indexOf(aSearchWords[index]) > -1) i += 1;
182
+
183
+ // Color
184
+ this.colorPicker = new iro.ColorPicker("#colorPicker", {
185
+ width: 250,
186
+ color: "rgb(255, 0, 0)",
187
+ borderWidth: 1,
188
+ borderColor: "#fff",
189
+ layout: [
190
+ {
191
+ component: iro.ui.Box,
192
+ },
193
+ {
194
+ component: iro.ui.Slider,
195
+ options: {
196
+ id: "hue-slider",
197
+ sliderType: "hue",
198
+ },
199
+ },
200
+ ],
201
+ });
202
+ // color:change callbacks receive the current color
203
+ this.colorPicker.on("color:change", function (color) {
204
+ // Transform to compatible value for the node { "red": 255, "green": 255, "blue": 255 }
205
+ const resultRGBForNode = '{"red": ' + color.rgb.r + ', "green": ' + color.rgb.g + ', "blue": ' + color.rgb.b + "}";
206
+ $("#resultRGB").val(resultRGBForNode);
207
+ });
208
+
209
+ $("#resultRGB").on("keyup", function () {
210
+ setIroColor();
211
+ });
212
+ function setIroColor() {
213
+ try {
214
+ const color = JSON.parse($("#resultRGB").val());
215
+ this.colorPicker.color.setChannel("rgb", "r", color.red);
216
+ this.colorPicker.color.setChannel("rgb", "g", color.green);
217
+ this.colorPicker.color.setChannel("rgb", "b", color.blue);
218
+ } catch (error) { }
321
219
  }
322
- return i == aSearchWords.length;
323
- }
220
+ // Copy to clipboard button
221
+ $("#tabNRColor_colorSelectorTABApplyTextButton").on("click", function () {
222
+ // const aa = $("#resultRGB").val()
223
+ // navigator.clipboard.writeText(aa)
224
+ const destTextBox = "#" + $("#tabNRColor_destinationTextbox").val();
225
+ const resultRGB = $("#resultRGB").val();
226
+ const resultKelvin = node.kelvinPicker.colors[0].kelvin;
227
+ if (destTextBox === "#node-input-colorAtSwitchOnNightTime" || destTextBox === "#node-input-colorAtSwitchOnDayTime") {
228
+ $(destTextBox).val(resultRGB);
229
+ } else {
230
+ $(destTextBox).val(resultKelvin);
231
+ }
232
+ // Flash the destination control
233
+ $(destTextBox).css("background-color", "lightgreen");
234
+ $("#tabNRColor_divApplyCancel").hide();
235
+ RED.sidebar.show("help");
236
+ setTimeout(() => {
237
+ $(destTextBox).css("background-color", "");
238
+ }, 500);
239
+ });
240
+ $("#tabNRColor_colorSelectorTABCancelTextButton").on("click", function () {
241
+ $("#tabNRColor_destinationTextbox").val("");
242
+ RED.sidebar.show("help");
243
+ $("#tabNRColor_divApplyCancel").hide();
244
+ });
245
+ $("#node-input-colorAtSwitchOnDayTime").on("focus", function () {
246
+ RED.sidebar.show("tabNRColor"); // Node-Red custom color TAB
247
+ $("#tabNRColor_destinationTextbox").val("node-input-colorAtSwitchOnDayTime");
248
+ $("#tabNRColor_divApplyCancel").show();
249
+ const color = $("#node-input-colorAtSwitchOnDayTime").val();
250
+ $("#resultRGB").val(color);
251
+ setIroColor();
252
+ });
253
+ // $("#node-input-colorAtSwitchOnDayTime").on("blur", function () {
254
+ // RED.sidebar.show("help");
255
+ // });
256
+ $("#node-input-colorAtSwitchOnNightTime").on("focus", function () {
257
+ RED.sidebar.show("tabNRColor"); // Node-Red custom color TAB
258
+ $("#tabNRColor_destinationTextbox").val("node-input-colorAtSwitchOnNightTime");
259
+ $("#tabNRColor_divApplyCancel").show();
260
+ const color = $("#node-input-colorAtSwitchOnNightTime").val();
261
+ $("#resultRGB").val(color);
262
+ setIroColor();
263
+ });
264
+ // ####################################
324
265
 
325
- function getDPT(_dpt, _destinationWidget) {
326
- // DPT Switch command
327
- // ########################
328
- $.getJSON("knxUltimateDpts", (data) => {
329
- data.forEach((dpt) => {
330
- if (dpt.value.startsWith(_dpt)) {
331
- $(_destinationWidget).append($("<option></option>").attr("value", dpt.value).text(dpt.text));
332
- }
333
- });
334
- // Eval
335
- const format = "this." + _destinationWidget.replace("#node-input-", "");
336
- $(_destinationWidget).val(eval(format).toString());
266
+ $("#tabs").tabs(); // Tabs gestione KNX
267
+
268
+ // 19/02/2020 Used to get the server sooner als deploy.
269
+ $("#node-input-server").change(function () {
270
+ try {
271
+ oNodeServer = RED.nodes.node($(this).val());
272
+ } catch (error) { }
273
+ });
274
+ // 19/02/2020 Used to get the server sooner als deploy.
275
+ $("#node-input-serverHue").change(function () {
276
+ try {
277
+ oNodeServerHue = RED.nodes.node($(this).val());
278
+ } catch (error) { }
337
279
  });
338
- }
339
280
 
340
- function getGroupAddress(_sourceWidgetAutocomplete, _destinationWidgetName, _destinationWidgetDPT, _additionalSearchTerm) {
341
- $(_sourceWidgetAutocomplete).autocomplete({
342
- minLength: 1,
343
- source: function (request, response) {
344
- //$.getJSON("csv", request, function( data, status, xhr ) {
345
- $.getJSON("knxUltimatecsv?nodeID=" + oNodeServer.id, (data) => {
346
- response(
347
- $.map(data, function (value, key) {
348
- var sSearch = value.ga + " (" + value.devicename + ") DPT" + value.dpt;
349
- if (fullSearch(sSearch, request.term + _additionalSearchTerm)) {
350
- return {
351
- label: value.ga + " # " + value.devicename + " # " + value.dpt, // Label for Display
352
- value: value.ga, // Value
353
- };
354
- } else {
355
- return null;
356
- }
357
- })
358
- );
281
+ // 31/03/2020 Search Helper
282
+ function fullSearch(sourceText, searchString) {
283
+ // This searches for all words in a string
284
+ var aSearchWords = searchString.toLowerCase().split(" ");
285
+ var i = 0;
286
+ for (let index = 0; index < aSearchWords.length; index++) {
287
+ if (sourceText.toLowerCase().indexOf(aSearchWords[index]) > -1) i += 1;
288
+ }
289
+ return i == aSearchWords.length;
290
+ }
291
+
292
+ function getDPT(_dpt, _destinationWidget) {
293
+ // DPT Switch command
294
+ // ########################
295
+ $.getJSON("knxUltimateDpts", (data) => {
296
+ data.forEach((dpt) => {
297
+ if (dpt.value.startsWith(_dpt)) {
298
+ $(_destinationWidget).append($("<option></option>").attr("value", dpt.value).text(dpt.text));
299
+ }
359
300
  });
360
- },
361
- select: function (event, ui) {
362
- // Sets Datapoint and device name automatically
363
- var sDevName = ui.item.label.split("#")[1].trim();
364
- try {
365
- sDevName = sDevName.substr(sDevName.indexOf(")") + 1).trim();
366
- } catch (error) { }
367
- $(_destinationWidgetName).val(sDevName);
368
- var optVal = $(_destinationWidgetDPT + " option:contains('" + ui.item.label.split("#")[2].trim() + "')").attr("value");
369
- // Select the option value
370
- $(_destinationWidgetDPT).val(optVal);
371
- },
372
- });
373
- }
301
+ // Eval
302
+ const format = "node." + _destinationWidget.replace("#node-input-", "");
303
+ $(_destinationWidget).val(eval(format).toString());
304
+ });
305
+ }
374
306
 
375
- getDPT("1.", "#node-input-dptLightSwitch");
376
- getGroupAddress("#node-input-GALightSwitch", "#node-input-nameLightSwitch", "#node-input-dptLightSwitch", " 1.");
307
+ function getGroupAddress(_sourceWidgetAutocomplete, _destinationWidgetName, _destinationWidgetDPT, _additionalSearchTerm) {
308
+ $(_sourceWidgetAutocomplete).autocomplete({
309
+ minLength: 1,
310
+ source: function (request, response) {
311
+ //$.getJSON("csv", request, function( data, status, xhr ) {
312
+ $.getJSON("knxUltimatecsv?nodeID=" + oNodeServer.id, (data) => {
313
+ response(
314
+ $.map(data, function (value, key) {
315
+ var sSearch = value.ga + " (" + value.devicename + ") DPT" + value.dpt;
316
+ if (fullSearch(sSearch, request.term + _additionalSearchTerm)) {
317
+ return {
318
+ label: value.ga + " # " + value.devicename + " # " + value.dpt, // Label for Display
319
+ value: value.ga, // Value
320
+ };
321
+ } else {
322
+ return null;
323
+ }
324
+ })
325
+ );
326
+ });
327
+ },
328
+ select: function (event, ui) {
329
+ // Sets Datapoint and device name automatically
330
+ var sDevName = ui.item.label.split("#")[1].trim();
331
+ try {
332
+ sDevName = sDevName.substr(sDevName.indexOf(")") + 1).trim();
333
+ } catch (error) { }
334
+ $(_destinationWidgetName).val(sDevName);
335
+ var optVal = $(_destinationWidgetDPT + " option:contains('" + ui.item.label.split("#")[2].trim() + "')").attr("value");
336
+ // Select the option value
337
+ $(_destinationWidgetDPT).val(optVal);
338
+ },
339
+ });
340
+ }
377
341
 
378
- getDPT("1.", "#node-input-dptLightState");
379
- getGroupAddress("#node-input-GALightState", "#node-input-nameLightState", "#node-input-dptLightState", " 1.");
342
+ getDPT("1.", "#node-input-dptLightSwitch");
343
+ getGroupAddress("#node-input-GALightSwitch", "#node-input-nameLightSwitch", "#node-input-dptLightSwitch", " 1.");
380
344
 
381
- getDPT("3.007", "#node-input-dptLightDIM");
382
- getGroupAddress("#node-input-GALightDIM", "#node-input-nameLightDIM", "#node-input-dptLightDIM", " 3.007");
345
+ getDPT("1.", "#node-input-dptLightState");
346
+ getGroupAddress("#node-input-GALightState", "#node-input-nameLightState", "#node-input-dptLightState", " 1.");
383
347
 
384
- getDPT("5.001", "#node-input-dptLightBrightness");
385
- getGroupAddress("#node-input-GALightBrightness", "#node-input-nameLightBrightness", "#node-input-dptLightBrightness", " 5.001");
348
+ getDPT("3.007", "#node-input-dptLightDIM");
349
+ getGroupAddress("#node-input-GALightDIM", "#node-input-nameLightDIM", "#node-input-dptLightDIM", " 3.007");
386
350
 
387
- getDPT("5.001", "#node-input-dptLightBrightnessState");
388
- getGroupAddress("#node-input-GALightBrightnessState", "#node-input-nameLightBrightnessState", "#node-input-dptLightBrightnessState", " 5.001");
351
+ getDPT("5.001", "#node-input-dptLightBrightness");
352
+ getGroupAddress("#node-input-GALightBrightness", "#node-input-nameLightBrightness", "#node-input-dptLightBrightness", " 5.001");
389
353
 
390
- getDPT("232.600", "#node-input-dptLightColor");
391
- getGroupAddress("#node-input-GALightColor", "#node-input-nameLightColor", "#node-input-dptLightColor", " 232.600");
354
+ getDPT("5.001", "#node-input-dptLightBrightnessState");
355
+ getGroupAddress("#node-input-GALightBrightnessState", "#node-input-nameLightBrightnessState", "#node-input-dptLightBrightnessState", " 5.001");
392
356
 
393
- getDPT("232.600", "#node-input-dptLightColorState");
394
- getGroupAddress("#node-input-GALightColorState", "#node-input-nameLightColorState", "#node-input-dptLightColorState", " 232.600");
357
+ getDPT("232.600", "#node-input-dptLightColor");
358
+ getGroupAddress("#node-input-GALightColor", "#node-input-nameLightColor", "#node-input-dptLightColor", " 232.600");
395
359
 
396
- getDPT("3.007", "#node-input-dptLightHSV");
397
- getGroupAddress("#node-input-GALightHSV", "#node-input-nameLightHSV", "#node-input-dptLightHSV", " 3.007");
360
+ getDPT("232.600", "#node-input-dptLightColorState");
361
+ getGroupAddress("#node-input-GALightColorState", "#node-input-nameLightColorState", "#node-input-dptLightColorState", " 232.600");
398
362
 
399
- getDPT("5.001", "#node-input-dptLightHSVPercentage");
400
- getGroupAddress("#node-input-GALightHSVPercentage", "#node-input-nameLightHSVPercentage", "#node-input-dptLightHSVPercentage", " 5.001");
363
+ getDPT("3.007", "#node-input-dptLightHSV");
364
+ getGroupAddress("#node-input-GALightHSV", "#node-input-nameLightHSV", "#node-input-dptLightHSV", " 3.007");
401
365
 
402
- getDPT("5.001", "#node-input-dptLightHSVState");
403
- getGroupAddress("#node-input-GALightHSVState", "#node-input-nameLightHSVState", "#node-input-dptLightHSVState", " 5.001");
366
+ getDPT("5.001", "#node-input-dptLightHSVPercentage");
367
+ getGroupAddress("#node-input-GALightHSVPercentage", "#node-input-nameLightHSVPercentage", "#node-input-dptLightHSVPercentage", " 5.001");
404
368
 
405
- getDPT("1.", "#node-input-dptLightBlink");
406
- getGroupAddress("#node-input-GALightBlink", "#node-input-nameLightBlink", "#node-input-dptLightBlink", " 1.");
369
+ getDPT("5.001", "#node-input-dptLightHSVState");
370
+ getGroupAddress("#node-input-GALightHSVState", "#node-input-nameLightHSVState", "#node-input-dptLightHSVState", " 5.001");
407
371
 
408
- getDPT("1.", "#node-input-dptLightColorCycle");
409
- getGroupAddress("#node-input-GALightColorCycle", "#node-input-nameLightColorCycle", "#node-input-dptLightColorCycle", " 1.");
372
+ getDPT("1.", "#node-input-dptLightBlink");
373
+ getGroupAddress("#node-input-GALightBlink", "#node-input-nameLightBlink", "#node-input-dptLightBlink", " 1.");
410
374
 
411
- getDPT("1.", "#node-input-dptDaylightSensor");
412
- getGroupAddress("#node-input-GADaylightSensor", "#node-input-nameDaylightSensor", "#node-input-dptDaylightSensor", " 1.");
375
+ getDPT("1.", "#node-input-dptLightColorCycle");
376
+ getGroupAddress("#node-input-GALightColorCycle", "#node-input-nameLightColorCycle", "#node-input-dptLightColorCycle", " 1.");
413
377
 
414
- getDPT("7.600", "#node-input-dptLightKelvin");
415
- getGroupAddress("#node-input-GALightKelvin", "#node-input-nameLightKelvin", "#node-input-dptLightKelvin", " 7.600");
378
+ getDPT("1.", "#node-input-dptDaylightSensor");
379
+ getGroupAddress("#node-input-GADaylightSensor", "#node-input-nameDaylightSensor", "#node-input-dptDaylightSensor", " 1.");
416
380
 
417
- getDPT("7.600", "#node-input-dptLightKelvinState");
418
- getGroupAddress("#node-input-GALightKelvinState", "#node-input-nameLightKelvinState", "#node-input-dptLightKelvinState", " 7.600");
381
+ getDPT("7.600", "#node-input-dptLightKelvin");
382
+ getGroupAddress("#node-input-GALightKelvin", "#node-input-nameLightKelvin", "#node-input-dptLightKelvin", " 7.600");
419
383
 
384
+ getDPT("7.600", "#node-input-dptLightKelvinState");
385
+ getGroupAddress("#node-input-GALightKelvinState", "#node-input-nameLightKelvinState", "#node-input-dptLightKelvinState", " 7.600");
420
386
 
421
- // Show/Hide and enable/disable day/night Lighting behaviour
422
- if (this.enableDayNightLighting === "yes") {
423
- $("#divEnableDayNightLighting").show();
424
- $("#divCCSBoxayNightLighting").css({ border: "1px solid dimgrey", "border-radius": "12px", padding: "5px" }); // Add little box to better understand the property page
425
- } else {
426
- $("#divEnableDayNightLighting").hide();
427
- $("#divCCSBoxayNightLighting").css({ border: "", "border-radius": "", padding: "" });
428
- }
429
387
 
430
- $("#node-input-enableDayNightLighting").on("change", function () {
431
- if ($("#node-input-enableDayNightLighting").val() === "yes") {
388
+ // Show/Hide and enable/disable day/night Lighting behaviour
389
+ if (this.enableDayNightLighting === "yes") {
432
390
  $("#divEnableDayNightLighting").show();
433
391
  $("#divCCSBoxayNightLighting").css({ border: "1px solid dimgrey", "border-radius": "12px", padding: "5px" }); // Add little box to better understand the property page
434
392
  } else {
435
393
  $("#divEnableDayNightLighting").hide();
436
394
  $("#divCCSBoxayNightLighting").css({ border: "", "border-radius": "", padding: "" });
437
395
  }
438
- });
439
-
440
- // Show/Hide the div of the color at swich on
441
- if (this.specifySwitchOnBrightness === "yes") {
442
- $("#divColorsAtSwitchOn").show();
443
- } else {
444
- $("#divColorsAtSwitchOn").hide();
445
- $("#node-input-colorAtSwitchOnDayTime").val("");
446
- }
447
396
 
448
- $("#node-input-specifySwitchOnBrightness").on("change", function () {
449
- if ($("#node-input-specifySwitchOnBrightness").val() === "yes") {
397
+ $("#node-input-enableDayNightLighting").on("change", function () {
398
+ if ($("#node-input-enableDayNightLighting").val() === "yes") {
399
+ $("#divEnableDayNightLighting").show();
400
+ $("#divCCSBoxayNightLighting").css({ border: "1px solid dimgrey", "border-radius": "12px", padding: "5px" }); // Add little box to better understand the property page
401
+ } else {
402
+ $("#divEnableDayNightLighting").hide();
403
+ $("#divCCSBoxayNightLighting").css({ border: "", "border-radius": "", padding: "" });
404
+ }
405
+ });
406
+
407
+ // Show/Hide the div of the color at swich on
408
+ if (this.specifySwitchOnBrightness === "yes") {
450
409
  $("#divColorsAtSwitchOn").show();
451
- if ($("#node-input-colorAtSwitchOnDayTime").val() === "") $("#node-input-colorAtSwitchOnDayTime").val('{ "red": 255, "green": 255, "blue": 255 }');
452
410
  } else {
453
411
  $("#divColorsAtSwitchOn").hide();
454
412
  $("#node-input-colorAtSwitchOnDayTime").val("");
455
413
  }
456
- });
457
-
458
- // Autocomplete suggestion with HUE Lights
459
- $("#node-input-name").autocomplete({
460
- minLength: 1,
461
- source: function (request, response) {
462
- $.getJSON("KNXUltimateGetResourcesHUE?rtype=light&nodeID=" + oNodeServerHue.id, (data) => {
463
- response(
464
- $.map(data.devices, function (value, key) {
465
- //alert(JSON.stringify(value) + " "+ key)
466
- var sSearch = value.name;
467
- if (fullSearch(sSearch, request.term)) {
468
- return {
469
- hueDevice: value.id,
470
- value: value.name,
471
- };
472
- } else {
473
- return null;
474
- }
475
- })
476
- );
477
- });
478
- },
479
- select: function (event, ui) {
480
- // Distinguish between group of lights an single light.
481
- if (ui.item.value.toLowerCase().startsWith("grouped_light")) {
482
- $("#node-input-hueDevice").val(ui.item.hueDevice + "#grouped_light");
483
- $("#getColorAtSwitchOnDayTimeButton").hide();
484
- $("#getColorAtSwitchOnNightTimeButton").hide();
414
+
415
+ $("#node-input-specifySwitchOnBrightness").on("change", function () {
416
+ if ($("#node-input-specifySwitchOnBrightness").val() === "yes") {
417
+ $("#divColorsAtSwitchOn").show();
418
+ if ($("#node-input-colorAtSwitchOnDayTime").val() === "") $("#node-input-colorAtSwitchOnDayTime").val('{ "red": 255, "green": 255, "blue": 255 }');
485
419
  } else {
486
- $("#node-input-hueDevice").val(ui.item.hueDevice + "#light");
487
- $("#getColorAtSwitchOnDayTimeButton").show();
488
- $("#getColorAtSwitchOnNightTimeButton").show();
420
+ $("#divColorsAtSwitchOn").hide();
421
+ $("#node-input-colorAtSwitchOnDayTime").val("");
489
422
  }
490
- $("#tabs").show();
491
- },
492
- });
493
-
494
- // Get the HUE capabilities to enable/disable UI parts
495
- $.getJSON("KNXUltimateGetResourcesHUE?rtype=light&nodeID=" + oNodeServerHue.id, (data) => {
496
- data.devices.forEach((element) => {
497
- if (element.id === this.hueDevice.split("#")[0] && element.deviceObject !== undefined) {
498
- // Check dimming
499
- if (element.deviceObject.dimming === undefined) {
500
- $("#tabs").tabs("disable", "#tabs-2");
501
- $("#divColorsAtSwitchOn").hide();
502
- $("#divColorCycle").hide();
503
- }
504
- // Check color
505
- if (element.deviceObject.color_temperature === undefined) $("#tabs").tabs("disable", "#tabs-3");
506
- if (element.deviceObject.color === undefined) {
507
- $("#tabs").tabs("disable", "#tabs-4");
508
- $("#divColorsAtSwitchOn").hide();
509
- $("#divColorCycle").hide();
510
- }
511
- // Check if grouped, to hide/show the "Get current" buttons
512
- if (element.deviceObject.type === "grouped_light") {
423
+ });
424
+
425
+ // Autocomplete suggestion with HUE Lights
426
+ $("#node-input-name").autocomplete({
427
+ minLength: 1,
428
+ source: function (request, response) {
429
+ $.getJSON("KNXUltimateGetResourcesHUE?rtype=light&nodeID=" + oNodeServerHue.id, (data) => {
430
+ response(
431
+ $.map(data.devices, function (value, key) {
432
+ //alert(JSON.stringify(value) + " "+ key)
433
+ var sSearch = value.name;
434
+ if (!value.name.includes("I'm still connecting")) {
435
+ if (fullSearch(sSearch, request.term)) {
436
+ return {
437
+ hueDevice: value.id,
438
+ value: value.name,
439
+ };
440
+ } else {
441
+ return null;
442
+ }
443
+ } else {
444
+ return {
445
+ hueDevice: value.id,
446
+ value: value.name,
447
+ };
448
+ }
449
+ })
450
+ );
451
+ });
452
+ },
453
+ select: function (event, ui) {
454
+ // Distinguish between group of lights an single light.
455
+ if (ui.item.value.toLowerCase().startsWith("grouped_light")) {
456
+ $("#node-input-hueDevice").val(ui.item.hueDevice + "#grouped_light");
513
457
  $("#getColorAtSwitchOnDayTimeButton").hide();
514
458
  $("#getColorAtSwitchOnNightTimeButton").hide();
515
459
  } else {
460
+ $("#node-input-hueDevice").val(ui.item.hueDevice + "#light");
516
461
  $("#getColorAtSwitchOnDayTimeButton").show();
517
462
  $("#getColorAtSwitchOnNightTimeButton").show();
518
463
  }
519
- return;
520
- }
464
+ $("#tabs").show();
465
+ },
521
466
  });
522
- });
523
467
 
524
- $("#getColorAtSwitchOnDayTimeButton").on("click", function () {
525
- $("#getColorAtSwitchOnDayTimeButton").text("Wait...");
526
- $.getJSON("knxUltimateGetHueColor?id=" + $("#node-input-hueDevice").val().split("#")[0], (data) => {
527
- $("#node-input-colorAtSwitchOnDayTime").val(data.toString());
528
- $("#node-input-colorAtSwitchOnDayTime").css("background-color", "lightgreen");
529
- setTimeout(() => {
530
- $("#node-input-colorAtSwitchOnDayTime").css("background-color", "");
531
- }, 500);
532
- $("#getColorAtSwitchOnDayTimeButton").text("Get current");
468
+ // Get the HUE capabilities to enable/disable UI parts
469
+ $.getJSON("KNXUltimateGetResourcesHUE?rtype=light&nodeID=" + oNodeServerHue.id, (data) => {
470
+ data.devices.forEach((element) => {
471
+ if (element.id === this.hueDevice.split("#")[0] && element.deviceObject !== undefined) {
472
+ // Check dimming
473
+ if (element.deviceObject.dimming === undefined) {
474
+ $("#tabs").tabs("disable", "#tabs-2");
475
+ $("#divColorsAtSwitchOn").hide();
476
+ $("#divColorCycle").hide();
477
+ }
478
+ // Check color
479
+ if (element.deviceObject.color_temperature === undefined) $("#tabs").tabs("disable", "#tabs-3");
480
+ if (element.deviceObject.color === undefined) {
481
+ $("#tabs").tabs("disable", "#tabs-4");
482
+ $("#divColorsAtSwitchOn").hide();
483
+ $("#divColorCycle").hide();
484
+ }
485
+ // Check if grouped, to hide/show the "Get current" buttons
486
+ if (element.deviceObject.type === "grouped_light") {
487
+ $("#getColorAtSwitchOnDayTimeButton").hide();
488
+ $("#getColorAtSwitchOnNightTimeButton").hide();
489
+ } else {
490
+ $("#getColorAtSwitchOnDayTimeButton").show();
491
+ $("#getColorAtSwitchOnNightTimeButton").show();
492
+ }
493
+ return;
494
+ }
495
+ });
533
496
  });
534
- });
535
- $("#getColorAtSwitchOnNightTimeButton").on("click", function () {
536
- $("#getColorAtSwitchOnNightTimeButton").text("Wait...");
537
- $.getJSON("knxUltimateGetHueColor?id=" + $("#node-input-hueDevice").val().split("#")[0], (data) => {
538
- $("#node-input-colorAtSwitchOnNightTime").val(data.toString());
539
- $("#node-input-colorAtSwitchOnNightTime").css("background-color", "lightgreen");
540
- setTimeout(() => {
541
- $("#node-input-colorAtSwitchOnNightTime").css("background-color", "");
542
- }, 500);
543
- $("#getColorAtSwitchOnNightTimeButton").text("Get current");
497
+
498
+ $("#getColorAtSwitchOnDayTimeButton").on("click", function () {
499
+ $("#getColorAtSwitchOnDayTimeButton").text("Wait...");
500
+ $.getJSON("knxUltimateGetHueColor?id=" + $("#node-input-hueDevice").val().split("#")[0], (data) => {
501
+ $("#node-input-colorAtSwitchOnDayTime").val(data.toString());
502
+ $("#node-input-colorAtSwitchOnDayTime").css("background-color", "lightgreen");
503
+ setTimeout(() => {
504
+ $("#node-input-colorAtSwitchOnDayTime").css("background-color", "");
505
+ }, 500);
506
+ $("#getColorAtSwitchOnDayTimeButton").text("Get current");
507
+ });
508
+ });
509
+ $("#getColorAtSwitchOnNightTimeButton").on("click", function () {
510
+ $("#getColorAtSwitchOnNightTimeButton").text("Wait...");
511
+ $.getJSON("knxUltimateGetHueColor?id=" + $("#node-input-hueDevice").val().split("#")[0], (data) => {
512
+ $("#node-input-colorAtSwitchOnNightTime").val(data.toString());
513
+ $("#node-input-colorAtSwitchOnNightTime").css("background-color", "lightgreen");
514
+ setTimeout(() => {
515
+ $("#node-input-colorAtSwitchOnNightTime").css("background-color", "");
516
+ }, 500);
517
+ $("#getColorAtSwitchOnNightTimeButton").text("Get current");
518
+ });
544
519
  });
545
- });
546
520
 
547
- // Fill options for minDimLevel and maxDimLevel
548
- for (let index = 0; index <= 90; index++) {
549
- if (index === 0) {
550
- $("#node-input-minDimLevelLight").append($("<option>").val(index).text(index.toString() + "% (Switch Off)"));
551
- } else {
552
- $("#node-input-minDimLevelLight").append($("<option>").val(index).text(index.toString() + "%"));
521
+ // Fill options for minDimLevel and maxDimLevel
522
+ for (let index = 0; index <= 90; index++) {
523
+ if (index === 0) {
524
+ $("#node-input-minDimLevelLight").append($("<option>").val(index).text(index.toString() + "% (Switch Off)"));
525
+ } else {
526
+ $("#node-input-minDimLevelLight").append($("<option>").val(index).text(index.toString() + "%"));
527
+ }
528
+
553
529
  }
530
+ $("#node-input-minDimLevelLight").val(this.minDimLevelLight);
531
+ for (let index = 100; index >= 10; index--) {
532
+ $("#node-input-maxDimLevelLight").append(
533
+ $("<option>")
534
+ .val(index)
535
+ .text(index.toString() + "%")
536
+ );
537
+ }
538
+ $("#node-input-maxDimLevelLight").val(this.maxDimLevelLight);
554
539
 
540
+ if (this.hueDevice !== "") $("#tabs").show();
541
+
542
+
543
+ },
544
+ oneditsave: function () {
545
+ RED.sidebar.removeTab("tabNRColor");
546
+ RED.sidebar.show("help");
547
+ if ($("#node-input-enableNodePINS").val() === "yes") {
548
+ this.outputs = 1;
549
+ this.inputs = 1;
550
+ } else {
551
+ this.outputs = 0;
552
+ this.inputs = 0;
553
+ }
554
+ },
555
+ oneditcancel: function () {
556
+ RED.sidebar.removeTab("tabNRColor");
557
+ RED.sidebar.show("help");
555
558
  }
556
- $("#node-input-minDimLevelLight").val(this.minDimLevelLight);
557
- for (let index = 100; index >= 10; index--) {
558
- $("#node-input-maxDimLevelLight").append(
559
- $("<option>")
560
- .val(index)
561
- .text(index.toString() + "%")
562
- );
563
- }
564
- $("#node-input-maxDimLevelLight").val(this.maxDimLevelLight);
559
+ });
560
+
565
561
 
566
- if (this.hueDevice !== "") $("#tabs").show();
567
562
 
568
- }
569
563
 
570
564
  </script>
571
565
  <script src="http://localhost:1880/resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.10",
6
+ "version": "2.2.11",
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",