node-red-contrib-knx-ultimate 2.2.18 → 2.2.20

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.
@@ -81,7 +81,7 @@ module.exports = (RED) => {
81
81
  // }
82
82
 
83
83
  // Connect to Bridge and get the resources
84
- node.initHUEConnection = () => {
84
+ node.initHUEConnection = async () => {
85
85
  try {
86
86
  if (node.hueManager !== undefined) node.hueManager.close();
87
87
  } catch (error) { }
@@ -115,7 +115,24 @@ module.exports = (RED) => {
115
115
  // Start the timer to do initial read.
116
116
  if (node.timerDoInitialRead !== null) clearTimeout(node.timerDoInitialRead);
117
117
  node.timerDoInitialRead = setTimeout(() => {
118
- node.loadResourcesFromHUEBridge();
118
+ (async () => {
119
+ try {
120
+ await node.loadResourcesFromHUEBridge();
121
+ } catch (error) {
122
+ node.linkStatus = "disconnected";
123
+ node.nodeClients.forEach((_oClient) => {
124
+ setTimeout(() => {
125
+ _oClient.setNodeStatusHue({
126
+ fill: "red",
127
+ shape: "ring",
128
+ text: "HUE",
129
+ payload: error.message,
130
+ });
131
+ }, 1000);
132
+ });
133
+ }
134
+ node.startWatchdogTimer();
135
+ })();
119
136
  }, 6000); // 17/02/2020 Do initial read of all nodes requesting initial read
120
137
  });
121
138
 
@@ -133,11 +150,12 @@ module.exports = (RED) => {
133
150
  };
134
151
 
135
152
  node.startWatchdogTimer = () => {
153
+ if (node.timerHUEConfigCheckState !== undefined) clearTimeout(node.timerHUEConfigCheckState);
136
154
  node.timerHUEConfigCheckState = setTimeout(() => {
137
155
  (async () => {
138
156
  if (node.linkStatus === "disconnected") {
139
157
  try {
140
- node.initHUEConnection();
158
+ await node.initHUEConnection();
141
159
  } catch (error) {
142
160
  node.linkStatus = "disconnected";
143
161
  }
@@ -149,41 +167,41 @@ module.exports = (RED) => {
149
167
  node.startWatchdogTimer();
150
168
 
151
169
  // Query the HUE Bridge to return the resources
152
- node.loadResourcesFromHUEBridge = () => {
170
+ node.loadResourcesFromHUEBridge = async () => {
153
171
  if (node.linkStatus === "disconnected") return;
154
- (async () => {
155
- // °°°°°° Load ALL resources
156
- try {
157
- node.hueAllResources = await node.hueManager.hueApiV2.get("/resource");
158
- if (node.hueAllResources !== undefined) {
159
- node.hueAllRooms = node.hueAllResources.filter((a) => a.type === "room");
160
- // Update all KNX State of the nodes with the new hue device values
161
- node.nodeClients.forEach((_node) => {
162
- if (_node.hueDevice !== undefined && node.hueAllResources !== undefined) {
163
- const oHUEDevice = node.hueAllResources.filter((a) => a.id === _node.hueDevice)[0];
164
- if (oHUEDevice !== undefined) {
165
- // Add _Node to the clients array
166
- _node.setNodeStatusHue({
167
- fill: "green",
168
- shape: "ring",
169
- text: "Ready :-)",
170
- });
171
- _node.currentHUEDevice = oHUEDevice;
172
- if (_node.initializingAtStart === true) _node.handleSendHUE(oHUEDevice);
173
- }
172
+ //(async () => {
173
+ // °°°°°° Load ALL resources
174
+ try {
175
+ node.hueAllResources = await node.hueManager.hueApiV2.get("/resource");
176
+ if (node.hueAllResources !== undefined) {
177
+ node.hueAllRooms = node.hueAllResources.filter((a) => a.type === "room");
178
+ // Update all KNX State of the nodes with the new hue device values
179
+ node.nodeClients.forEach((_node) => {
180
+ if (_node.hueDevice !== undefined && node.hueAllResources !== undefined) {
181
+ const oHUEDevice = node.hueAllResources.filter((a) => a.id === _node.hueDevice)[0];
182
+ if (oHUEDevice !== undefined) {
183
+ // Add _Node to the clients array
184
+ _node.setNodeStatusHue({
185
+ fill: "green",
186
+ shape: "ring",
187
+ text: "Ready :-)",
188
+ });
189
+ _node.currentHUEDevice = oHUEDevice;
190
+ if (_node.initializingAtStart === true) _node.handleSendHUE(oHUEDevice);
174
191
  }
175
- });
176
- } else {
177
- // The config node cannot read the resources. Signalling disconnected
178
- }
179
- } catch (error) {
180
- if (this.sysLogger !== undefined && this.sysLogger !== null) {
181
- this.sysLogger.error(`KNXUltimatehueEngine: loadResourcesFromHUEBridge: ${error.message}`);
182
- return (error.message);
183
- }
192
+ }
193
+ });
194
+ } else {
195
+ // The config node cannot read the resources. Signalling disconnected
196
+ }
197
+ } catch (error) {
198
+ if (this.sysLogger !== undefined && this.sysLogger !== null) {
199
+ this.sysLogger.error(`KNXUltimatehueEngine: loadResourcesFromHUEBridge: ${error.message}`);
200
+ throw (error);
184
201
  }
185
- return true;
186
- })();
202
+ }
203
+
204
+ //})();
187
205
  };
188
206
 
189
207
  // Returns the cached devices (node.hueAllResources) by type.
@@ -304,7 +322,6 @@ module.exports = (RED) => {
304
322
  // Query HUE Bridge and get the updated color.
305
323
  node.getColorFromHueLight = (_lightId) => {
306
324
  try {
307
- // await node.loadResourcesFromHUEBridge();
308
325
  const oLight = node.hueAllResources.filter((a) => a.id === _lightId)[0];
309
326
  const ret = hueColorConverter.ColorConverter.xyBriToRgb(oLight.color.xy.x, oLight.color.xy.y, oLight.dimming.brightness);
310
327
  return JSON.stringify(ret);
@@ -227,7 +227,8 @@
227
227
 
228
228
 
229
229
  </script>
230
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
230
+ <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
231
+ crossorigin="anonymous"></script>
231
232
 
232
233
  <script type="text/markdown" data-help-name="knxUltimateHueBattery">
233
234
  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
@@ -404,7 +404,8 @@
404
404
 
405
405
 
406
406
  </script>
407
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
407
+ <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
408
+ crossorigin="anonymous"></script>
408
409
 
409
410
  <script type="text/markdown" data-help-name="knxUltimateHueButton">
410
411
  This node lets you get the events from your HUE button.
@@ -1,6 +1,9 @@
1
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
2
- <script src="resources/node-red-contrib-knx-ultimate/iro@5"></script>
3
-
1
+ <!-- <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
2
+ crossorigin="anonymous"></script>
3
+ <script src="resources/node-red-contrib-knx-ultimate/iro@5"></script> -->
4
+ <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
5
+ crossorigin="anonymous"></script>
6
+ <script type="application/javascript;charset=utf-8" src="https://cdn.jsdelivr.net/npm/@jaames/iro@5"></script>
4
7
  <script type="text/javascript">
5
8
 
6
9
  RED.nodes.registerType("knxUltimateHueLight", {
@@ -568,8 +571,7 @@
568
571
 
569
572
 
570
573
  </script>
571
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
572
- <script src="resources/node-red-contrib-knx-ultimate/iro@5"></script>
574
+
573
575
 
574
576
  <script type="text/html" data-template-name="knxUltimateHueLight">
575
577
 
@@ -56,7 +56,7 @@ module.exports = function (RED) {
56
56
 
57
57
  // This function is called by the hue-config.js
58
58
  node.handleSend = (msg) => {
59
- if (node.currentHUEDevice === undefined) {
59
+ if (node.currentHUEDevice === undefined && node.serverHue.linkStatus === "connected") {
60
60
  node.setNodeStatusHue({
61
61
  fill: "yellow",
62
62
  shape: "ring",
@@ -228,7 +228,8 @@
228
228
 
229
229
 
230
230
  </script>
231
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
231
+ <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
232
+ crossorigin="anonymous"></script>
232
233
 
233
234
  <script type="text/markdown" data-help-name="knxUltimateHueLightSensor">
234
235
  This node lets you get the events from your HUE motion device.
@@ -217,7 +217,8 @@
217
217
 
218
218
 
219
219
  </script>
220
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
220
+ <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
221
+ crossorigin="anonymous"></script>
221
222
 
222
223
  <script type="text/markdown" data-help-name="knxUltimateHueMotion">
223
224
  This node lets you get the events from your HUE motion device.
@@ -283,7 +283,8 @@
283
283
 
284
284
 
285
285
  </script>
286
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
286
+ <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
287
+ crossorigin="anonymous"></script>
287
288
 
288
289
  <script type="text/markdown" data-help-name="knxUltimateHueScene">
289
290
  This node lets you recall a HUE scene, via KNX.
@@ -219,7 +219,8 @@
219
219
 
220
220
 
221
221
  </script>
222
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
222
+ <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
223
+ crossorigin="anonymous"></script>
223
224
 
224
225
  <script type="text/markdown" data-help-name="knxUltimateHueTapDial">
225
226
  This node lets you get the events from your HUE rotary device, for example the Tap Dial.
@@ -227,7 +227,8 @@
227
227
 
228
228
 
229
229
  </script>
230
- <script src="resources/node-red-contrib-knx-ultimate/11f26b4500.js"></script>
230
+ <script type="application/javascript;charset=utf-8" src="https://kit.fontawesome.com/11f26b4500.js"
231
+ crossorigin="anonymous"></script>
231
232
 
232
233
  <script type="text/markdown" data-help-name="knxUltimateHueTemperatureSensor" This node lets you get the events from
233
234
  your HUE temperature device. Here you can get the HUE temperature events, that represents a celsius value, evetytime
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.18",
6
+ "version": "2.2.20",
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",