node-red-contrib-knx-ultimate 3.2.9 → 3.2.10

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,9 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
+ **Version 3.2.10** - October 2024<br/>
10
+ - Fixed a race condition happening whenever FULL DEPLOY is pressed in the node-red interface, preventing the HUE bridge node to gracefully disconnect from the HUE Bridge.<br/>
11
+
9
12
  **Version 3.2.9** - October 2024<br/>
10
13
  - Maintenance release: added some log to better identify problems.<br/>
11
14
 
@@ -66,11 +66,16 @@ module.exports = (RED) => {
66
66
  try {
67
67
  const serverId = RED.nodes.getNode(req.query.serverId); // Retrieve node.id of the config node.
68
68
  if (serverId.hueAllResources === null || serverId.hueAllResources === undefined) {
69
- res.json({ ready: false });
69
+ (async function main() {
70
+ await serverId.loadResourcesFromHUEBridge();
71
+ res.json({ ready: false });
72
+ }()).catch();
70
73
  } else {
71
74
  res.json({ ready: true });
72
75
  }
73
76
  } catch (error) {
77
+ RED.log.error(`Errore RED.httpAdmin.get('/knxultimateCheckHueConnected' ${error.message}`);
78
+
74
79
  res.json({ ready: false });
75
80
  }
76
81
  });
@@ -477,18 +477,17 @@ module.exports = (RED) => {
477
477
  node.on("close", (done) => {
478
478
  try {
479
479
  if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger = null;
480
- loggerEngine.destroy();
481
480
  node.nodeClients = [];
482
- node.hueManager.removeAllListeners();
481
+ if (node.hueManager !== undefined && node.hueManager !== null) node.hueManager.removeAllListeners();
483
482
  (async () => {
484
483
  try {
485
484
  await node.hueManager.close();
486
485
  node.hueManager = null;
487
486
  delete node.hueManager;
487
+ done();
488
488
  } catch (error) {
489
- /* empty */
489
+ done();
490
490
  }
491
- done();
492
491
  })();
493
492
  } catch (error) {
494
493
  done();
@@ -723,6 +723,10 @@
723
723
  let timerWaitBackEndCounter = 0;
724
724
  function checkConnection() {
725
725
  if (this.timerWaitBackEnd !== undefined) clearTimeout(this.timerWaitBackEnd);
726
+ if ($("#node-input-serverHue").val() === undefined) {
727
+ // Someone has FULL deployed node-red, exit.
728
+ return;
729
+ }
726
730
  this.timerWaitBackEnd = setTimeout(() => {
727
731
  timerWaitBackEndCounter++;
728
732
  if (timerWaitBackEndCounter > 20) {
@@ -44,8 +44,11 @@ class classHUE extends EventEmitter {
44
44
  });
45
45
 
46
46
  try {
47
- this.es.close();
48
- this.es = null;
47
+ if (this.es !== null && this.es !== undefined) {
48
+ this.es.removeEventListener();
49
+ this.es.close();
50
+ this.es = null;
51
+ }
49
52
  } catch (error) {
50
53
  /* empty */
51
54
  }
@@ -99,19 +102,6 @@ class classHUE extends EventEmitter {
99
102
  // // this.emit('error', error)
100
103
  // };
101
104
 
102
- // 31/07/2023 Every now and then, restart the connection to the eventsource, because it can goes down without knowing that
103
- if (this.timerReconnect !== undefined) clearInterval(this.timerReconnect);
104
- this.timerReconnect = setInterval(() => {
105
- try {
106
- this.es.close();
107
- this.es = null;
108
- } catch (error) {
109
- /* empty */
110
- }
111
- try {
112
- this.Connect();
113
- } catch (error) { }
114
- }, 10 * (60 * 1000)); // 10 minutes
115
105
  };
116
106
 
117
107
  // Process single item in the queue
@@ -224,15 +214,14 @@ class classHUE extends EventEmitter {
224
214
  close = async () =>
225
215
  new Promise((resolve, reject) => {
226
216
  try {
227
- if (this.timerReconnect !== undefined) clearInterval(this.timerReconnect);
228
- this.closePushEventStream = true; // Signal to exit all loops
229
- try {
230
- if (this.es !== null && this.es !== undefined) this.es.close();
231
- } catch (error) { }
232
- this.es = null;
217
+ this.closePushEventStream = true; // Signal to exit all loops
233
218
  setTimeout(() => {
219
+ try {
220
+ if (this.es !== null && this.es !== undefined) this.es.close();
221
+ } catch (error) { }
222
+ this.es = null;
234
223
  resolve(true);
235
- }, 500);
224
+ }, 2000);
236
225
  } catch (error) {
237
226
  reject(error);
238
227
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "3.2.9",
6
+ "version": "3.2.10",
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",