node-red-contrib-knx-ultimate 2.1.55 → 2.1.57
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 +6 -2
- package/KNXEngine/CHANGELOG.md +4 -0
- package/KNXEngine/package.json +1 -1
- package/KNXEngine/src/dptlib/dpt3.js +1 -0
- package/nodes/hue-config.js +0 -2
- package/nodes/knxUltimateHueLight.html +30 -16
- package/nodes/knxUltimateHueLight.js +85 -99
- package/nodes/knxUltimateHueScene.html +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
<br/>
|
|
6
6
|
|
|
7
7
|
# CHANGELOG
|
|
8
|
-
|
|
9
8
|
<p>
|
|
10
|
-
<b>Version 2.1.
|
|
9
|
+
<b>Version 2.1.57</b> - October 2023<br/>
|
|
10
|
+
- HUE Light: NEW Behaviour "KNX Brightness Status"<br/>
|
|
11
|
+
- HUE Light: the light now remembers the last brightness value after switch off<br/>
|
|
12
|
+
</p>
|
|
13
|
+
<p>
|
|
14
|
+
<b>Version 2.1.56</b> - October 2023<br/>
|
|
11
15
|
- HUE Scene: removed non existant scene 0.<br/>
|
|
12
16
|
</p>
|
|
13
17
|
<p>
|
package/KNXEngine/CHANGELOG.md
CHANGED
package/KNXEngine/package.json
CHANGED
|
@@ -44,6 +44,7 @@ exports.basetype = {
|
|
|
44
44
|
// The parameter "data" can be any integer value from 0 to 7
|
|
45
45
|
// The parameter decr_incr:1 increases the light
|
|
46
46
|
// The parameter decr_incr:0 decreases the light
|
|
47
|
+
// The parameter data:0 stops the dimming
|
|
47
48
|
msg.payload={decr_incr: 1, data: 5};
|
|
48
49
|
return msg;`,
|
|
49
50
|
helplink: 'https://github.com/Supergiovane/node-red-contrib-knx-ultimate/wiki/-Sample---Dimming'
|
package/nodes/hue-config.js
CHANGED
|
@@ -118,8 +118,6 @@ module.exports = (RED) => {
|
|
|
118
118
|
// Get all devices and join it with relative rooms, by adding the room name to the device name
|
|
119
119
|
node.getResources = (_rtype) => {
|
|
120
120
|
try {
|
|
121
|
-
// Api V2
|
|
122
|
-
|
|
123
121
|
// Returns capitalized string
|
|
124
122
|
function capStr(s) {
|
|
125
123
|
if (typeof s !== "string") return "";
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
GALightColorCycle: { value: "" },
|
|
57
57
|
dptLightColorCycle: { value: "" },
|
|
58
58
|
|
|
59
|
-
enableDayNightLighting: { value:
|
|
59
|
+
enableDayNightLighting: { value: "no" },
|
|
60
60
|
colorAtSwitchOnDayTime: { value: '{"red":255, "green":255, "blue":255}' },
|
|
61
61
|
colorAtSwitchOnNightTime: { value: '{"red":23, "green":4, "blue":0}' },
|
|
62
62
|
invertDayNight: { value: false },
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
GADaylightSensor: { value: "" },
|
|
66
66
|
dptDaylightSensor: { value: "" },
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
specifySwitchOnBrightness: { value: "yes" },
|
|
69
|
+
updateKNXBrightnessStatusOnHUEOnOff: { value: "onhueoff" },
|
|
69
70
|
|
|
70
71
|
hueDevice: { value: "" }
|
|
71
72
|
},
|
|
@@ -212,13 +213,13 @@
|
|
|
212
213
|
|
|
213
214
|
|
|
214
215
|
// Show/Hide and enable/disable day/night Lighting behaviour
|
|
215
|
-
if (this.enableDayNightLighting ===
|
|
216
|
+
if (this.enableDayNightLighting === "yes") {
|
|
216
217
|
$("#DivEnableDayNightLighting").show()
|
|
217
218
|
} else {
|
|
218
219
|
$("#DivEnableDayNightLighting").hide()
|
|
219
220
|
}
|
|
220
221
|
$("#node-input-enableDayNightLighting").on('change', function () {
|
|
221
|
-
if ($("#node-input-enableDayNightLighting").
|
|
222
|
+
if ($("#node-input-enableDayNightLighting").val() === 'yes') {
|
|
222
223
|
$("#DivEnableDayNightLighting").show()
|
|
223
224
|
} else {
|
|
224
225
|
$("#DivEnableDayNightLighting").hide()
|
|
@@ -226,16 +227,16 @@
|
|
|
226
227
|
})
|
|
227
228
|
|
|
228
229
|
// Show/Hide the div of the color at swich on
|
|
229
|
-
if (this.
|
|
230
|
+
if (this.specifySwitchOnBrightness === 'yes') {
|
|
230
231
|
$("#divcolorAtSwitchOnNightTime").show()
|
|
231
232
|
} else {
|
|
232
233
|
$("#divcolorAtSwitchOnNightTime").hide()
|
|
233
234
|
$("#node-input-colorAtSwitchOnDayTime").val('')
|
|
234
235
|
}
|
|
235
|
-
$("#node-input-
|
|
236
|
-
if ($("#node-input-
|
|
236
|
+
$("#node-input-specifySwitchOnBrightness").on('change', function () {
|
|
237
|
+
if ($("#node-input-specifySwitchOnBrightness").val() === 'yes') {
|
|
237
238
|
$("#divcolorAtSwitchOnNightTime").show()
|
|
238
|
-
if ($("#node-input-colorAtSwitchOnDayTime").val() === '') $("#node-input-colorAtSwitchOnDayTime").val('{ "red": 255, "green": 255, "blue": 255 }')
|
|
239
|
+
if ($("#node-input-colorAtSwitchOnDayTime").val() === '') $("#node-input-colorAtSwitchOnDayTime").val('{ "red": 255, "green": 255, "blue": 255 }')
|
|
239
240
|
} else {
|
|
240
241
|
$("#divcolorAtSwitchOnNightTime").hide()
|
|
241
242
|
$("#node-input-colorAtSwitchOnDayTime").val('')
|
|
@@ -534,10 +535,19 @@
|
|
|
534
535
|
<div id="tabs-6">
|
|
535
536
|
<p>
|
|
536
537
|
<div class="form-row">
|
|
537
|
-
<label for="node-input-
|
|
538
|
+
<label for="node-input-updateKNXBrightnessStatusOnHUEOnOff" style="width:260px;">
|
|
539
|
+
<i class="fa fa-tag"></i> KNX Brightness Status
|
|
540
|
+
</label>
|
|
541
|
+
<select id="node-input-updateKNXBrightnessStatusOnHUEOnOff">
|
|
542
|
+
<option value="onhueoff">When HUE light is Off, send 0% (Default KNX behaviour)</option>
|
|
543
|
+
<option value="no">Leave as is (default HUE behaviour)</option>
|
|
544
|
+
</select>
|
|
545
|
+
</div>
|
|
546
|
+
<div class="form-row">
|
|
547
|
+
<label for="node-input-specifySwitchOnBrightness" style="width:260px;">
|
|
538
548
|
<i class="fa fa-tag"></i> Specify switch on brightness
|
|
539
549
|
</label>
|
|
540
|
-
<select id="node-input-
|
|
550
|
+
<select id="node-input-specifySwitchOnBrightness">
|
|
541
551
|
<option value="yes">Yes</option>
|
|
542
552
|
<option value="no">No</option>
|
|
543
553
|
</select>
|
|
@@ -551,16 +561,18 @@
|
|
|
551
561
|
placeholder='Leave blank or, for example, {"red":255, "green":255, "blue":255}' style="width:260px">
|
|
552
562
|
</div>
|
|
553
563
|
<div class="form-row">
|
|
554
|
-
<label
|
|
564
|
+
<label for="node-input-enableDayNightLighting" style="width:260px;">
|
|
555
565
|
<i class="fa fa-clone"></i> Night Lighting
|
|
556
566
|
</label>
|
|
557
|
-
<
|
|
558
|
-
|
|
567
|
+
<select id="node-input-enableDayNightLighting">
|
|
568
|
+
<option value="yes">Yes</option>
|
|
569
|
+
<option value="no">No</option>
|
|
570
|
+
</select>
|
|
559
571
|
</div>
|
|
560
572
|
<div id="DivEnableDayNightLighting">
|
|
561
573
|
<div class="form-row">
|
|
562
574
|
<label for="node-input-colorAtSwitchOnNightTime" style="width:260px">
|
|
563
|
-
<i class="fa fa-moon-o"></i> Switch On
|
|
575
|
+
<i class="fa fa-moon-o"></i> Switch On color/brigh. at Night
|
|
564
576
|
</label>
|
|
565
577
|
<input type="text" id="node-input-colorAtSwitchOnNightTime"
|
|
566
578
|
placeholder='Example {"red":100, "green":0, "blue":50}' style="width:260px">
|
|
@@ -593,7 +605,8 @@
|
|
|
593
605
|
</div>
|
|
594
606
|
</div>
|
|
595
607
|
</p>
|
|
596
|
-
</div>
|
|
608
|
+
</div>
|
|
609
|
+
|
|
597
610
|
<br/>
|
|
598
611
|
</script>
|
|
599
612
|
|
|
@@ -657,9 +670,10 @@ Start typing in the GA field, the name or group address of your KNX device, the
|
|
|
657
670
|
<br/>
|
|
658
671
|
|
|
659
672
|
**Behaviour**
|
|
660
|
-
|
|
673
|
+
|
|
661
674
|
|Property|Description|
|
|
662
675
|
|--|--|
|
|
676
|
+
| KNX Brightness Status | Updates the KNX brightness group address whenever the HUE lamp is switched ON/OFF. The options are `When HUE light is Off, send 0% (Default KNX behaviour)` and `Leave as is (default HUE behaviour)` |
|
|
663
677
|
| Specify switch on brightness | It enables the brightness value to follow the on/off status of the light. If you change the HUE brightness value to 0% (from the HUE App), an "off" telegram is also sent to the KNX bus; if you set it other than 0%, an "on" telegram is also sent to the KNX bus. This is valid also vice-versa: if you change the brightness via KNX bus, the HUE on/off value is also sent to the lamp. If you set it to **No**, the previous HUE light brightness value is retained. Default value is **Yes**. |
|
|
664
678
|
| Switch On - color/brightness | You can choose the color/brightness of your light, at switch on. Set it as JSON object, for example **{ "red": 255, "green": 255, "blue": 255 }** |
|
|
665
679
|
| Night Lighting | It allows to set a particular light color/brightness at nighttime. If **checked**, a further set of option shows up and the light changes the behaviour based on these options, everytime you switch the light *on*. |
|
|
@@ -44,82 +44,64 @@ module.exports = function (RED) {
|
|
|
44
44
|
node.status({ fill, shape, text: `${text} ${payload} (${dDate.getDate()}, ${dDate.toLocaleTimeString()})` });
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
node.setNodeStatusHue({
|
|
48
|
+
fill: "grey",
|
|
49
|
+
shape: "ring",
|
|
50
|
+
text: "Connecting to the Bridge...",
|
|
51
|
+
payload: ""
|
|
52
|
+
});
|
|
53
|
+
|
|
47
54
|
// This function is called by the hue-config.js
|
|
48
55
|
node.handleSend = (msg) => {
|
|
56
|
+
if (node.currentHUEDevice === undefined) {
|
|
57
|
+
node.setNodeStatusHue({
|
|
58
|
+
fill: "red",
|
|
59
|
+
shape: "ring",
|
|
60
|
+
text: "Rejected KNX message. I'm connecting to the Bridge...",
|
|
61
|
+
payload: ""
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
49
65
|
let state = {};
|
|
50
66
|
try {
|
|
51
67
|
switch (msg.knx.destination) {
|
|
52
68
|
case config.GALightSwitch:
|
|
53
69
|
msg.payload = dptlib.fromBuffer(msg.knx.rawValue, dptlib.resolve(config.dptLightSwitch));
|
|
54
70
|
if (msg.payload === true) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
node.currentHUEDevice !== undefined
|
|
64
|
-
&& node.currentHUEDevice.hasOwnProperty("color")
|
|
65
|
-
&& node.currentHUEDevice.color.hasOwnProperty("gamut_type")
|
|
66
|
-
) {
|
|
67
|
-
gamut = node.currentHUEDevice.color.gamut_type;
|
|
68
|
-
}
|
|
69
|
-
const dretXY = hueColorConverter.ColorConverter.rgbToXy(jColorChoosen.red, jColorChoosen.green, jColorChoosen.blue, gamut);
|
|
70
|
-
const dbright = hueColorConverter.ColorConverter.getBrightnessFromRGB(jColorChoosen.red, jColorChoosen.green, jColorChoosen.blue);
|
|
71
|
-
node.currentHUEDevice.dimming.brightness = dbright;
|
|
72
|
-
node.updateKNXBrightnessState(node.currentHUEDevice.dimming.brightness);
|
|
73
|
-
if (config.linkBrightnessToSwitchStatus === undefined || config.linkBrightnessToSwitchStatus === "yes") {
|
|
74
|
-
state = dbright > 0 ? { on: { on: true }, dimming: { brightness: dbright }, color: { xy: dretXY } } : { on: { on: false } };
|
|
75
|
-
} else {
|
|
76
|
-
state = dbright > 0 ? { on: { on: true }, color: { xy: dretXY } } : { on: { on: false } };
|
|
77
|
-
}
|
|
78
|
-
} else if (config.linkBrightnessToSwitchStatus === undefined || config.linkBrightnessToSwitchStatus === "yes") {
|
|
79
|
-
try {
|
|
80
|
-
node.currentHUEDevice.dimming.brightness = 100;
|
|
81
|
-
node.updateKNXBrightnessState(node.currentHUEDevice.dimming.brightness);
|
|
82
|
-
} catch (error) { /* empty */ }
|
|
83
|
-
state = { on: { on: true }, dimming: { brightness: node.currentHUEDevice.dimming.brightness } };
|
|
84
|
-
} else {
|
|
85
|
-
try {
|
|
86
|
-
state = { on: { on: true }, dimming: { brightness: node.currentHUEDevice.dimming.brightness } };
|
|
87
|
-
} catch (error) {
|
|
88
|
-
state = { on: { on: true } };
|
|
89
|
-
}
|
|
71
|
+
// The user selected specific color/brightness at switch on.
|
|
72
|
+
let jColorChoosen = null;
|
|
73
|
+
if (node.DayTime === true && (config.specifySwitchOnBrightness === undefined || config.specifySwitchOnBrightness === "yes")) {
|
|
74
|
+
try {
|
|
75
|
+
jColorChoosen = JSON.parse(config.colorAtSwitchOnDayTime);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
jColorChoosen = { red: 255, green: 255, blue: 255 };
|
|
90
78
|
}
|
|
91
|
-
} else {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
jColorChoosen =
|
|
96
|
-
let gamut = null;
|
|
97
|
-
if (
|
|
98
|
-
node.currentHUEDevice !== undefined
|
|
99
|
-
&& node.currentHUEDevice.hasOwnProperty("color")
|
|
100
|
-
&& node.currentHUEDevice.color.hasOwnProperty("gamut_type")
|
|
101
|
-
) {
|
|
102
|
-
gamut = node.currentHUEDevice.color.gamut_type;
|
|
103
|
-
}
|
|
104
|
-
const dretXY = hueColorConverter.ColorConverter.rgbToXy(jColorChoosen.red, jColorChoosen.green, jColorChoosen.blue, gamut);
|
|
105
|
-
const dbright = hueColorConverter.ColorConverter.getBrightnessFromRGB(jColorChoosen.red, jColorChoosen.green, jColorChoosen.blue);
|
|
106
|
-
if (config.linkBrightnessToSwitchStatus === undefined || config.linkBrightnessToSwitchStatus === "yes") {
|
|
107
|
-
node.currentHUEDevice.dimming.brightness = dbright;
|
|
108
|
-
node.updateKNXBrightnessState(node.currentHUEDevice.dimming.brightness);
|
|
109
|
-
state = dbright > 0 ? { on: { on: true }, dimming: { brightness: dbright }, color: { xy: dretXY } } : { on: { on: false } };
|
|
110
|
-
} else {
|
|
111
|
-
state = dbright > 0 ? { on: { on: true }, color: { xy: dretXY } } : { on: { on: false } };
|
|
112
|
-
}
|
|
79
|
+
} else if (node.DayTime === false && config.enableDayNightLighting === "yes") {
|
|
80
|
+
try {
|
|
81
|
+
jColorChoosen = JSON.parse(config.colorAtSwitchOnNightTime);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
jColorChoosen = { red: 10, green: 10, blue: 10 };
|
|
113
84
|
}
|
|
114
85
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
86
|
+
if (jColorChoosen !== null) {
|
|
87
|
+
let gamut = null;
|
|
88
|
+
if (
|
|
89
|
+
node.currentHUEDevice !== undefined
|
|
90
|
+
&& node.currentHUEDevice.hasOwnProperty("color")
|
|
91
|
+
&& node.currentHUEDevice.color.hasOwnProperty("gamut_type")
|
|
92
|
+
) {
|
|
93
|
+
gamut = node.currentHUEDevice.color.gamut_type;
|
|
94
|
+
}
|
|
95
|
+
const dretXY = hueColorConverter.ColorConverter.rgbToXy(jColorChoosen.red, jColorChoosen.green, jColorChoosen.blue, gamut);
|
|
96
|
+
const dbright = hueColorConverter.ColorConverter.getBrightnessFromRGB(jColorChoosen.red, jColorChoosen.green, jColorChoosen.blue);
|
|
97
|
+
node.currentHUEDevice.dimming.brightness = dbright;
|
|
118
98
|
node.updateKNXBrightnessState(node.currentHUEDevice.dimming.brightness);
|
|
119
|
-
state = { on: { on:
|
|
120
|
-
}
|
|
99
|
+
state = dbright > 0 ? { on: { on: true }, dimming: { brightness: dbright }, color: { xy: dretXY } } : { on: { on: false } };
|
|
100
|
+
} else {
|
|
101
|
+
state = { on: { on: true }, dimming: node.currentHUEDevice.dimming };
|
|
102
|
+
}
|
|
121
103
|
} else {
|
|
122
|
-
state = { on: { on: false }
|
|
104
|
+
state = { on: { on: false } };
|
|
123
105
|
}
|
|
124
106
|
node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, state, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
|
|
125
107
|
node.setNodeStatusHue({
|
|
@@ -136,23 +118,20 @@ module.exports = function (RED) {
|
|
|
136
118
|
if (msg.payload.data > 0) {
|
|
137
119
|
const dimDirection = msg.payload.decr_incr === 1 ? "up" : "down";
|
|
138
120
|
// First, switch on the light if off
|
|
139
|
-
if (node.currentHUEDevice !== undefined && node.currentHUEDevice.on.on === false && dimDirection === "up") {
|
|
140
|
-
if (config.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} else {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
node.isGrouped_light === false ? "setLight" : "setGroupedLight"
|
|
154
|
-
);
|
|
155
|
-
}
|
|
121
|
+
if (node.currentHUEDevice.hasOwnProperty('on') !== undefined && node.currentHUEDevice.on.on === false && dimDirection === "up") {
|
|
122
|
+
// if (config.specifySwitchOnBrightness === undefined || config.specifySwitchOnBrightness === "yes") {
|
|
123
|
+
// // Starts from minimum of 5
|
|
124
|
+
// node.serverHue.hueManager.writeHueQueueAdd(
|
|
125
|
+
// config.hueDevice,
|
|
126
|
+
// { on: { on: true }, dimming: { brightness: 5 } },
|
|
127
|
+
// node.isGrouped_light === false ? "setLight" : "setGroupedLight"
|
|
128
|
+
// );
|
|
129
|
+
// } else {
|
|
130
|
+
// Read the last HUE brightness status and starts from there
|
|
131
|
+
//const lastDimVal = node.currentHUEDevice !== undefined ? node.currentHUEDevice.dimming.brightness : 5;
|
|
132
|
+
//node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: true }, dimming: { brightness: lastDimVal } }, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
|
|
133
|
+
// }
|
|
134
|
+
node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: true } }, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
|
|
156
135
|
}
|
|
157
136
|
node.startDimStopper(dimDirection);
|
|
158
137
|
} else {
|
|
@@ -166,7 +145,7 @@ module.exports = function (RED) {
|
|
|
166
145
|
});
|
|
167
146
|
break;
|
|
168
147
|
case config.GADaylightSensor:
|
|
169
|
-
if (config.enableDayNightLighting ===
|
|
148
|
+
if (config.enableDayNightLighting === "yes") {
|
|
170
149
|
node.DayTime = Boolean(dptlib.fromBuffer(msg.knx.rawValue, dptlib.resolve(config.dptDaylightSensor)));
|
|
171
150
|
if (config.invertDayNight !== undefined && config.invertDayNight === true) node.DayTime = !node.DayTime;
|
|
172
151
|
node.setNodeStatusHue({
|
|
@@ -281,7 +260,7 @@ module.exports = function (RED) {
|
|
|
281
260
|
// state = msg.payload === true ? { on: { on: true } } : { on: { on: false } }
|
|
282
261
|
state = msg.payload === true
|
|
283
262
|
? { on: { on: true }, dimming: { brightness: 100 }, dynamics: { duration: 0 } }
|
|
284
|
-
: { on: { on: false }, dynamics: { duration: 0 } };
|
|
263
|
+
: { on: { on: false }, dimming: { brightness: 0 }, dynamics: { duration: 0 } };
|
|
285
264
|
node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, state, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
|
|
286
265
|
}, 1000);
|
|
287
266
|
} else {
|
|
@@ -429,19 +408,26 @@ module.exports = function (RED) {
|
|
|
429
408
|
node.handleSendHUE = (_event) => {
|
|
430
409
|
try {
|
|
431
410
|
if (_event.id === config.hueDevice) {
|
|
411
|
+
if (node.currentHUEDevice === undefined) {
|
|
412
|
+
node.setNodeStatusHue({
|
|
413
|
+
fill: "red",
|
|
414
|
+
shape: "ring",
|
|
415
|
+
text: "Rejected HUE message. I'm connecting to the Bridge...",
|
|
416
|
+
payload: ""
|
|
417
|
+
});
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
432
420
|
if (_event.hasOwnProperty("on")) {
|
|
433
421
|
node.updateKNXLightState(_event.on.on);
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
/* empty */
|
|
444
|
-
}
|
|
422
|
+
// In case of switch off, set the dim to zero
|
|
423
|
+
if (_event.on.on === false && (config.updateKNXBrightnessStatusOnHUEOnOff === undefined || config.updateKNXBrightnessStatusOnHUEOnOff === 'onhueoff')) {
|
|
424
|
+
node.updateKNXBrightnessState(0);
|
|
425
|
+
} else {
|
|
426
|
+
// Sends the previous brightness value
|
|
427
|
+
try {
|
|
428
|
+
node.updateKNXBrightnessState(node.currentHUEDevice.dimming.brightness);
|
|
429
|
+
} catch (error) {
|
|
430
|
+
/* empty */
|
|
445
431
|
}
|
|
446
432
|
}
|
|
447
433
|
if (node.currentHUEDevice !== undefined) node.currentHUEDevice.on = _event.on; // Update the internal object representing the current light
|
|
@@ -453,15 +439,15 @@ module.exports = function (RED) {
|
|
|
453
439
|
return;
|
|
454
440
|
}
|
|
455
441
|
if (_event.hasOwnProperty("dimming")) {
|
|
456
|
-
// Every once time, the light transmit the brightness value of 0.39.
|
|
442
|
+
// Every once on a time, the light transmit the brightness value of 0.39.
|
|
457
443
|
// To avoid wrongly turn light state on, exit
|
|
458
|
-
if (_event.dimming.brightness === undefined) return;
|
|
459
444
|
if (_event.dimming.brightness < 1) _event.dimming.brightness = 0;
|
|
445
|
+
if (node.currentHUEDevice.hasOwnProperty('on') && node.currentHUEDevice.on.on === false && _event.dimming.brightness === 0) return;
|
|
446
|
+
// if (config.specifySwitchOnBrightness === undefined || config.specifySwitchOnBrightness === "yes") {
|
|
447
|
+
if (node.currentHUEDevice.on.on === false) node.updateKNXLightState(_event.dimming.brightness > 0);
|
|
448
|
+
// }
|
|
460
449
|
node.updateKNXBrightnessState(_event.dimming.brightness);
|
|
461
450
|
if (node.currentHUEDevice !== undefined) node.currentHUEDevice.dimming = _event.dimming; // Update the internal object representing the current light
|
|
462
|
-
if (config.linkBrightnessToSwitchStatus === undefined || config.linkBrightnessToSwitchStatus === "yes") {
|
|
463
|
-
node.updateKNXLightState(_event.dimming.brightness > 0);
|
|
464
|
-
}
|
|
465
451
|
// If the brightness reaches zero, the hue lamp "on" property must be set to zero as well
|
|
466
452
|
if (_event.dimming.brightness === 0) {
|
|
467
453
|
node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: false } }, node.isGrouped_light === false ? "setLight" : "setGroupedLight");
|
|
@@ -478,7 +464,7 @@ module.exports = function (RED) {
|
|
|
478
464
|
node.status({
|
|
479
465
|
fill: "red",
|
|
480
466
|
shape: "dot",
|
|
481
|
-
text:
|
|
467
|
+
text: 'HUE->KNX error ' + node.id + ' ' + error.message
|
|
482
468
|
});
|
|
483
469
|
}
|
|
484
470
|
};
|
|
@@ -185,8 +185,8 @@
|
|
|
185
185
|
 <i class="fa fa-youtube"></i></span> <a target="_blank" href="https://youtu.be/jjEUI1J8bkA"><u>Youtube sample</u></a>
|
|
186
186
|
<br />
|
|
187
187
|
<br />
|
|
188
|
-
<p align="center">
|
|
189
|
-
|
|
188
|
+
<p align="center">
|
|
189
|
+
<i class="fa fa-tv fa-fade fa-8x"></i>
|
|
190
190
|
</p>
|
|
191
191
|
<br />
|
|
192
192
|
<label for="node-input-server" >
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"engines": {
|
|
4
4
|
"node": ">=16.0.0"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.1.
|
|
6
|
+
"version": "2.1.57",
|
|
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 handling.",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"binary-parser": "2.2.1",
|