node-red-contrib-knx-ultimate 2.2.40 → 2.3.1
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 -0
- package/nodes/hue-config.js +4 -3
- package/nodes/knxUltimate-config.html +5 -2
- package/nodes/knxUltimateHueLight.html +132 -129
- package/nodes/knxUltimateHueLight.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
# CHANGELOG
|
|
8
8
|
|
|
9
|
+
**Version 2.3.1** - Jan 2024<br/>
|
|
10
|
+
- HUE Light: minor fixes.
|
|
11
|
+
|
|
12
|
+
**Version 2.3.0** - Jan 2024<br/>
|
|
13
|
+
- HUE Light: partially rewrote code to cloneDeep(oHUEDevice) not to duplicate the brightness status of a single ligh, at node-red restart. https://github.com/Supergiovane/node-red-contrib-knx-ultimate/issues/312#issue-2064480332 <br/>
|
|
14
|
+
|
|
9
15
|
**Version 2.2.40** - Jan 2024<br/>
|
|
10
16
|
- HUE Light: fixed an issue with initial status read from HUE Bridge (on/off status was incorrectly set).<br/>
|
|
11
17
|
|
package/nodes/hue-config.js
CHANGED
|
@@ -7,6 +7,7 @@ const dptlib = require("../KNXEngine/src/dptlib");
|
|
|
7
7
|
const HueClass = require("./utils/hueEngine").classHUE;
|
|
8
8
|
const loggerEngine = require("./utils/sysLogger");
|
|
9
9
|
const hueColorConverter = require("./utils/hueColorConverter");
|
|
10
|
+
const cloneDeep = require("lodash/cloneDeep");
|
|
10
11
|
|
|
11
12
|
function getRandomIntInclusive(min, max) {
|
|
12
13
|
min = Math.ceil(min);
|
|
@@ -206,7 +207,7 @@ module.exports = (RED) => {
|
|
|
206
207
|
shape: "ring",
|
|
207
208
|
text: "Ready :-)",
|
|
208
209
|
});
|
|
209
|
-
_node.currentHUEDevice = oHUEDevice;
|
|
210
|
+
_node.currentHUEDevice = cloneDeep(oHUEDevice);
|
|
210
211
|
if (_node.initializingAtStart === true) _node.handleSendHUE(oHUEDevice);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
@@ -417,7 +418,7 @@ module.exports = (RED) => {
|
|
|
417
418
|
if (node.hueAllResources !== undefined && node.hueAllResources !== null && _Node.initializingAtStart === true) {
|
|
418
419
|
const oHUEDevice = node.hueAllResources.filter((a) => a.id === _Node.hueDevice)[0];
|
|
419
420
|
if (oHUEDevice !== undefined) {
|
|
420
|
-
_Node.currentHUEDevice = oHUEDevice;
|
|
421
|
+
_Node.currentHUEDevice = cloneDeep(oHUEDevice);
|
|
421
422
|
_Node.handleSendHUE(oHUEDevice);
|
|
422
423
|
// Add _Node to the clients array
|
|
423
424
|
_Node.setNodeStatusHue({
|
|
@@ -507,7 +508,7 @@ module.exports = (RED) => {
|
|
|
507
508
|
try {
|
|
508
509
|
const _lightId = req.query.id;
|
|
509
510
|
const oLight = node.hueAllResources.filter((a) => a.id === _lightId)[0];
|
|
510
|
-
// Infer some useful info, so the HTML part
|
|
511
|
+
// Infer some useful info, so the HTML part can avoid to query the server
|
|
511
512
|
// Kelvin
|
|
512
513
|
try {
|
|
513
514
|
if (oLight.color_temperature !== undefined && oLight.color_temperature.mirek !== undefined) {
|
|
@@ -183,11 +183,14 @@
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
.ui-tabs .ui-tabs-nav .ui-state-default a {
|
|
186
|
-
color: #
|
|
186
|
+
color: #878787;
|
|
187
|
+
outline: none;
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
.ui-tabs .ui-tabs-nav .ui-state-active a {
|
|
190
|
-
color: #
|
|
191
|
+
color: #377e00;
|
|
192
|
+
border-bottom: 1px solid#377e00;
|
|
193
|
+
outline: none;
|
|
191
194
|
}
|
|
192
195
|
</style>
|
|
193
196
|
|
|
@@ -172,137 +172,140 @@
|
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
// Get the HUE capabilities to enable/disable UI parts
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
$("
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
$("#node-input-specifySwitchOnBrightness").empty().append(
|
|
218
|
-
$("<option>")
|
|
219
|
-
.val("no")
|
|
220
|
-
.text("None")
|
|
221
|
-
);
|
|
222
|
-
$("#node-input-enableDayNightLighting").empty().append(
|
|
223
|
-
$("<option>")
|
|
224
|
-
.val("no")
|
|
225
|
-
.text("No")
|
|
226
|
-
);
|
|
227
|
-
}
|
|
175
|
+
if ($("#node-input-hueDevice").val() === '') {
|
|
176
|
+
$("#tabs").hide();
|
|
177
|
+
} else {
|
|
178
|
+
$.getJSON("knxUltimateGetLightObject?id=" + $("#node-input-hueDevice").val().split("#")[0] + " &" + { _: new Date().getTime() }, (data) => {
|
|
179
|
+
let oLight = data;
|
|
180
|
+
// Check if grouped, to hide/show the "Get current" buttons
|
|
181
|
+
if (oLight.type === "grouped_light") {
|
|
182
|
+
$("#tabs").tabs("enable", "#tabs-4");
|
|
183
|
+
$("#tabs").tabs("enable", "#tabs-3");
|
|
184
|
+
$("#tabs").tabs("enable", "#tabs-2");
|
|
185
|
+
$("#getColorAtSwitchOnDayTimeButton").show();
|
|
186
|
+
$("#getColorAtSwitchOnNightTimeButton").show();
|
|
187
|
+
$("#node-input-specifySwitchOnBrightness").empty().append(
|
|
188
|
+
$("<option>")
|
|
189
|
+
.val("no")
|
|
190
|
+
.text("None")
|
|
191
|
+
).append(
|
|
192
|
+
$("<option>")
|
|
193
|
+
.val("yes")
|
|
194
|
+
.text("Select color")
|
|
195
|
+
).append(
|
|
196
|
+
$("<option>")
|
|
197
|
+
.val("temperature")
|
|
198
|
+
.text("Select temperature and brightness")
|
|
199
|
+
);
|
|
200
|
+
$("#node-input-enableDayNightLighting").empty().append(
|
|
201
|
+
$("<option>")
|
|
202
|
+
.val("no")
|
|
203
|
+
.text("No")
|
|
204
|
+
).append(
|
|
205
|
+
$("<option>")
|
|
206
|
+
.val("yes")
|
|
207
|
+
.text("Select color")
|
|
208
|
+
).append(
|
|
209
|
+
$("<option>")
|
|
210
|
+
.val("temperature")
|
|
211
|
+
.text("Select temperature and brightness")
|
|
212
|
+
);
|
|
213
|
+
$("#node-input-specifySwitchOnBrightness").val(node.specifySwitchOnBrightness).trigger('change');
|
|
214
|
+
$("#node-input-enableDayNightLighting").val(node.enableDayNightLighting).trigger('change');
|
|
215
|
+
return;
|
|
216
|
+
} else {
|
|
228
217
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
// Enable options/tabs one by one
|
|
243
|
-
if (oLight.dimming !== undefined) {
|
|
244
|
-
$("#tabs").tabs("enable", "#tabs-2");
|
|
245
|
-
$("#divBehaviourBrightness").show();
|
|
246
|
-
}
|
|
247
|
-
if (oLight.color !== undefined) {
|
|
248
|
-
$("#tabs").tabs("enable", "#tabs-4");
|
|
249
|
-
$("#divColorsAtSwitchOn").show();
|
|
250
|
-
$("#divColorsAtSwitchOnNightTime").show();
|
|
251
|
-
$("#divColorCycle").show();
|
|
252
|
-
$("#node-input-specifySwitchOnBrightness").append(
|
|
253
|
-
$("<option>")
|
|
254
|
-
.val("yes")
|
|
255
|
-
.text("Select color")
|
|
256
|
-
);
|
|
257
|
-
$("#node-input-enableDayNightLighting").append(
|
|
258
|
-
$("<option>")
|
|
259
|
-
.val("yes")
|
|
260
|
-
.text("Select color")
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
// Check temperature (if the light supports temperature, it support dimming as well)
|
|
264
|
-
if (oLight.color_temperature !== undefined) {
|
|
265
|
-
$("#tabs").tabs("enable", "#tabs-3");
|
|
266
|
-
//$("#tabs").tabs("enable", "#tabs-2");
|
|
267
|
-
$("#node-input-specifySwitchOnBrightness").append(
|
|
268
|
-
$("<option>")
|
|
269
|
-
.val("temperature")
|
|
270
|
-
.text("Select temperature and brightness")
|
|
271
|
-
);
|
|
272
|
-
$("#node-input-enableDayNightLighting").append(
|
|
273
|
-
$("<option>")
|
|
274
|
-
.val("temperature")
|
|
275
|
-
.text("Select temperature and brightness")
|
|
276
|
-
);
|
|
277
|
-
$("#divTemperatureAtSwitchOn").show();
|
|
278
|
-
$("#divTemperatureAtSwitchOnNightTime").show();
|
|
279
|
-
$("#divUpdateKNXBrightnessStatusOnHUEOnOff").show();
|
|
280
|
-
$("#divBehaviourBrightness").show();
|
|
281
|
-
$("#comboTemperatureAtSwitchOn").show();
|
|
282
|
-
$("#comboTemperatureAtSwitchOnNightTime").show();
|
|
283
|
-
} else {
|
|
284
|
-
//$("#tabs").tabs("enable", "#tabs-2");
|
|
285
|
-
$("#node-input-specifySwitchOnBrightness").append(
|
|
286
|
-
$("<option>")
|
|
287
|
-
.val("temperature")
|
|
288
|
-
.text("Select brightness")
|
|
289
|
-
);
|
|
290
|
-
$("#node-input-enableDayNightLighting").append(
|
|
291
|
-
$("<option>")
|
|
292
|
-
.val("temperature")
|
|
293
|
-
.text("Select brightness")
|
|
294
|
-
);
|
|
295
|
-
$("#comboTemperatureAtSwitchOn").val(0);
|
|
296
|
-
$("#comboTemperatureAtSwitchOnNightTime").val(0);
|
|
297
|
-
$("#divTemperatureAtSwitchOn").show();
|
|
298
|
-
$("#divTemperatureAtSwitchOnNightTime").show();
|
|
299
|
-
$("#divUpdateKNXBrightnessStatusOnHUEOnOff").show();
|
|
300
|
-
//$("#divBehaviourBrightness").show();
|
|
301
|
-
}
|
|
302
|
-
$("#node-input-specifySwitchOnBrightness").val(node.specifySwitchOnBrightness).trigger('change');
|
|
303
|
-
$("#node-input-enableDayNightLighting").val(node.enableDayNightLighting).trigger('change');
|
|
304
|
-
});
|
|
218
|
+
$("#getColorAtSwitchOnDayTimeButton").show();
|
|
219
|
+
$("#getColorAtSwitchOnNightTimeButton").show();
|
|
220
|
+
$("#node-input-specifySwitchOnBrightness").empty().append(
|
|
221
|
+
$("<option>")
|
|
222
|
+
.val("no")
|
|
223
|
+
.text("None")
|
|
224
|
+
);
|
|
225
|
+
$("#node-input-enableDayNightLighting").empty().append(
|
|
226
|
+
$("<option>")
|
|
227
|
+
.val("no")
|
|
228
|
+
.text("No")
|
|
229
|
+
);
|
|
230
|
+
}
|
|
305
231
|
|
|
232
|
+
$("#tabs").tabs("disable", "#tabs-4");
|
|
233
|
+
$("#tabs").tabs("disable", "#tabs-3");
|
|
234
|
+
$("#tabs").tabs("disable", "#tabs-2");
|
|
235
|
+
$("#divColorsAtSwitchOn").hide();
|
|
236
|
+
$("#divColorsAtSwitchOnNightTime").hide();
|
|
237
|
+
$("#divTemperatureAtSwitchOn").hide();
|
|
238
|
+
$("#divTemperatureAtSwitchOnNightTime").hide();
|
|
239
|
+
$("#divColorCycle").hide();
|
|
240
|
+
$("#divUpdateKNXBrightnessStatusOnHUEOnOff").hide();
|
|
241
|
+
$("#divBehaviourBrightness").hide();
|
|
242
|
+
$("#comboTemperatureAtSwitchOn").hide();
|
|
243
|
+
$("#comboTemperatureAtSwitchOnNightTime").hide();
|
|
244
|
+
|
|
245
|
+
// Enable options/tabs one by one
|
|
246
|
+
if (oLight.dimming !== undefined) {
|
|
247
|
+
$("#tabs").tabs("enable", "#tabs-2");
|
|
248
|
+
$("#divBehaviourBrightness").show();
|
|
249
|
+
}
|
|
250
|
+
if (oLight.color !== undefined) {
|
|
251
|
+
$("#tabs").tabs("enable", "#tabs-4");
|
|
252
|
+
$("#divColorsAtSwitchOn").show();
|
|
253
|
+
$("#divColorsAtSwitchOnNightTime").show();
|
|
254
|
+
$("#divColorCycle").show();
|
|
255
|
+
$("#node-input-specifySwitchOnBrightness").append(
|
|
256
|
+
$("<option>")
|
|
257
|
+
.val("yes")
|
|
258
|
+
.text("Select color")
|
|
259
|
+
);
|
|
260
|
+
$("#node-input-enableDayNightLighting").append(
|
|
261
|
+
$("<option>")
|
|
262
|
+
.val("yes")
|
|
263
|
+
.text("Select color")
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
// Check temperature (if the light supports temperature, it support dimming as well)
|
|
267
|
+
if (oLight.color_temperature !== undefined) {
|
|
268
|
+
$("#tabs").tabs("enable", "#tabs-3");
|
|
269
|
+
//$("#tabs").tabs("enable", "#tabs-2");
|
|
270
|
+
$("#node-input-specifySwitchOnBrightness").append(
|
|
271
|
+
$("<option>")
|
|
272
|
+
.val("temperature")
|
|
273
|
+
.text("Select temperature and brightness")
|
|
274
|
+
);
|
|
275
|
+
$("#node-input-enableDayNightLighting").append(
|
|
276
|
+
$("<option>")
|
|
277
|
+
.val("temperature")
|
|
278
|
+
.text("Select temperature and brightness")
|
|
279
|
+
);
|
|
280
|
+
$("#divTemperatureAtSwitchOn").show();
|
|
281
|
+
$("#divTemperatureAtSwitchOnNightTime").show();
|
|
282
|
+
$("#divUpdateKNXBrightnessStatusOnHUEOnOff").show();
|
|
283
|
+
$("#divBehaviourBrightness").show();
|
|
284
|
+
$("#comboTemperatureAtSwitchOn").show();
|
|
285
|
+
$("#comboTemperatureAtSwitchOnNightTime").show();
|
|
286
|
+
} else {
|
|
287
|
+
//$("#tabs").tabs("enable", "#tabs-2");
|
|
288
|
+
$("#node-input-specifySwitchOnBrightness").append(
|
|
289
|
+
$("<option>")
|
|
290
|
+
.val("temperature")
|
|
291
|
+
.text("Select brightness")
|
|
292
|
+
);
|
|
293
|
+
$("#node-input-enableDayNightLighting").append(
|
|
294
|
+
$("<option>")
|
|
295
|
+
.val("temperature")
|
|
296
|
+
.text("Select brightness")
|
|
297
|
+
);
|
|
298
|
+
$("#comboTemperatureAtSwitchOn").val(0);
|
|
299
|
+
$("#comboTemperatureAtSwitchOnNightTime").val(0);
|
|
300
|
+
$("#divTemperatureAtSwitchOn").show();
|
|
301
|
+
$("#divTemperatureAtSwitchOnNightTime").show();
|
|
302
|
+
$("#divUpdateKNXBrightnessStatusOnHUEOnOff").show();
|
|
303
|
+
//$("#divBehaviourBrightness").show();
|
|
304
|
+
}
|
|
305
|
+
$("#node-input-specifySwitchOnBrightness").val(node.specifySwitchOnBrightness).trigger('change');
|
|
306
|
+
$("#node-input-enableDayNightLighting").val(node.enableDayNightLighting).trigger('change');
|
|
307
|
+
});
|
|
308
|
+
}
|
|
306
309
|
// Show/Hide the div of the color at swich on
|
|
307
310
|
if (node.specifySwitchOnBrightness === "yes") {
|
|
308
311
|
$("#divColorsAtSwitchOn").show();
|
|
@@ -667,7 +667,7 @@ module.exports = function (RED) {
|
|
|
667
667
|
// In case of switch off, set the dim to zero
|
|
668
668
|
if (_event.on.on === false && (config.updateKNXBrightnessStatusOnHUEOnOff === undefined || config.updateKNXBrightnessStatusOnHUEOnOff === "onhueoff")) {
|
|
669
669
|
node.updateKNXBrightnessState(0);
|
|
670
|
-
|
|
670
|
+
if (_event.dimming !== undefined) delete _event.dimming; // Remove event.dimming, because has beem handled by this function and i don't want the function below to take care of it.
|
|
671
671
|
} else if (_event.on.on === true && node.currentHUEDevice.on.on === false) {
|
|
672
672
|
// Turn on always update the dimming KNX Status value as well.
|
|
673
673
|
let brightVal = 50;
|
|
@@ -715,7 +715,7 @@ module.exports = function (RED) {
|
|
|
715
715
|
shape: "dot",
|
|
716
716
|
text: `HUE->KNX error ${node.id} ${error.message}. Seee Log`,
|
|
717
717
|
});
|
|
718
|
-
RED.log.error(`knxUltimateHueLight: node.handleSendHUE = (_event): ${error.
|
|
718
|
+
RED.log.error(`knxUltimateHueLight: node.handleSendHUE = (_event): ${error.stack}`);
|
|
719
719
|
}
|
|
720
720
|
};
|
|
721
721
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"engines": {
|
|
4
4
|
"node": ">=16.0.0"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.3.1",
|
|
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",
|