node-red-contrib-huemagic 5.1.0 → 5.2.0
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 +10 -1
- package/README.md +13 -3
- package/huemagic/hue-buttons.html +87 -22
- package/huemagic/hue-buttons.js +25 -12
- package/huemagic/locales/de/hue-buttons.html +2 -0
- package/huemagic/locales/de/hue-buttons.json +7 -1
- package/huemagic/locales/el/hue-buttons.html +2 -0
- package/huemagic/locales/el/hue-buttons.json +7 -1
- package/huemagic/locales/en/hue-buttons.html +2 -0
- package/huemagic/locales/en/hue-buttons.json +7 -1
- package/huemagic/locales/es/hue-buttons.html +2 -0
- package/huemagic/locales/es/hue-buttons.json +7 -1
- package/huemagic/locales/fr/hue-buttons.html +2 -0
- package/huemagic/locales/fr/hue-buttons.json +7 -1
- package/huemagic/locales/it/hue-buttons.html +2 -0
- package/huemagic/locales/it/hue-buttons.json +7 -1
- package/huemagic/locales/nl/hue-buttons.html +2 -0
- package/huemagic/locales/nl/hue-buttons.json +7 -1
- package/huemagic/locales/pl/hue-buttons.html +2 -0
- package/huemagic/locales/pl/hue-buttons.json +7 -1
- package/huemagic/locales/pt/hue-buttons.html +2 -0
- package/huemagic/locales/pt/hue-buttons.json +7 -1
- package/huemagic/locales/tr/hue-buttons.html +2 -0
- package/huemagic/locales/tr/hue-buttons.json +7 -1
- package/huemagic/utils/messages.js +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
-
### v5.
|
|
5
|
+
### v5.2.0 (latest)
|
|
6
|
+
|
|
7
|
+
* The "Hue Buttons" node's additional outputs can now also listen to the dial of a Hue Tap Dial Switch: choose "Rotation" instead of a button and set the range of degrees a turn has to fall into, with counterclockwise turns counting as negative ([#457](https://github.com/Foddy/node-red-contrib-huemagic/pull/457)) (thx @FredBlo)
|
|
8
|
+
|
|
9
|
+
### v5.1.1
|
|
10
|
+
|
|
11
|
+
* Pressing a button on a Hue Tap Dial Switch no longer also reports the last rotation of its dial under `msg.payload.rotation`, and turning the dial no longer reports the last pressed button ([#456](https://github.com/Foddy/node-red-contrib-huemagic/pull/456)) (thx @FredBlo)
|
|
12
|
+
* A battery or connection update of a switch, dial or doorbell no longer repeats its last press or rotation as if it had just happened ([#456](https://github.com/Foddy/node-red-contrib-huemagic/pull/456)) (thx @FredBlo)
|
|
13
|
+
|
|
14
|
+
### v5.1.0
|
|
6
15
|
|
|
7
16
|
**New devices and features**
|
|
8
17
|
|
package/README.md
CHANGED
|
@@ -522,7 +522,7 @@ If you do not select a switch/button and use the node configuration in this way,
|
|
|
522
522
|
|
|
523
523
|
### Additional outputs
|
|
524
524
|
|
|
525
|
-
Under "Additional outputs" you can give the node one further output per range of buttons. Each of these outputs is triggered by the actions you tick for it:
|
|
525
|
+
Under "Additional outputs" you can give the node one further output per range of buttons, or per angle range of a dial. Each of these outputs is triggered by the actions you tick for it:
|
|
526
526
|
|
|
527
527
|
|Setting|Description|
|
|
528
528
|
|--|--|
|
|
@@ -531,8 +531,9 @@ Under "Additional outputs" you can give the node one further output per range of
|
|
|
531
531
|
| Short press ended | Fires when a key was released within half a second |
|
|
532
532
|
| Long press ended when > | Fires when a key was released after having been held down for at least the given number of milliseconds |
|
|
533
533
|
| Long press (while pressed) | Fires repeatedly, roughly every half second, for as long as the key is still held down |
|
|
534
|
+
| Rotation ↻ | Choose it under From instead of a button to listen to the dial of a Hue Tap Dial Switch. The output then fires for every turn whose angle lies between the two values you enter. Counterclockwise turns count as negative degrees, clockwise turns as positive ones: `0` to `360` catches every clockwise turn, `-360` to `0` every counterclockwise turn, and `-50` to `10` a counterclockwise turn of up to 50° or a clockwise turn of up to 10°. The angle is the one the dial reports with each rotation event, not the sum of a longer turn |
|
|
534
535
|
|
|
535
|
-
The first output of the node always receives every event, exactly as it did before, so existing flows keep working unchanged. The additional outputs only receive a copy of the message when the button range **and** the action match, which saves the Switch node that used to sit behind the node.
|
|
536
|
+
The first output of the node always receives every event, exactly as it did before, so existing flows keep working unchanged. The additional outputs only receive a copy of the message when the button range **and** the action match, or when a turn of the dial falls into the angle range, which saves the Switch node that used to sit behind the node.
|
|
536
537
|
|
|
537
538
|
### Get status
|
|
538
539
|
|
|
@@ -1218,7 +1219,16 @@ If the status of the node has changed via a certain command, the entire command
|
|
|
1218
1219
|
|
|
1219
1220
|
# Changelog
|
|
1220
1221
|
|
|
1221
|
-
### v5.
|
|
1222
|
+
### v5.2.0 (latest)
|
|
1223
|
+
|
|
1224
|
+
* The "Hue Buttons" node's additional outputs can now also listen to the dial of a Hue Tap Dial Switch: choose "Rotation" instead of a button and set the range of degrees a turn has to fall into, with counterclockwise turns counting as negative ([#457](https://github.com/Foddy/node-red-contrib-huemagic/pull/457)) (thx @FredBlo)
|
|
1225
|
+
|
|
1226
|
+
### v5.1.1
|
|
1227
|
+
|
|
1228
|
+
* Pressing a button on a Hue Tap Dial Switch no longer also reports the last rotation of its dial under `msg.payload.rotation`, and turning the dial no longer reports the last pressed button ([#456](https://github.com/Foddy/node-red-contrib-huemagic/pull/456)) (thx @FredBlo)
|
|
1229
|
+
* A battery or connection update of a switch, dial or doorbell no longer repeats its last press or rotation as if it had just happened ([#456](https://github.com/Foddy/node-red-contrib-huemagic/pull/456)) (thx @FredBlo)
|
|
1230
|
+
|
|
1231
|
+
### v5.1.0
|
|
1222
1232
|
|
|
1223
1233
|
**New devices and features**
|
|
1224
1234
|
|
|
@@ -75,7 +75,9 @@
|
|
|
75
75
|
outputLabels: function(index) {
|
|
76
76
|
let rule = (this.rules || [])[index-1];
|
|
77
77
|
let label = '';
|
|
78
|
-
if (rule) {
|
|
78
|
+
if (rule && rule.buttonFrom === 'rotation') {
|
|
79
|
+
label = this._('hue-buttons.config.outputlabel-rotation') + ' ' + this._('hue-buttons.config.outputlabel-rotation-range' , {'from' : rule.rotationFrom, 'to' : rule.rotationTo});
|
|
80
|
+
} else if (rule) {
|
|
79
81
|
if (rule.buttonFrom == rule.buttonTo) {
|
|
80
82
|
label = this._('hue-buttons.config.outputlabel-btn-from' , {'from' : rule.buttonFrom});
|
|
81
83
|
} else {
|
|
@@ -227,11 +229,18 @@
|
|
|
227
229
|
});
|
|
228
230
|
|
|
229
231
|
// ADVANCED ADDITIONAL OUTPUTS
|
|
230
|
-
// Styles used in button range container
|
|
231
|
-
$("
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
// Styles used in button range container (injected once - oneditprepare re-runs on every dialog open)
|
|
233
|
+
if ($("#hue-buttons-rule-styles").length === 0) {
|
|
234
|
+
$("<style/>", { id: "hue-buttons-rule-styles" }).appendTo("head").text(
|
|
235
|
+
"#node-input-rule-container .buttonrule-row {min-height: 25px;}"
|
|
236
|
+
+ "#node-input-rule-container .buttonrule-hidden {visibility: hidden;}"
|
|
237
|
+
+ "#node-input-rule-container .buttonrule-fromtolabel {display:inline-block; width:115px; margin-left: 5px;}"
|
|
238
|
+
+ "#node-input-rule-container .buttonrule-checkbox {display:inline-block; width:22px; margin-left:0px; vertical-align:baseline;}"
|
|
239
|
+
+ "#node-input-rule-container .buttonrule-select {width:100px; height: 23px; padding: 2px 2px; margin-left: 10px; margin-right: 10px; text-align: center;}"
|
|
240
|
+
+ "#node-input-rule-container .buttonrule-select:disabled {color:LightGrey;}"
|
|
241
|
+
+ "#node-input-rule-container .buttonrule-checkbox-label {width: auto; margin-bottom: 2px;}"
|
|
242
|
+
);
|
|
243
|
+
}
|
|
235
244
|
// Output order can be updated to keep linked junctions correctly connected. To do so, a reserved item must contains
|
|
236
245
|
// outputs re-directions (if outputs are a,b,c,d, after configuring, new outputs are z,a,c, then 'node-input-outputs'
|
|
237
246
|
// must now be {"0":"1", "1":"-1", "2":"2", "3":"-1", "someRandomNo":"0"}.
|
|
@@ -291,43 +300,88 @@
|
|
|
291
300
|
if (!rule.hasOwnProperty('minLongPressDuration')) {
|
|
292
301
|
rule.minLongPressDuration = 1000;
|
|
293
302
|
}
|
|
303
|
+
if (!rule.hasOwnProperty('rotationFrom')) {
|
|
304
|
+
rule.rotationFrom = -360;
|
|
305
|
+
}
|
|
306
|
+
if (!rule.hasOwnProperty('rotationTo')) {
|
|
307
|
+
rule.rotationTo = 360;
|
|
308
|
+
}
|
|
294
309
|
// ROW 1 : 'From label' & checkbox 'Start press'
|
|
295
|
-
let row1 = $('<div/>').appendTo(container);
|
|
310
|
+
let row1 = $('<div/>',{class:"buttonrule-row"}).appendTo(container);
|
|
296
311
|
row1.append('<span class="buttonrule-fromtolabel">' + scope._('hue-buttons.config.add-outputs-btn-from') + '</span>');
|
|
297
312
|
let field_onStartPress = $('<input/>',{id:"node-input-onStartPress_" + uniqueRowID,type:"checkbox", class:"buttonrule-checkbox"}).appendTo(row1);
|
|
298
|
-
|
|
313
|
+
let label_onStartPress = $('<label class="buttonrule-checkbox-label" for="node-input-onStartPress_' + uniqueRowID + '">' + scope._('hue-buttons.config.add-outputs-startpress') + '</label>').appendTo(row1);
|
|
299
314
|
// ROW1 : output info (rightest part)
|
|
300
315
|
let finalspan = $('<span/>',{style:"float: right;margin-top: 6px;"}).appendTo(row1);
|
|
301
316
|
finalspan.append('<i class="fa fa-sign-out"></i><span class="node-input-rule-index">'+(i+2)+'</span>');
|
|
302
|
-
// ROW 2 : 'From list' & checkbox 'End short press'
|
|
303
|
-
let row2 = $('<div/>').appendTo(container);
|
|
317
|
+
// ROW 2 : 'From list' & checkbox 'End short press' / rotation direction hint
|
|
318
|
+
let row2 = $('<div/>',{class:"buttonrule-row"}).appendTo(container);
|
|
304
319
|
let field_buttonFrom = $('<select/>',{id:"node-input-buttonFrom_" + uniqueRowID, class:"buttonrule-select"}).appendTo(row2);
|
|
305
320
|
let field_onEndShortPress = $('<input/>',{id:"node-input-onEndShortPress_" + uniqueRowID, type:"checkbox", class:"buttonrule-checkbox"}).appendTo(row2);
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
321
|
+
let label_onEndShortPress = $('<label class="buttonrule-checkbox-label" for="node-input-onEndShortPress_' + uniqueRowID + '">' + scope._('hue-buttons.config.add-outputs-shortpress') + '</label>').appendTo(row2);
|
|
322
|
+
let label_rotationHint = $('<label class="buttonrule-checkbox-label">' + scope._('hue-buttons.config.add-outputs-rotation-hint') + '</label>').appendTo(row2);
|
|
323
|
+
// ROW 3 : 'To label' & checkbox 'End long press after [xx] ms' / 'Angle between [xx] and [xx]°'
|
|
324
|
+
let row3 = $('<div/>',{class:"buttonrule-row"}).appendTo(container);
|
|
309
325
|
row3.append('<span class="buttonrule-fromtolabel">' + scope._('hue-buttons.config.add-outputs-btn-to') + '</span>');
|
|
310
326
|
let field_onEndLongPress = $('<input/>',{id:"node-input-onEndLongPress_" + uniqueRowID, type:"checkbox", class:"buttonrule-checkbox"}).appendTo(row3);
|
|
311
|
-
|
|
327
|
+
let label_onEndLongPress = $('<label class="buttonrule-checkbox-label" for="node-input-onEndLongPress_' + uniqueRowID + '" style="width:unset";>' + scope._('hue-buttons.config.add-outputs-longpress') + ' </label>').appendTo(row3);
|
|
312
328
|
let field_minLongPressDuration = $('<input/>',{id:"node-input-minLongPressDuration_" + uniqueRowID, type:"text",style:"height:23px; width:55px; padding: 2px 2px;"}).appendTo(row3);
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
let
|
|
329
|
+
let label_minLongPressDuration = $('<label class="buttonrule-checkbox-label" for="node-input-minLongPressDuration_' + uniqueRowID + '">  ms</label>').appendTo(row3);
|
|
330
|
+
let label_rotationFrom = $('<label class="buttonrule-checkbox-label" for="node-input-rotationFrom_' + uniqueRowID + '">' + scope._('hue-buttons.config.add-outputs-rotation-range') + ' </label>').appendTo(row3);
|
|
331
|
+
let field_rotationFrom = $('<input/>',{id:"node-input-rotationFrom_" + uniqueRowID, type:"text",style:"height:23px; width:40px; padding: 2px 2px;"}).appendTo(row3);
|
|
332
|
+
let label_rotationTo = $('<label class="buttonrule-checkbox-label" for="node-input-rotationTo_' + uniqueRowID + '"> ' + scope._('hue-buttons.config.add-outputs-rotation-range-to') + ' </label>').appendTo(row3);
|
|
333
|
+
let field_rotationTo = $('<input/>',{id:"node-input-rotationTo_" + uniqueRowID, type:"text",style:"height:23px; width:40px; padding: 2px 2px;"}).appendTo(row3);
|
|
334
|
+
let label_rotationDegrees = $('<label class="buttonrule-checkbox-label"> °</label>').appendTo(row3);
|
|
335
|
+
// ROW 4 : 'To list' & checkbox 'During long press' (no rotation-mode equivalent - buttonTo just shows disabled)
|
|
336
|
+
let row4 = $('<div/>',{class:"buttonrule-row"}).appendTo(container);
|
|
316
337
|
let field_buttonTo = $('<select/>',{id:"node-input-buttonTo_" + uniqueRowID, class:"buttonrule-select"}).appendTo(row4);
|
|
317
338
|
let field_onDuringLongPress = $('<input/>',{id:"node-input-onDuringLongPress_" + uniqueRowID, type:"checkbox", class:"buttonrule-checkbox"}).appendTo(row4);
|
|
318
|
-
|
|
339
|
+
let label_onDuringLongPress = $('<label class="buttonrule-checkbox-label" for="node-input-onDuringLongPress_' + uniqueRowID + '">' + scope._('hue-buttons.config.add-outputs-longpresswhile') + '</label>').appendTo(row4);
|
|
319
340
|
|
|
320
|
-
// Build all
|
|
341
|
+
// Build all 1-10 choices to both fields inputs, plus the "Rotation" mode and its disabled "-" counterpart
|
|
321
342
|
for (let i = 1; i <= 10; i++) {
|
|
322
343
|
field_buttonFrom.append($("<option></option>").val(i.toString()).text(i.toString()));
|
|
323
344
|
field_buttonTo.append($("<option></option>").val(i.toString()).text(i.toString()));
|
|
324
345
|
}
|
|
346
|
+
field_buttonFrom.append($("<option></option>").val("rotation").text(scope._('hue-buttons.config.add-outputs-rotation')));
|
|
347
|
+
field_buttonTo.append($("<option></option>").val("").text("-").prop("disabled", true));
|
|
348
|
+
|
|
349
|
+
// Shows/hides the button-range vs rotation controls, and disables/greys 'To' while in rotation mode
|
|
350
|
+
function applyRangeMode() {
|
|
351
|
+
let isRotation = (field_buttonFrom.val() === "rotation");
|
|
352
|
+
|
|
353
|
+
field_onStartPress.toggle(!isRotation);
|
|
354
|
+
label_onStartPress.toggle(!isRotation);
|
|
355
|
+
field_onEndShortPress.toggle(!isRotation);
|
|
356
|
+
label_onEndShortPress.toggle(!isRotation);
|
|
357
|
+
field_onEndLongPress.toggle(!isRotation);
|
|
358
|
+
label_onEndLongPress.toggle(!isRotation);
|
|
359
|
+
field_minLongPressDuration.toggle(!isRotation);
|
|
360
|
+
label_minLongPressDuration.toggle(!isRotation);
|
|
361
|
+
// Visibility instead of display keeps row 4 at its height
|
|
362
|
+
field_onDuringLongPress.toggleClass('buttonrule-hidden', isRotation);
|
|
363
|
+
label_onDuringLongPress.toggleClass('buttonrule-hidden', isRotation);
|
|
364
|
+
|
|
365
|
+
label_rotationHint.toggle(isRotation);
|
|
366
|
+
label_rotationFrom.toggle(isRotation);
|
|
367
|
+
field_rotationFrom.toggle(isRotation);
|
|
368
|
+
label_rotationTo.toggle(isRotation);
|
|
369
|
+
field_rotationTo.toggle(isRotation);
|
|
370
|
+
label_rotationDegrees.toggle(isRotation);
|
|
325
371
|
|
|
326
|
-
|
|
372
|
+
if (isRotation) {
|
|
373
|
+
field_buttonTo.val("").prop('disabled', true);
|
|
374
|
+
} else if (field_buttonTo.prop('disabled')) {
|
|
375
|
+
field_buttonTo.prop('disabled', false).val(field_buttonFrom.val());
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Events : When From & To selector is changed, ensure range remains OK (numeric mode only)
|
|
327
380
|
field_buttonFrom.on ("change", function() {
|
|
328
|
-
if (parseInt(field_buttonFrom.val()) > parseInt(field_buttonTo.val())) {
|
|
381
|
+
if (field_buttonFrom.val() !== "rotation" && field_buttonTo.val() !== "" && parseInt(field_buttonFrom.val()) > parseInt(field_buttonTo.val())) {
|
|
329
382
|
field_buttonTo.val(field_buttonFrom.val());
|
|
330
383
|
}
|
|
384
|
+
applyRangeMode();
|
|
331
385
|
});
|
|
332
386
|
field_buttonTo.on ("change", function() {
|
|
333
387
|
if (parseInt(field_buttonFrom.val()) > parseInt(field_buttonTo.val())) {
|
|
@@ -337,13 +391,17 @@
|
|
|
337
391
|
|
|
338
392
|
// Copy memory info back on fields
|
|
339
393
|
field_buttonFrom.val (rule.buttonFrom.toString());
|
|
340
|
-
field_buttonTo.val (rule.buttonTo.toString());
|
|
394
|
+
field_buttonTo.val (rule.buttonTo !== null ? rule.buttonTo.toString() : "");
|
|
341
395
|
field_minLongPressDuration.val (rule.minLongPressDuration.toString());
|
|
396
|
+
field_rotationFrom.val (rule.rotationFrom.toString());
|
|
397
|
+
field_rotationTo.val (rule.rotationTo.toString());
|
|
342
398
|
// Checkboxes
|
|
343
399
|
field_onStartPress.prop ('checked', rule.onStartPress);
|
|
344
400
|
field_onEndShortPress.prop ('checked', rule.onEndShortPress);
|
|
345
401
|
field_onEndLongPress.prop ('checked', rule.onEndLongPress);
|
|
346
402
|
field_onDuringLongPress.prop ('checked', rule.onDuringLongPress);
|
|
403
|
+
// Show the button-range or rotation controls, matching this rule's own mode
|
|
404
|
+
applyRangeMode();
|
|
347
405
|
// Update outputs (number of outputs and how the changed since onLoad)
|
|
348
406
|
rebuildOutputIndexes ($("#node-input-rule-container").editableList('items'));
|
|
349
407
|
},
|
|
@@ -388,6 +446,13 @@
|
|
|
388
446
|
rules.each (function (i) {
|
|
389
447
|
let rule = $(this);
|
|
390
448
|
let savedRule = {};
|
|
449
|
+
if (rule.find("[id^=node-input-buttonFrom_]").val() === "rotation") {
|
|
450
|
+
// A rotation rule only keeps its angle range, ordered low to high
|
|
451
|
+
let from = parseInt(rule.find("[id^=node-input-rotationFrom_]").val()) || 0;
|
|
452
|
+
let to = parseInt(rule.find("[id^=node-input-rotationTo_]").val()) || 0;
|
|
453
|
+
node.rules.push ({buttonFrom: "rotation", buttonTo: null, rotationFrom: Math.min(from, to), rotationTo: Math.max(from, to)});
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
391
456
|
savedRule.buttonFrom = parseInt(rule.find("[id^=node-input-buttonFrom_]").val());
|
|
392
457
|
savedRule.buttonTo = parseInt(rule.find("[id^=node-input-buttonTo_]").val());
|
|
393
458
|
savedRule.onStartPress = rule.find("[id^=node-input-onStartPress_]").prop("checked");
|
package/huemagic/hue-buttons.js
CHANGED
|
@@ -24,6 +24,15 @@ module.exports = function(RED)
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
//
|
|
28
|
+
// DOES A DIAL ROTATION EVENT MATCH THE RULE OF AN ADDITIONAL OUTPUT?
|
|
29
|
+
function matchesRotationRule(rotation, rule)
|
|
30
|
+
{
|
|
31
|
+
// COUNTERCLOCKWISE IS NEGATIVE, CLOCKWISE POSITIVE
|
|
32
|
+
const degrees = rotation.clockwise ? rotation.degrees : -rotation.degrees;
|
|
33
|
+
return (degrees >= (parseInt(rule.rotationFrom) || 0) && degrees <= (parseInt(rule.rotationTo) || 0));
|
|
34
|
+
}
|
|
35
|
+
|
|
27
36
|
function HueButtons(config)
|
|
28
37
|
{
|
|
29
38
|
RED.nodes.createNode(this, config);
|
|
@@ -75,7 +84,8 @@ module.exports = function(RED)
|
|
|
75
84
|
// SUBSCRIBE TO UPDATES FROM THE BRIDGE
|
|
76
85
|
this.unsubscribe = bridge.subscribe("button", config.sensorid, function(info)
|
|
77
86
|
{
|
|
78
|
-
|
|
87
|
+
// ONLY REPORT THE SERVICE THAT FIRED THIS EVENT, NOT THE LAST PRESS OR ROTATION STILL CACHED
|
|
88
|
+
let currentState = bridge.get("button", info.id, { updatedType: info.updatedType });
|
|
79
89
|
|
|
80
90
|
// RESOURCE FOUND?
|
|
81
91
|
if(currentState !== false)
|
|
@@ -141,15 +151,16 @@ module.exports = function(RED)
|
|
|
141
151
|
|
|
142
152
|
// COPY THE EVENT TO EVERY ADDITIONAL OUTPUT THAT ASKED FOR IT
|
|
143
153
|
let outputs = [currentState];
|
|
154
|
+
const rules = Array.isArray(config.rules) ? config.rules : [];
|
|
144
155
|
|
|
145
|
-
|
|
156
|
+
for (let i = 0; i < rules.length; i++)
|
|
146
157
|
{
|
|
147
|
-
const
|
|
158
|
+
const rule = rules[i];
|
|
159
|
+
const matched = (rule.buttonFrom === "rotation")
|
|
160
|
+
? (currentState.payload.rotation !== false && matchesRotationRule(currentState.payload.rotation, rule))
|
|
161
|
+
: (currentState.payload.button !== false && matchesRule(buttonState, rule));
|
|
148
162
|
|
|
149
|
-
|
|
150
|
-
{
|
|
151
|
-
outputs[i+1] = matchesRule(buttonState, rules[i]) ? RED.util.cloneMessage(currentState) : null;
|
|
152
|
-
}
|
|
163
|
+
outputs[i+1] = matched ? RED.util.cloneMessage(currentState) : null;
|
|
153
164
|
}
|
|
154
165
|
|
|
155
166
|
// SEND STATE
|
|
@@ -216,13 +227,15 @@ module.exports = function(RED)
|
|
|
216
227
|
{
|
|
217
228
|
scope.status({fill: "grey", shape: "dot", text: "hue-buttons.node.waiting"});
|
|
218
229
|
|
|
219
|
-
// REMOVE OLD BUTTON STATES
|
|
220
|
-
const
|
|
221
|
-
if(!buttons) { return false; }
|
|
230
|
+
// REMOVE OLD BUTTON AND DIAL STATES
|
|
231
|
+
const services = (bridge.resources[config.sensorid] && bridge.resources[config.sensorid]["services"]) ? bridge.resources[config.sensorid]["services"] : {};
|
|
222
232
|
|
|
223
|
-
for (const [
|
|
233
|
+
for (const oneType of ["button", "relative_rotary"])
|
|
224
234
|
{
|
|
225
|
-
|
|
235
|
+
for (const oneService of Object.values(services[oneType] || {}))
|
|
236
|
+
{
|
|
237
|
+
delete oneService[oneType];
|
|
238
|
+
}
|
|
226
239
|
}
|
|
227
240
|
}, 3000);
|
|
228
241
|
}
|
|
@@ -9,6 +9,8 @@ Wenn Sie keinen Schalter auswählen und die Node-Konfiguration so anwenden, arbe
|
|
|
9
9
|
|
|
10
10
|
Unter „Zusätzliche Ausgänge“ können Sie pro Tastenbereich einen Ausgang hinzufügen, der jeweils durch eine bestimmte Aktion ausgelöst wird (Beginn eines Drucks, Ende eines kurzen Drucks, Ende eines langen Drucks, sobald dieser mindestens die eingestellte Dauer erreicht hat, oder wiederholt, während ein langer Druck andauert). Der erste Ausgang des Nodes erhält wie bisher immer jedes Ereignis; die zusätzlichen Ausgänge erhalten nur dann eine Kopie der Nachricht, wenn sowohl der Tastenbereich als auch die Aktion übereinstimmen.
|
|
11
11
|
|
|
12
|
+
Für das Drehrad eines Hue Tap Dial Switch wählen Sie unter „Von“ stattdessen „Drehung ↻“ und geben einen Winkelbereich an. Drehungen gegen den Uhrzeigersinn zählen als negative Grad, Drehungen im Uhrzeigersinn als positive: `0` bis `360` erfasst jede Drehung im Uhrzeigersinn, `-360` bis `0` jede Drehung gegen den Uhrzeigersinn und `-50` bis `10` eine Drehung um bis zu 50° gegen oder bis zu 10° im Uhrzeigersinn. Maßgeblich ist der Winkel, den das Drehrad mit jedem einzelnen Dreh-Ereignis meldet, nicht die Summe einer längeren Drehung.
|
|
13
|
+
|
|
12
14
|
### Status abrufen
|
|
13
15
|
|
|
14
16
|
Gibt den aktuellen Status des Schalters aus, sobald ein `msg.payload`-Objekt mit folgendem Inhalt an den Node übergeben wurde. Sie können alternativ auch den Button in der Node-RED-Oberfläche betätigen, ohne vorher eine Nachricht an den Node übergeben zu müssen.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Langer Druck beendet nach >",
|
|
25
25
|
"add-outputs-longpresswhile": "Langer Druck (während gedrückt)",
|
|
26
26
|
"add-outputs-btn-addnew": "neuen Tastenbereich hinzufügen",
|
|
27
|
+
"add-outputs-rotation": "Drehung ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Winkel zwischen",
|
|
30
|
+
"add-outputs-rotation-range-to": "und",
|
|
27
31
|
"outputlabel-btn-from": "Taste #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "Tasten #__from__ bis #__to__",
|
|
29
33
|
"outputlabel-btn-on": "bei:",
|
|
30
34
|
"outputlabel-btn-startpress": "Druck beginnt",
|
|
31
35
|
"outputlabel-btn-shortpress": "Kurzer Druck beendet",
|
|
32
36
|
"outputlabel-btn-longpress": "Langer Druck (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Langer Druck (während gedrückt)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Langer Druck (während gedrückt)",
|
|
38
|
+
"outputlabel-rotation": "Drehung",
|
|
39
|
+
"outputlabel-rotation-range": "zwischen __from__° und __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"title": "Hue Buttons",
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
Στο πεδίο «Πρόσθετες έξοδοι» μπορείτε να προσθέσετε μία έξοδο ανά εύρος κουμπιών, η καθεμία ενεργοποιούμενη από μια συγκεκριμένη ενέργεια (έναρξη πατήματος, τέλος σύντομου πατήματος, τέλος παρατεταμένου πατήματος όταν έχει διαρκέσει τουλάχιστον όσο η ρυθμισμένη διάρκεια, ή επαναλαμβανόμενα ενόσω το παρατεταμένο πάτημα βρίσκεται σε εξέλιξη). Η πρώτη έξοδος του κόμβου λαμβάνει πάντα κάθε συμβάν, όπως και πριν· οι πρόσθετες έξοδοι λαμβάνουν αντίγραφο του μηνύματος μόνο όταν ταιριάζουν τόσο το εύρος κουμπιών όσο και η ενέργεια.
|
|
11
11
|
|
|
12
|
+
Για τον περιστροφικό επιλογέα ενός Hue Tap Dial Switch, επιλέξτε «Περιστροφή ↻» στο «Από» και εισαγάγετε ένα εύρος γωνίας. Οι αριστερόστροφες περιστροφές μετρούν ως αρνητικές μοίρες και οι δεξιόστροφες ως θετικές: `0` έως `360` πιάνει κάθε δεξιόστροφη περιστροφή, `-360` έως `0` κάθε αριστερόστροφη, και `-50` έως `10` μια αριστερόστροφη περιστροφή έως 50° ή μια δεξιόστροφη έως 10°. Ισχύει η γωνία που αναφέρει ο επιλογέας με κάθε μεμονωμένο συμβάν περιστροφής, όχι το άθροισμα μιας μεγαλύτερης περιστροφής.
|
|
13
|
+
|
|
12
14
|
### Ανάκτηση κατάστασης
|
|
13
15
|
|
|
14
16
|
Εξάγει την τρέχουσα κατάσταση του διακόπτη ή του κουμπιού μόλις σταλεί στον κόμβο ένα αντικείμενο `msg.payload` με το παρακάτω περιεχόμενο. Εναλλακτικά μπορείτε να πατήσετε το κουμπί στο περιβάλλον του Node-RED, χωρίς να χρειάζεται να στείλετε πρώτα μήνυμα στον κόμβο.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Τέλος παρατεταμένου πατήματος όταν >",
|
|
25
25
|
"add-outputs-longpresswhile": "Παρατεταμένο πάτημα (ενόσω πατημένο)",
|
|
26
26
|
"add-outputs-btn-addnew": "προσθήκη νέου εύρους κουμπιών",
|
|
27
|
+
"add-outputs-rotation": "Περιστροφή ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Γωνία μεταξύ",
|
|
30
|
+
"add-outputs-rotation-range-to": "και",
|
|
27
31
|
"outputlabel-btn-from": "κουμπί #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "κουμπιά #__from__ έως #__to__",
|
|
29
33
|
"outputlabel-btn-on": "σε:",
|
|
30
34
|
"outputlabel-btn-startpress": "Έναρξη πατήματος",
|
|
31
35
|
"outputlabel-btn-shortpress": "Τέλος σύντομου πατήματος",
|
|
32
36
|
"outputlabel-btn-longpress": "Παρατεταμένο πάτημα (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Παρατεταμένο πάτημα (ενόσω πατημένο)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Παρατεταμένο πάτημα (ενόσω πατημένο)",
|
|
38
|
+
"outputlabel-rotation": "περιστροφή επιλογέα",
|
|
39
|
+
"outputlabel-rotation-range": "μεταξύ __from__° και __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"not-configured": "μη ρυθμισμένο",
|
|
@@ -9,6 +9,8 @@ If you do not select a switch/button and use the node configuration in this way,
|
|
|
9
9
|
|
|
10
10
|
Under "Additional outputs" you can add one output per range of buttons, each triggered by a specific action (start of press, end of a short press, end of a long press once it lasted at least the configured duration, or repeatedly while a long press is ongoing). The first output of the node always receives every event, exactly as before; the additional outputs only receive a copy of the message when both the button range and the action match.
|
|
11
11
|
|
|
12
|
+
For the dial of a Hue Tap Dial Switch, choose "Rotation ↻" under "From" and enter an angle range instead. Counterclockwise turns count as negative degrees, clockwise turns as positive ones: `0` to `360` catches every clockwise turn, `-360` to `0` every counterclockwise turn, and `-50` to `10` a counterclockwise turn of up to 50° or a clockwise turn of up to 10°. The angle is the one the dial reports with each rotation event, not the sum of a longer turn.
|
|
13
|
+
|
|
12
14
|
### Get status
|
|
13
15
|
|
|
14
16
|
Outputs the current status of the switch/button as soon as a `msg.payload` object with the following content has been passed to the node. Alternatively, you can also press the button in the Node-RED interface without having to pass a message to the node beforehand.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Long press ended when >",
|
|
25
25
|
"add-outputs-longpresswhile": "Long press (while pressed)",
|
|
26
26
|
"add-outputs-btn-addnew": "add new buttons range",
|
|
27
|
+
"add-outputs-rotation": "Rotation ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Angle between",
|
|
30
|
+
"add-outputs-rotation-range-to": "and",
|
|
27
31
|
"outputlabel-btn-from": "button #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "buttons #__from__ to #__to__",
|
|
29
33
|
"outputlabel-btn-on": "on :",
|
|
30
34
|
"outputlabel-btn-startpress": "Start press",
|
|
31
35
|
"outputlabel-btn-shortpress": "Short press ended",
|
|
32
36
|
"outputlabel-btn-longpress": "Long press (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Long press (while pressed)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Long press (while pressed)",
|
|
38
|
+
"outputlabel-rotation": "dial rotation",
|
|
39
|
+
"outputlabel-rotation-range": "between __from__° and __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"title": "Hue Buttons",
|
|
@@ -9,6 +9,8 @@ Si no selecciona ningún interruptor o botón y utiliza así la configuración d
|
|
|
9
9
|
|
|
10
10
|
En «Salidas adicionales» puede añadir una salida por cada rango de botones, activada cada una por una acción concreta (inicio de la pulsación, fin de una pulsación corta, fin de una pulsación larga una vez alcanzada la duración configurada, o de forma repetida mientras la pulsación larga está en curso). La primera salida del nodo sigue recibiendo siempre todos los eventos, como antes; las salidas adicionales solo reciben una copia del mensaje cuando coinciden tanto el rango de botones como la acción.
|
|
11
11
|
|
|
12
|
+
Para la rueda de un Hue Tap Dial Switch, elija «Rotación ↻» en «Desde» e introduzca un rango de ángulos. Los giros en sentido antihorario cuentan como grados negativos y los giros en sentido horario como positivos: de `0` a `360` recoge cualquier giro horario, de `-360` a `0` cualquier giro antihorario, y de `-50` a `10` un giro antihorario de hasta 50° o un giro horario de hasta 10°. Cuenta el ángulo que la rueda informa en cada evento de rotación, no la suma de un giro más largo.
|
|
13
|
+
|
|
12
14
|
### Consultar el estado
|
|
13
15
|
|
|
14
16
|
Emite el estado actual del interruptor o botón en cuanto se transfiere al nodo un objeto `msg.payload` con el siguiente contenido. Como alternativa, también puede pulsar el botón en la interfaz de Node-RED sin tener que enviar antes ningún mensaje al nodo.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Fin de pulsación larga cuando >",
|
|
25
25
|
"add-outputs-longpresswhile": "Pulsación larga (mientras se mantiene)",
|
|
26
26
|
"add-outputs-btn-addnew": "añadir nuevo rango de botones",
|
|
27
|
+
"add-outputs-rotation": "Rotación ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Ángulo entre",
|
|
30
|
+
"add-outputs-rotation-range-to": "y",
|
|
27
31
|
"outputlabel-btn-from": "botón #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "botones #__from__ a #__to__",
|
|
29
33
|
"outputlabel-btn-on": "en:",
|
|
30
34
|
"outputlabel-btn-startpress": "Inicio de la pulsación",
|
|
31
35
|
"outputlabel-btn-shortpress": "Fin de pulsación corta",
|
|
32
36
|
"outputlabel-btn-longpress": "Pulsación larga (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Pulsación larga (mientras se mantiene)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Pulsación larga (mientras se mantiene)",
|
|
38
|
+
"outputlabel-rotation": "rotación de la rueda",
|
|
39
|
+
"outputlabel-rotation-range": "entre __from__° y __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"not-configured": "sin configurar",
|
|
@@ -9,6 +9,8 @@ Si vous ne sélectionnez aucun interrupteur ou bouton et utilisez la configurati
|
|
|
9
9
|
|
|
10
10
|
Dans « Sorties supplémentaires », vous pouvez ajouter une sortie par plage de boutons, chacune déclenchée par une action précise (début de l'appui, fin d'un appui court, fin d'un appui long une fois qu'il a duré au moins la durée configurée, ou de façon répétée pendant qu'un appui long est en cours). La première sortie du nœud reçoit toujours chaque événement, comme auparavant ; les sorties supplémentaires ne reçoivent une copie du message que lorsque la plage de boutons et l'action correspondent toutes les deux.
|
|
11
11
|
|
|
12
|
+
Pour la molette d'un Hue Tap Dial Switch, choisissez « Rotation ↻ » sous « De » et indiquez une plage d'angles. Les rotations dans le sens antihoraire comptent en degrés négatifs, celles dans le sens horaire en degrés positifs : de `0` à `360` capte toute rotation horaire, de `-360` à `0` toute rotation antihoraire, et de `-50` à `10` une rotation antihoraire jusqu'à 50° ou une rotation horaire jusqu'à 10°. Seul compte l'angle que la molette transmet avec chaque événement de rotation, et non la somme d'une rotation plus longue.
|
|
13
|
+
|
|
12
14
|
### Interroger le statut
|
|
13
15
|
|
|
14
16
|
Émet le statut actuel de l'interrupteur ou du bouton dès qu'un objet `msg.payload` ayant le contenu suivant est transmis au nœud. Vous pouvez également appuyer sur le bouton dans l'interface Node-RED sans avoir à transmettre au préalable un message au nœud.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Fin d'appui long quand >",
|
|
25
25
|
"add-outputs-longpresswhile": "Appui long (pendant le maintien)",
|
|
26
26
|
"add-outputs-btn-addnew": "ajouter une nouvelle plage de boutons",
|
|
27
|
+
"add-outputs-rotation": "Rotation ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Angle entre",
|
|
30
|
+
"add-outputs-rotation-range-to": "et",
|
|
27
31
|
"outputlabel-btn-from": "bouton #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "boutons #__from__ à #__to__",
|
|
29
33
|
"outputlabel-btn-on": "sur :",
|
|
30
34
|
"outputlabel-btn-startpress": "Début de l'appui",
|
|
31
35
|
"outputlabel-btn-shortpress": "Fin d'appui court",
|
|
32
36
|
"outputlabel-btn-longpress": "Appui long (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Appui long (pendant le maintien)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Appui long (pendant le maintien)",
|
|
38
|
+
"outputlabel-rotation": "rotation de la molette",
|
|
39
|
+
"outputlabel-rotation-range": "entre __from__° et __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"not-configured": "non configuré",
|
|
@@ -9,6 +9,8 @@ Se non seleziona alcun interruttore o pulsante e utilizza così la configurazion
|
|
|
9
9
|
|
|
10
10
|
In «Uscite aggiuntive» può aggiungere un'uscita per ogni intervallo di pulsanti, ciascuna attivata da un'azione specifica (inizio della pressione, fine di una pressione breve, fine di una pressione prolungata una volta raggiunta la durata configurata, oppure ripetutamente mentre una pressione prolungata è in corso). La prima uscita del nodo continua a ricevere sempre ogni evento, come prima; le uscite aggiuntive ricevono una copia del messaggio solo quando corrispondono sia l'intervallo di pulsanti sia l'azione.
|
|
11
11
|
|
|
12
|
+
Per la rotella di un Hue Tap Dial Switch, scelga «Rotazione ↻» in «Da» e inserisca un intervallo di angoli. Le rotazioni in senso antiorario contano come gradi negativi, quelle in senso orario come positivi: da `0` a `360` coglie ogni rotazione oraria, da `-360` a `0` ogni rotazione antioraria, e da `-50` a `10` una rotazione antioraria fino a 50° o una rotazione oraria fino a 10°. Conta l'angolo che la rotella comunica con ogni singolo evento di rotazione, non la somma di una rotazione più lunga.
|
|
13
|
+
|
|
12
14
|
### Richiedere lo stato
|
|
13
15
|
|
|
14
16
|
Emette lo stato attuale dell'interruttore o del pulsante non appena al nodo viene trasmesso un oggetto `msg.payload` con il seguente contenuto. In alternativa può anche premere il pulsante nell'interfaccia di Node-RED senza dover inviare prima un messaggio al nodo.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Fine pressione prolungata quando >",
|
|
25
25
|
"add-outputs-longpresswhile": "Pressione prolungata (mentre premuto)",
|
|
26
26
|
"add-outputs-btn-addnew": "aggiungi nuovo intervallo di pulsanti",
|
|
27
|
+
"add-outputs-rotation": "Rotazione ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Angolo tra",
|
|
30
|
+
"add-outputs-rotation-range-to": "e",
|
|
27
31
|
"outputlabel-btn-from": "pulsante #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "pulsanti #__from__ - #__to__",
|
|
29
33
|
"outputlabel-btn-on": "su:",
|
|
30
34
|
"outputlabel-btn-startpress": "Inizio pressione",
|
|
31
35
|
"outputlabel-btn-shortpress": "Fine pressione breve",
|
|
32
36
|
"outputlabel-btn-longpress": "Pressione prolungata (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Pressione prolungata (mentre premuto)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Pressione prolungata (mentre premuto)",
|
|
38
|
+
"outputlabel-rotation": "rotazione della rotella",
|
|
39
|
+
"outputlabel-rotation-range": "tra __from__° e __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"not-configured": "non configurato",
|
|
@@ -9,6 +9,8 @@ Als u geen schakelaar of knop selecteert en de nodeconfiguratie zo gebruikt, wer
|
|
|
9
9
|
|
|
10
10
|
Onder "Extra uitgangen" kunt u per knoppenbereik een uitgang toevoegen, elk geactiveerd door een specifieke actie (begin van indrukken, einde van kort indrukken, einde van lang indrukken zodra dit minstens de ingestelde duur heeft geduurd, of herhaaldelijk terwijl lang indrukken bezig is). De eerste uitgang van de node ontvangt zoals voorheen altijd elke gebeurtenis; de extra uitgangen ontvangen alleen een kopie van het bericht wanneer zowel het knoppenbereik als de actie overeenkomen.
|
|
11
11
|
|
|
12
|
+
Voor de draaiknop van een Hue Tap Dial Switch kiest u onder "Van" in plaats daarvan "Rotatie ↻" en vult u een hoekbereik in. Draaiingen tegen de klok in tellen als negatieve graden, draaiingen met de klok mee als positieve: `0` tot `360` vangt elke draaiing met de klok mee, `-360` tot `0` elke draaiing tegen de klok in, en `-50` tot `10` een draaiing van maximaal 50° tegen de klok in of maximaal 10° met de klok mee. Het gaat om de hoek die de draaiknop bij elke afzonderlijke draaigebeurtenis meldt, niet om de som van een langere draaiing.
|
|
13
|
+
|
|
12
14
|
### Status opvragen
|
|
13
15
|
|
|
14
16
|
Geeft de huidige status van de schakelaar of knop uit zodra een `msg.payload`-object met de volgende inhoud aan de node is doorgegeven. U kunt ook op de knop in de Node-RED-interface drukken zonder eerst een bericht naar de node te sturen.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Lang indrukken beëindigd wanneer >",
|
|
25
25
|
"add-outputs-longpresswhile": "Lang indrukken (terwijl ingedrukt)",
|
|
26
26
|
"add-outputs-btn-addnew": "nieuw knoppenbereik toevoegen",
|
|
27
|
+
"add-outputs-rotation": "Rotatie ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Hoek tussen",
|
|
30
|
+
"add-outputs-rotation-range-to": "en",
|
|
27
31
|
"outputlabel-btn-from": "knop #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "knoppen #__from__ t/m #__to__",
|
|
29
33
|
"outputlabel-btn-on": "bij:",
|
|
30
34
|
"outputlabel-btn-startpress": "Begin van indrukken",
|
|
31
35
|
"outputlabel-btn-shortpress": "Kort indrukken beëindigd",
|
|
32
36
|
"outputlabel-btn-longpress": "Lang indrukken (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Lang indrukken (terwijl ingedrukt)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Lang indrukken (terwijl ingedrukt)",
|
|
38
|
+
"outputlabel-rotation": "draaiknopbeweging",
|
|
39
|
+
"outputlabel-rotation-range": "tussen __from__° en __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"not-configured": "niet geconfigureerd",
|
|
@@ -9,6 +9,8 @@ Jeśli nie wybierzesz przełącznika ani przycisku i użyjesz konfiguracji węz
|
|
|
9
9
|
|
|
10
10
|
W sekcji „Dodatkowe wyjścia” możesz dodać jedno wyjście na każdy zakres przycisków, z których każde jest wyzwalane przez określone działanie (początek naciśnięcia, koniec krótkiego naciśnięcia, koniec długiego naciśnięcia po osiągnięciu skonfigurowanego czasu trwania, lub cyklicznie podczas trwania długiego naciśnięcia). Pierwsze wyjście węzła nadal zawsze otrzymuje każde zdarzenie, tak jak dotychczas; dodatkowe wyjścia otrzymują kopię komunikatu tylko wtedy, gdy pasują zarówno zakres przycisków, jak i działanie.
|
|
11
11
|
|
|
12
|
+
Dla pokrętła Hue Tap Dial Switch wybierz w polu „Od” opcję „Obrót ↻” i podaj zakres kąta. Obroty przeciwnie do ruchu wskazówek zegara liczą się jako stopnie ujemne, a zgodnie z ruchem wskazówek jako dodatnie: od `0` do `360` obejmuje każdy obrót zgodny z ruchem wskazówek, od `-360` do `0` każdy obrót przeciwny, a od `-50` do `10` obrót przeciwny o maksymalnie 50° lub zgodny o maksymalnie 10°. Liczy się kąt, który pokrętło zgłasza w każdym pojedynczym zdarzeniu obrotu, a nie suma dłuższego obrotu.
|
|
13
|
+
|
|
12
14
|
### Odczyt stanu
|
|
13
15
|
|
|
14
16
|
Zwraca bieżący stan przełącznika lub przycisku, gdy tylko do węzła zostanie przekazany obiekt `msg.payload` o następującej zawartości. Możesz też nacisnąć przycisk w interfejsie Node-RED, bez wcześniejszego wysyłania komunikatu do węzła.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Koniec długiego naciśnięcia po >",
|
|
25
25
|
"add-outputs-longpresswhile": "Długie naciśnięcie (podczas trzymania)",
|
|
26
26
|
"add-outputs-btn-addnew": "dodaj nowy zakres przycisków",
|
|
27
|
+
"add-outputs-rotation": "Obrót ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Kąt między",
|
|
30
|
+
"add-outputs-rotation-range-to": "a",
|
|
27
31
|
"outputlabel-btn-from": "przycisk #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "przyciski #__from__ do #__to__",
|
|
29
33
|
"outputlabel-btn-on": "przy:",
|
|
30
34
|
"outputlabel-btn-startpress": "Początek naciśnięcia",
|
|
31
35
|
"outputlabel-btn-shortpress": "Koniec krótkiego naciśnięcia",
|
|
32
36
|
"outputlabel-btn-longpress": "Długie naciśnięcie (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Długie naciśnięcie (podczas trzymania)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Długie naciśnięcie (podczas trzymania)",
|
|
38
|
+
"outputlabel-rotation": "obrót pokrętła",
|
|
39
|
+
"outputlabel-rotation-range": "między __from__° a __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"not-configured": "nieskonfigurowany",
|
|
@@ -9,6 +9,8 @@ Se não selecionar nenhum interruptor ou botão e utilizar assim a configuraçã
|
|
|
9
9
|
|
|
10
10
|
Em «Saídas adicionais» pode adicionar uma saída por cada intervalo de botões, cada uma acionada por uma ação específica (início da pressão, fim de uma pressão curta, fim de uma pressão longa assim que esta tenha durado pelo menos a duração configurada, ou repetidamente enquanto uma pressão longa está em curso). A primeira saída do nó continua a receber sempre todos os eventos, tal como antes; as saídas adicionais só recebem uma cópia da mensagem quando o intervalo de botões e a ação correspondem.
|
|
11
11
|
|
|
12
|
+
Para a roda de um Hue Tap Dial Switch, escolha «Rotação ↻» em «De» e introduza um intervalo de ângulos. As rotações no sentido anti-horário contam como graus negativos e as rotações no sentido horário como positivos: de `0` a `360` apanha qualquer rotação horária, de `-360` a `0` qualquer rotação anti-horária, e de `-50` a `10` uma rotação anti-horária até 50° ou uma rotação horária até 10°. Conta o ângulo que a roda comunica em cada evento de rotação, não a soma de uma rotação mais longa.
|
|
13
|
+
|
|
12
14
|
### Consultar o estado
|
|
13
15
|
|
|
14
16
|
Emite o estado atual do interruptor ou botão assim que for transmitido ao nó um objeto `msg.payload` com o seguinte conteúdo. Em alternativa, também pode premir o botão na interface do Node-RED sem ter de enviar previamente uma mensagem ao nó.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Fim de pressão longa quando >",
|
|
25
25
|
"add-outputs-longpresswhile": "Pressão longa (enquanto premido)",
|
|
26
26
|
"add-outputs-btn-addnew": "adicionar novo intervalo de botões",
|
|
27
|
+
"add-outputs-rotation": "Rotação ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Ângulo entre",
|
|
30
|
+
"add-outputs-rotation-range-to": "e",
|
|
27
31
|
"outputlabel-btn-from": "botão #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "botões #__from__ a #__to__",
|
|
29
33
|
"outputlabel-btn-on": "em:",
|
|
30
34
|
"outputlabel-btn-startpress": "Início da pressão",
|
|
31
35
|
"outputlabel-btn-shortpress": "Fim de pressão curta",
|
|
32
36
|
"outputlabel-btn-longpress": "Pressão longa (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Pressão longa (enquanto premido)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Pressão longa (enquanto premido)",
|
|
38
|
+
"outputlabel-rotation": "rotação da roda",
|
|
39
|
+
"outputlabel-rotation-range": "entre __from__° e __to__°"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"not-configured": "não configurado",
|
|
@@ -9,6 +9,8 @@ Bir anahtar veya düğme seçmez ve düğüm yapılandırmasını bu şekilde ku
|
|
|
9
9
|
|
|
10
10
|
«Ek çıkışlar» altında her düğme aralığı için, belirli bir eylemle (basmanın başlangıcı, kısa basmanın sona ermesi, yapılandırılan süre kadar sürdükten sonra uzun basmanın sona ermesi veya uzun basma devam ederken tekrar tekrar) tetiklenen bir çıkış ekleyebilirsiniz. Düğümün ilk çıkışı öncekiyle aynı şekilde her zaman tüm olayları alır; ek çıkışlar yalnızca hem düğme aralığı hem de eylem eşleştiğinde mesajın bir kopyasını alır.
|
|
11
11
|
|
|
12
|
+
Bir Hue Tap Dial Switch'in çevirme düğmesi için «Başlangıç» altında «Döndürme ↻» seçeneğini seçin ve bir açı aralığı girin. Saat yönünün tersine döndürmeler negatif, saat yönündeki döndürmeler pozitif derece olarak sayılır: `0` ile `360` arası saat yönündeki her döndürmeyi, `-360` ile `0` arası saat yönünün tersine her döndürmeyi, `-50` ile `10` arası ise saat yönünün tersine en fazla 50° veya saat yönünde en fazla 10° döndürmeyi yakalar. Geçerli olan, düğmenin her bir döndürme olayında bildirdiği açıdır; daha uzun bir döndürmenin toplamı değildir.
|
|
13
|
+
|
|
12
14
|
### Durumu sorgulama
|
|
13
15
|
|
|
14
16
|
Düğüme aşağıdaki içeriğe sahip bir `msg.payload` nesnesi iletildiğinde anahtarın veya düğmenin güncel durumunu verir. Alternatif olarak, önce düğüme bir mesaj göndermeden Node-RED arayüzündeki düğmeye de basabilirsiniz.
|
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
"add-outputs-longpress": "Uzun basma sona erdiğinde >",
|
|
25
25
|
"add-outputs-longpresswhile": "Uzun basma (basılı tutulurken)",
|
|
26
26
|
"add-outputs-btn-addnew": "yeni düğme aralığı ekle",
|
|
27
|
+
"add-outputs-rotation": "Döndürme ↻",
|
|
28
|
+
"add-outputs-rotation-hint": "↺ −360 … 0 … 360 ↻",
|
|
29
|
+
"add-outputs-rotation-range": "Açı",
|
|
30
|
+
"add-outputs-rotation-range-to": "ile",
|
|
27
31
|
"outputlabel-btn-from": "düğme #__from__",
|
|
28
32
|
"outputlabel-btn-from-to": "düğmeler #__from__ - #__to__",
|
|
29
33
|
"outputlabel-btn-on": "şurada:",
|
|
30
34
|
"outputlabel-btn-startpress": "Basmanın başlangıcı",
|
|
31
35
|
"outputlabel-btn-shortpress": "Kısa basma sona erdi",
|
|
32
36
|
"outputlabel-btn-longpress": "Uzun basma (>__duration__s)",
|
|
33
|
-
"outputlabel-btn-longpresswhile": "Uzun basma (basılı tutulurken)"
|
|
37
|
+
"outputlabel-btn-longpresswhile": "Uzun basma (basılı tutulurken)",
|
|
38
|
+
"outputlabel-rotation": "çevirme hareketi",
|
|
39
|
+
"outputlabel-rotation-range": "__from__° ile __to__° arasında"
|
|
34
40
|
},
|
|
35
41
|
"node": {
|
|
36
42
|
"not-configured": "yapılandırılmadı",
|
|
@@ -674,13 +674,16 @@ class HueButtonsMessage
|
|
|
674
674
|
const connection = connectivity(resource);
|
|
675
675
|
const power = battery(resource);
|
|
676
676
|
|
|
677
|
+
// A LIVE EVENT ONLY REPORTS THE SERVICE THAT FIRED IT, A STATUS QUERY EVERYTHING STILL CACHED
|
|
678
|
+
const fired = function(type) { return (!options.updatedType || options.updatedType === type); };
|
|
679
|
+
|
|
677
680
|
// FIND PRESSED BUTTON (A DOORBELL BEHAVES EXACTLY LIKE ONE)
|
|
678
681
|
var pressedButton = false;
|
|
679
682
|
var isDoorbell = false;
|
|
680
683
|
|
|
681
684
|
for (const oneType of ["button", "bell_button"])
|
|
682
685
|
{
|
|
683
|
-
const allButtons = resource.services[oneType] ? Object.values(resource.services[oneType]) : [];
|
|
686
|
+
const allButtons = (fired(oneType) && resource.services[oneType]) ? Object.values(resource.services[oneType]) : [];
|
|
684
687
|
|
|
685
688
|
for (var i = allButtons.length - 1; i >= 0; i--)
|
|
686
689
|
{
|
|
@@ -697,7 +700,7 @@ class HueButtonsMessage
|
|
|
697
700
|
|
|
698
701
|
// FIND ROTATION (HUE TAP DIAL, LUTRON AURORA)
|
|
699
702
|
var rotaryDial = false;
|
|
700
|
-
const allRotaries = resource.services.relative_rotary ? Object.values(resource.services.relative_rotary) : [];
|
|
703
|
+
const allRotaries = (fired("relative_rotary") && resource.services.relative_rotary) ? Object.values(resource.services.relative_rotary) : [];
|
|
701
704
|
|
|
702
705
|
for (var r = allRotaries.length - 1; r >= 0; r--)
|
|
703
706
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-huemagic",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Philips Hue nodes to control bridges, lights, groups, scenes, rules, automations, buttons, switches, dials, doorbells, speakers, motion sensors, cameras, contact sensors, temperature sensors, light level sensors and the Hue Play HDMI Sync Box using Node-RED.",
|
|
5
5
|
"author": "foddy",
|
|
6
6
|
"homepage": "https://github.com/Foddy/node-red-contrib-huemagic",
|