node-red-contrib-knx-ultimate 2.2.10 → 2.2.12
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 +1 -1
- package/nodes/hue-config.js +92 -62
- package/nodes/knxUltimate-config.js +2 -19
- package/nodes/knxUltimateHueBattery.js +2 -2
- package/nodes/knxUltimateHueButton.js +2 -1
- package/nodes/knxUltimateHueLight.html +376 -382
- package/nodes/knxUltimateHueLight.js +3 -4
- package/nodes/knxUltimateHueLightSensor.js +2 -1
- package/nodes/knxUltimateHueMotion.js +2 -1
- package/nodes/knxUltimateHueScene.js +2 -5
- package/nodes/knxUltimateHueTapDial.js +2 -1
- package/nodes/utils/hueEngine.js +23 -3
- package/package.json +1 -1
|
@@ -35,8 +35,7 @@ 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.
|
|
39
|
-
if (config.readStatusAtStartup === undefined) node.readStatusAtStartup = "yes";
|
|
38
|
+
node.initializingAtStart = (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "yes");
|
|
40
39
|
|
|
41
40
|
// Used to call the status update from the config node.
|
|
42
41
|
node.setNodeStatus = ({
|
|
@@ -60,7 +59,7 @@ module.exports = function (RED) {
|
|
|
60
59
|
node.handleSend = (msg) => {
|
|
61
60
|
if (node.currentHUEDevice === undefined) {
|
|
62
61
|
node.setNodeStatusHue({
|
|
63
|
-
fill: "
|
|
62
|
+
fill: "yellow",
|
|
64
63
|
shape: "ring",
|
|
65
64
|
text: "Initializing. Please wait.",
|
|
66
65
|
payload: "",
|
|
@@ -428,7 +427,7 @@ module.exports = function (RED) {
|
|
|
428
427
|
return;
|
|
429
428
|
}
|
|
430
429
|
// IMPORTANT: exit if no button last_event present.
|
|
431
|
-
if (
|
|
430
|
+
if (!node.initializingAtStart) return;
|
|
432
431
|
|
|
433
432
|
// Output the msg to the flow
|
|
434
433
|
node.send(_event);
|
|
@@ -23,6 +23,7 @@ module.exports = function (RED) {
|
|
|
23
23
|
node.formatnegativevalue = 'leave';
|
|
24
24
|
node.formatdecimalsvalue = 2;
|
|
25
25
|
node.hueDevice = config.hueDevice;
|
|
26
|
+
node.initializingAtStart = !((config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no"));
|
|
26
27
|
|
|
27
28
|
// Used to call the status update from the config node.
|
|
28
29
|
node.setNodeStatus = ({ fill, shape, text, payload }) => {
|
|
@@ -45,7 +46,7 @@ module.exports = function (RED) {
|
|
|
45
46
|
if (_event.id === config.hueDevice) {
|
|
46
47
|
|
|
47
48
|
// IMPORTANT: exit if no event presen.
|
|
48
|
-
if (
|
|
49
|
+
if (!node.initializingAtStart) return;
|
|
49
50
|
if (!_event.hasOwnProperty('light') || _event.light.light_level === undefined) return;
|
|
50
51
|
|
|
51
52
|
const knxMsgPayload = {};
|
|
@@ -23,6 +23,7 @@ module.exports = function (RED) {
|
|
|
23
23
|
node.formatnegativevalue = "leave";
|
|
24
24
|
node.formatdecimalsvalue = 2;
|
|
25
25
|
node.hueDevice = config.hueDevice;
|
|
26
|
+
node.initializingAtStart = false;
|
|
26
27
|
|
|
27
28
|
// Used to call the status update from the config node.
|
|
28
29
|
node.setNodeStatus = ({ fill, shape, text, payload }) => { };
|
|
@@ -42,7 +43,7 @@ module.exports = function (RED) {
|
|
|
42
43
|
if (_event.id === config.hueDevice) {
|
|
43
44
|
|
|
44
45
|
// IMPORTANT: exit if no event presen.
|
|
45
|
-
if (
|
|
46
|
+
if (!node.initializingAtStart) return;
|
|
46
47
|
if (!_event.hasOwnProperty("motion") || _event.motion.motion === undefined) return;
|
|
47
48
|
|
|
48
49
|
|
|
@@ -25,6 +25,7 @@ module.exports = function (RED) {
|
|
|
25
25
|
node.formatnegativevalue = 'leave';
|
|
26
26
|
node.formatdecimalsvalue = 2;
|
|
27
27
|
node.hueDevice = config.hueDevice;
|
|
28
|
+
node.initializingAtStart = false;
|
|
28
29
|
|
|
29
30
|
// Used to call the status update from the config node.
|
|
30
31
|
node.setNodeStatus = ({ fill, shape, text, payload }) => {
|
|
@@ -78,13 +79,9 @@ module.exports = function (RED) {
|
|
|
78
79
|
node.handleSendHUE = (_event) => {
|
|
79
80
|
try {
|
|
80
81
|
if (_event.id === config.hueDevice) {
|
|
81
|
-
|
|
82
|
-
// IMPORTANT: exit if no event presen.
|
|
83
|
-
if (_event.initializingAtStart === true) return;
|
|
84
|
-
|
|
82
|
+
if (!node.initializingAtStart) return;
|
|
85
83
|
// Output the msg to the flow
|
|
86
84
|
node.send(_event);
|
|
87
|
-
|
|
88
85
|
}
|
|
89
86
|
} catch (error) {
|
|
90
87
|
node.status({ fill: 'red', shape: 'dot', text: 'HUE->KNX error ' + error.message + ' (' + new Date().getDate() + ', ' + new Date().toLocaleTimeString() + ')' });
|
|
@@ -26,6 +26,7 @@ module.exports = function (RED) {
|
|
|
26
26
|
node.brightnessState = 0;
|
|
27
27
|
node.isTimerDimStopRunning = false;
|
|
28
28
|
node.hueDevice = config.hueDevice;
|
|
29
|
+
node.initializingAtStart = false;
|
|
29
30
|
|
|
30
31
|
// Used to call the status update from the config node.
|
|
31
32
|
node.setNodeStatus = ({
|
|
@@ -51,7 +52,7 @@ module.exports = function (RED) {
|
|
|
51
52
|
if (_event.id === config.hueDevice) {
|
|
52
53
|
|
|
53
54
|
// IMPORTANT: exit if no event presen.
|
|
54
|
-
if (
|
|
55
|
+
if (!node.initializingAtStart) return;
|
|
55
56
|
if (!_event.hasOwnProperty("relative_rotary")
|
|
56
57
|
|| !_event.relative_rotary.hasOwnProperty("last_event")
|
|
57
58
|
|| _event.relative_rotary.last_event === undefined
|
package/nodes/utils/hueEngine.js
CHANGED
|
@@ -41,7 +41,13 @@ class classHUE extends EventEmitter {
|
|
|
41
41
|
} catch (error) {
|
|
42
42
|
/* empty */
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
this.es = new EventSource(`https://${this.hueBridgeIP}/eventstream/clip/v2`, options);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.log("hue-config: ew EventSource:" + error.message);
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
|
|
46
52
|
this.es.onmessage = (event) => {
|
|
47
53
|
try {
|
|
@@ -86,7 +92,9 @@ class classHUE extends EventEmitter {
|
|
|
86
92
|
} catch (error) {
|
|
87
93
|
/* empty */
|
|
88
94
|
}
|
|
89
|
-
|
|
95
|
+
try {
|
|
96
|
+
this.Connect();
|
|
97
|
+
} catch (error) { }
|
|
90
98
|
}, 300000);
|
|
91
99
|
};
|
|
92
100
|
|
|
@@ -176,12 +184,24 @@ class classHUE extends EventEmitter {
|
|
|
176
184
|
};
|
|
177
185
|
// ######################################
|
|
178
186
|
|
|
187
|
+
isConnected = async () => {
|
|
188
|
+
try {
|
|
189
|
+
await this.hueApiV2.get('/resource/bridge');
|
|
190
|
+
return true;
|
|
191
|
+
} catch (error) {
|
|
192
|
+
console.log("hueEngine: isConnected: " + error.message)
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
179
197
|
close = async () =>
|
|
180
198
|
new Promise((resolve, reject) => {
|
|
181
199
|
try {
|
|
182
200
|
if (this.timerReconnect !== undefined) clearInterval(this.timerReconnect);
|
|
183
201
|
this.closePushEventStream = true;
|
|
184
|
-
|
|
202
|
+
try {
|
|
203
|
+
if (this.es !== null && this.es !== undefined) this.es.close();
|
|
204
|
+
} catch (error) { }
|
|
185
205
|
this.es = null;
|
|
186
206
|
setTimeout(() => {
|
|
187
207
|
resolve(true);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"engines": {
|
|
4
4
|
"node": ">=16.0.0"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.2.
|
|
6
|
+
"version": "2.2.12",
|
|
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",
|