node-red-contrib-knx-ultimate 2.2.5 → 2.2.6

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,13 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
+ <b>Version 2.2.6</b> - October 2023<br/>
10
+ - Fix: fixed HUE button sending a KNX telegram at startup. Fixed also other nodes.<br/>
11
+ - HUE Nodes: added the option to inizialize at startup or not.<br/>
12
+ </p>
9
13
  <b>Version 2.2.5</b> - October 2023<br/>
10
14
  - Fix: fixed some HUE nodes not able to register to the event notification service.<br/>
15
+ - Restyle GUI of KNX Device node.<br/>
11
16
  </p>
12
17
  <b>Version 2.2.4</b> - October 2023<br/>
13
18
  - HUE Light: fixed some status hiccups and better handling of async hue bridge functions.<br/>
@@ -58,7 +58,7 @@ module.exports = (RED) => {
58
58
  node.nodeClientsAwaitingInit = []; // Stores the nodes client to be initialized
59
59
  node.loglevel = config.loglevel !== undefined ? config.loglevel : "error"; // 18/02/2020 Loglevel default error
60
60
  node.sysLogger = null;
61
- node.hueAllResources = null;
61
+ node.hueAllResources = undefined;
62
62
  try {
63
63
  node.sysLogger = loggerEngine.get({ loglevel: node.loglevel }); // New logger to adhere to the loglevel selected in the config-window
64
64
  } catch (error) {
@@ -129,6 +129,7 @@ module.exports = (RED) => {
129
129
  text: "Ready :-)",
130
130
  });
131
131
  nodeClient.currentHUEDevice = oHUEDevice;
132
+ oHUEDevice.initializingAtStart = true; // Signalling first connection after restart.
132
133
  nodeClient.handleSendHUE(oHUEDevice);
133
134
  }
134
135
  }
@@ -277,7 +278,8 @@ module.exports = (RED) => {
277
278
  if (node.nodeClients.filter((x) => x.id === _Node.id).length === 0) { // At first start, due to the async method for retrieving hueAllResources, hueAllResources is still null. The first start is handled in node.hueManager.on("connected")
278
279
  const oHUEDevice = node.hueAllResources.filter((a) => a.id === _Node.hueDevice)[0];
279
280
  _Node.currentHUEDevice = oHUEDevice;
280
- if (oHUEDevice !== undefined) _Node.handleSendHUE(oHUEDevice);
281
+ oHUEDevice.initializingAtStart = true; // Signalling first connection after restart.
282
+ _Node.handleSendHUE(oHUEDevice);
281
283
  node.nodeClients.push(_Node);
282
284
  // Add _Node to the clients array
283
285
  _Node.setNodeStatusHue({
@@ -11,6 +11,8 @@
11
11
  namebatterysensor: { value: "" },
12
12
  GAbatterysensor: { value: "" },
13
13
  dptbatterysensor: { value: "" },
14
+ readStatusAtStartup: { value: "no" },
15
+
14
16
 
15
17
  hueDevice: { value: "" }
16
18
  },
@@ -212,8 +214,13 @@
212
214
  <input type="text" id="node-input-namebatterysensor" style="width:200px;margin-left: 5px; text-align: left;">
213
215
  </div>
214
216
 
215
-
216
-
217
+ <div class="form-row">
218
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
219
+ <select id="node-input-readStatusAtStartup">
220
+ <option value="no">No</option>
221
+ <option value="yes">Yes, and emit KNX telegrams.</option>
222
+ </select>
223
+ </div>
217
224
  <br/>
218
225
  <br/>
219
226
  <br/>
@@ -222,11 +229,12 @@
222
229
  </script>
223
230
  <script src="https://kit.fontawesome.com/11f26b4500.js" crossorigin="anonymous"></script>
224
231
 
225
- <script type="text/markdown" data-help-name="knxUltimateHueBattery"
226
- This node lets you get the battery level from your HUE device.
227
-
228
- Here you can get the HUE battery level events, that represents a percentage 0-100% value, evetytime the battery level changes.<br/>
229
- Start typing in the GA field, the name or group address of your KNX device, the avaiable devices start showing up while you're typing.
232
+ <script type="text/markdown" data-help-name="knxUltimateHueBattery">
233
+ This node lets you get the battery level from your HUE device. Here you can get the HUE battery level events, that represents a percentage 0-100% value, evetytime the
234
+ battery level changes.
235
+
236
+ Start typing in the GA field, the name or group address of your KNX device, the avaiable devices start showing up while
237
+ you're typing.
230
238
 
231
239
  **General**
232
240
  |Property|Description|
@@ -234,16 +242,17 @@ Start typing in the GA field, the name or group address of your KNX device, the
234
242
  | KNX GW | Select the KNX gateway to be used |
235
243
  | HUE Bridge | Select the HUE Bridge to be used |
236
244
  | Hue Sensor | HUE sensor to be used. The avaiable devices start showing up while you're typing.|
245
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
237
246
 
238
247
  |Property|Description|
239
248
  |--|--|
240
249
  | Level | The battery level group address. The group address must be a percentage 0-100% (5.001) |
241
250
 
242
251
 
243
- <br/>
252
+ <br />
244
253
 
245
254
  [Find it useful?](https://www.paypal.me/techtoday)
246
255
 
247
- <br/>
256
+ <br />
248
257
 
249
- </script>
258
+ </script>
@@ -47,30 +47,34 @@ module.exports = function (RED) {
47
47
  node.handleSendHUE = (_event) => {
48
48
  try {
49
49
  if (_event.id === config.hueDevice) {
50
+
51
+ // IMPORTANT: exit if no event presen.
52
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
53
+ if (!_event.hasOwnProperty("power_state") || _event.power_state.battery_level === undefined) return;
54
+
50
55
  const knxMsgPayload = {};
51
56
  knxMsgPayload.topic = config.GAbatterysensor;
52
57
  knxMsgPayload.dpt = config.dptbatterysensor;
53
58
 
54
- if (_event.hasOwnProperty('power_state') && _event.power_state.hasOwnProperty('battery_level')) {
55
- knxMsgPayload.payload = _event.power_state.battery_level;
56
- // Send to KNX bus
57
- if (knxMsgPayload.topic !== '' && knxMsgPayload.topic !== undefined) {
58
- node.server.writeQueueAdd({
59
- grpaddr: knxMsgPayload.topic, payload: knxMsgPayload.payload, dpt: knxMsgPayload.dpt, outputtype: 'write', nodecallerid: node.id,
60
- });
61
- }
62
-
63
- // Setup the output msg
64
- knxMsgPayload.name = node.name;
65
- knxMsgPayload.event = 'power_state';
66
-
67
- // Send payload
68
- knxMsgPayload.rawEvent = _event;
69
- node.send(knxMsgPayload);
70
- node.setNodeStatusHue({
71
- fill: 'blue', shape: 'ring', text: 'HUE->KNX', payload: knxMsgPayload.payload,
59
+ knxMsgPayload.payload = _event.power_state.battery_level;
60
+ // Send to KNX bus
61
+ if (knxMsgPayload.topic !== '' && knxMsgPayload.topic !== undefined) {
62
+ node.server.writeQueueAdd({
63
+ grpaddr: knxMsgPayload.topic, payload: knxMsgPayload.payload, dpt: knxMsgPayload.dpt, outputtype: 'write', nodecallerid: node.id,
72
64
  });
73
65
  }
66
+
67
+ // Setup the output msg
68
+ knxMsgPayload.name = node.name;
69
+ knxMsgPayload.event = 'power_state';
70
+
71
+ // Send payload
72
+ knxMsgPayload.rawEvent = _event;
73
+ node.send(knxMsgPayload);
74
+ node.setNodeStatusHue({
75
+ fill: 'blue', shape: 'ring', text: 'HUE->KNX', payload: knxMsgPayload.payload,
76
+ });
77
+
74
78
  }
75
79
  } catch (error) {
76
80
  node.status({ fill: 'red', shape: 'dot', text: `HUE->KNX error ${error.message} (${new Date().getDate()}, ${new Date().toLocaleTimeString()})` });
@@ -19,6 +19,7 @@
19
19
  nameshort_releaseStatus: { value: "" },
20
20
  GAshort_releaseStatus: { value: "" },
21
21
  dptshort_releaseStatus: { value: "1.001" },
22
+ readStatusAtStartup: { value: "no" },
22
23
 
23
24
  toggleValues: { value: true },
24
25
  hueDevice: { value: "" }
@@ -396,7 +397,13 @@
396
397
  Toggle values
397
398
  </label>
398
399
  </div>
399
-
400
+ <div class="form-row">
401
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
402
+ <select id="node-input-readStatusAtStartup">
403
+ <option value="no">No</option>
404
+ <option value="yes">Yes, and emit KNX telegrams.</option>
405
+ </select>
406
+ </div>
400
407
 
401
408
 
402
409
  <br/>
@@ -432,6 +439,7 @@ This allows the internal logic to be aware of external devices, like wall switch
432
439
  | Switch Status | To allow internal logic to take care of the external KNX devices, for example an external wall switch, you should set this group address |
433
440
  | Dim | This event is used either to send DIM (increase/decrease) or true/false commands to the KNX group address |
434
441
  | Toggle values | Enable or disable toggling values. If enabled, all values toggles, otherwise, all values are sent as *true* or *increase dim*, to the selected KNX group address |
442
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no") |
435
443
 
436
444
  ### Outputs
437
445
 
@@ -76,6 +76,11 @@ module.exports = function (RED) {
76
76
  node.handleSendHUE = (_event) => {
77
77
  try {
78
78
  if (_event.id === config.hueDevice) {
79
+
80
+ // IMPORTANT: exit if no button last_event present.
81
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
82
+ if (!_event.hasOwnProperty("button") || _event.button.last_event === undefined) return;
83
+
79
84
  const knxMsgPayload = {};
80
85
  let flowMsgPayload = true;
81
86
  // Handling events with toggles
@@ -90,6 +90,7 @@
90
90
  dimSpeed: { value: 5000, required: false },
91
91
  minDimLevelLight: { value: 10, required: false },
92
92
  maxDimLevelLight: { value: 100, required: false },
93
+ readStatusAtStartup: { value: "yes" },
93
94
 
94
95
  hueDevice: { value: "" },
95
96
  },
@@ -765,7 +766,14 @@
765
766
  <div id="tabs-6">
766
767
  <p>
767
768
  <div class="form-row">
768
- <label for="node-input-updateKNXBrightnessStatusOnHUEOnOff" style="width:260px;">
769
+ <label style="width:260px;" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
770
+ <select id="node-input-readStatusAtStartup">
771
+ <option value="no">No</option>
772
+ <option value="yes">Yes, and emit KNX telegrams.</option>
773
+ </select>
774
+ </div>
775
+ <div class="form-row">
776
+ <label style="width:260px;" for="node-input-updateKNXBrightnessStatusOnHUEOnOff">
769
777
  <i class="fa fa-tag"></i> KNX Brightness Status
770
778
  </label>
771
779
  <select id="node-input-updateKNXBrightnessStatusOnHUEOnOff">
@@ -935,6 +943,7 @@
935
943
  | Dim Speed (ms) | The dimming speed, in Milliseconds. This applies to the **light** and also to the **tunable white** dimming datapoints. It' calculated from 0% to 100%. |
936
944
  | Min Dim brightness | Tha Minimum brightness that the lamp can reach. For example, if you are dimming the light down, the light will stop dimming at the specified brightness %. |
937
945
  | Max Dim brightness | Tha Maximum brightness that the lamp can reach. For example, if you are dimming the light up, the light will stop dimming at the specified brightness %. |
946
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
938
947
 
939
948
  ### Note
940
949
 
@@ -35,6 +35,8 @@ module.exports = function (RED) {
35
35
  node.DayTime = true;
36
36
  node.isGrouped_light = config.hueDevice.split("#")[1] === "grouped_light";
37
37
  node.hueDevice = config.hueDevice.split("#")[0];
38
+ node.readStatusAtStartup = config.readStatusAtStartup;
39
+ if (config.readStatusAtStartup === undefined) node.readStatusAtStartup = "yes";
38
40
 
39
41
  // Used to call the status update from the config node.
40
42
  node.setNodeStatus = ({
@@ -419,6 +421,9 @@ module.exports = function (RED) {
419
421
  });
420
422
  return;
421
423
  }
424
+ // IMPORTANT: exit if no button last_event present.
425
+ if (_event.initializingAtStart === true && node.readStatusAtStartup === "no") return;
426
+
422
427
  if (_event.hasOwnProperty("on")) {
423
428
  node.updateKNXLightState(_event.on.on);
424
429
  // In case of switch off, set the dim to zero
@@ -11,6 +11,7 @@
11
11
  namelightsensor: { value: "" },
12
12
  GAlightsensor: { value: "" },
13
13
  dptlightsensor: { value: "" },
14
+ readStatusAtStartup: { value: "no" },
14
15
 
15
16
  hueDevice: { value: "" }
16
17
  },
@@ -211,7 +212,13 @@
211
212
  <input type="text" id="node-input-namelightsensor" style="width:200px;margin-left: 5px; text-align: left;">
212
213
  </div>
213
214
 
214
-
215
+ <div class="form-row">
216
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
217
+ <select id="node-input-readStatusAtStartup">
218
+ <option value="no">No</option>
219
+ <option value="yes">Yes, and emit KNX telegrams.</option>
220
+ </select>
221
+ </div>
215
222
 
216
223
 
217
224
  <br/>
@@ -234,6 +241,7 @@ Start typing in the GA field, the name or group address of your KNX device, the
234
241
  | KNX GW | Select the KNX gateway to be used |
235
242
  | HUE Bridge | Select the HUE Bridge to be used |
236
243
  | Hue Sensor | HUE sensor to be used. The avaiable buttons start showing up while you're typing.|
244
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
237
245
 
238
246
  |Property|Description|
239
247
  |--|--|
@@ -43,6 +43,11 @@ module.exports = function (RED) {
43
43
  node.handleSendHUE = _event => {
44
44
  try {
45
45
  if (_event.id === config.hueDevice) {
46
+
47
+ // IMPORTANT: exit if no event presen.
48
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
49
+ if (!_event.hasOwnProperty('light') || _event.light.light_level === undefined) return;
50
+
46
51
  const knxMsgPayload = {};
47
52
  knxMsgPayload.topic = config.GAlightsensor;
48
53
  knxMsgPayload.dpt = config.dptlightsensor;
@@ -11,6 +11,7 @@
11
11
  namemotion: { value: "" },
12
12
  GAmotion: { value: "" },
13
13
  dptmotion: { value: "" },
14
+ readStatusAtStartup: { value: "no" },
14
15
 
15
16
  hueDevice: { value: "" }
16
17
  },
@@ -211,6 +212,14 @@
211
212
  <input type="text" id="node-input-namemotion" style="width:200px;margin-left: 5px; text-align: left;">
212
213
  </div>
213
214
 
215
+ <div class="form-row">
216
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
217
+ <select id="node-input-readStatusAtStartup">
218
+ <option value="no">No</option>
219
+ <option value="yes">Yes, and emit KNX telegrams.</option>
220
+ </select>
221
+ </div>
222
+
214
223
  <br/>
215
224
  <br/>
216
225
  <br/>
@@ -235,7 +244,8 @@ Start typing in the GA field, the name or group address of your KNX device, the
235
244
  |Property|Description|
236
245
  |--|--|
237
246
  | Motion | As soon as someone moves in the motion device's range, a *true* KNX value is sent to this group address, otherwise *false* is sent. |
238
-
247
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
248
+
239
249
  ### Outputs
240
250
 
241
251
  1. Standard output
@@ -40,6 +40,12 @@ module.exports = function (RED) {
40
40
  node.handleSendHUE = (_event) => {
41
41
  try {
42
42
  if (_event.id === config.hueDevice) {
43
+
44
+ // IMPORTANT: exit if no event presen.
45
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
46
+ if (!_event.hasOwnProperty("motion") || _event.motion.motion === undefined) return;
47
+
48
+
43
49
  const knxMsgPayload = {};
44
50
  knxMsgPayload.topic = config.GAmotion;
45
51
  knxMsgPayload.dpt = config.dptmotion;
@@ -12,6 +12,7 @@
12
12
  GAscene: { value: "" },
13
13
  dptscene: { value: "" },
14
14
  valscene: { value: 0 }, // the scene number or true/false
15
+ readStatusAtStartup: { value: "no" },
15
16
 
16
17
  hueDevice: { value: "" },
17
18
  hueSceneRecallType: { value: "active" }
@@ -251,6 +252,14 @@
251
252
  <select id="node-input-valscene" style="width:180px;margin-left: 5px; text-align: left;"></select>
252
253
  </div>
253
254
 
255
+ <div class="form-row">
256
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
257
+ <select id="node-input-readStatusAtStartup">
258
+ <option value="no">No</option>
259
+ <option value="yes">Yes, and emit KNX telegrams.</option>
260
+ </select>
261
+ </div>
262
+
254
263
  <br/>
255
264
  <br/>
256
265
  <br/>
@@ -276,6 +285,7 @@ Start typing in the GA field, the name or group address of your KNX device, the
276
285
  |--|--|
277
286
  | Recall | Choose your group address to be used for recalling the HUE scene. In case of Datapoint 1.x, send *true* to that group address to recall the scene, *false* to switch off all lights belonging to the scene. |
278
287
  | # | Select the KNX scene number. Visible only with datapoint 18.001. |
288
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
279
289
 
280
290
  <br/>
281
291
 
@@ -78,6 +78,10 @@ module.exports = function (RED) {
78
78
  node.handleSendHUE = _event => {
79
79
  try {
80
80
  if (_event.id === config.hueDevice) {
81
+
82
+ // IMPORTANT: exit if no event presen.
83
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
84
+
81
85
  // const knxMsgPayload = {}
82
86
  // knxMsgPayload.topic = config.GAmotion
83
87
  // knxMsgPayload.dpt = config.dptmotion
@@ -11,6 +11,7 @@
11
11
  namerepeat: { value: "" },
12
12
  GArepeat: { value: "" },
13
13
  dptrepeat: { value: "" },
14
+ readStatusAtStartup: { value: "no" },
14
15
 
15
16
  hueDevice: { value: "" }
16
17
  },
@@ -214,7 +215,13 @@
214
215
  </div>
215
216
 
216
217
 
217
-
218
+ <div class="form-row">
219
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
220
+ <select id="node-input-readStatusAtStartup">
221
+ <option value="no">No</option>
222
+ <option value="yes">Yes, and emit KNX telegrams.</option>
223
+ </select>
224
+ </div>
218
225
 
219
226
 
220
227
  <br/>
@@ -245,6 +252,7 @@ or a random color (Datapoint 232.600) to the selected group address.
245
252
  |Property|Description|
246
253
  |--|--|
247
254
  | Rotate | This command is used either to send DIM (increase/decrease), aboslute brightness, or a random color, depending on the selected datapoint. If the random color (datapoint 232.600) is selected, **clockwise rotation** changes random colors and **counterclockwise rotation** set the light to **white** |
255
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
248
256
 
249
257
  ### Outputs
250
258
 
@@ -49,6 +49,17 @@ module.exports = function (RED) {
49
49
  node.handleSendHUE = (_event) => {
50
50
  try {
51
51
  if (_event.id === config.hueDevice) {
52
+
53
+ // IMPORTANT: exit if no event presen.
54
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
55
+ if (!_event.hasOwnProperty("relative_rotary")
56
+ || !_event.relative_rotary.hasOwnProperty("last_event")
57
+ || _event.relative_rotary.last_event === undefined
58
+ || !_event.relative_rotary.last_event.hasOwnProperty("rotation")
59
+ || !_event.relative_rotary.last_event.rotation.direction === undefined
60
+ || _event.relative_rotary.last_event.action === undefined) return;
61
+
62
+
52
63
  const knxMsgPayload = {};
53
64
  knxMsgPayload.topic = config.GArepeat;
54
65
  knxMsgPayload.dpt = config.dptrepeat;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.5",
6
+ "version": "2.2.6",
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",