node-red-contrib-huemagic 4.0.5 → 4.1.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/README.md CHANGED
@@ -142,7 +142,7 @@ If the "fetch" command has been used on the node, the bridge outputs the corresp
142
142
 
143
143
  #### Global status messages under `msg.updated` (optional)
144
144
 
145
- Unless deactivated, the node outputs an updated status message for each resource on the bridge. The status message under * msg.updated * follows the pattern of the respective resource and varies depending on the type of device that was last updated.
145
+ Unless deactivated, the node outputs an updated status message for each resource on the bridge. The status message under `msg.updated` follows the pattern of the respective resource and varies depending on the type of device that was last updated.
146
146
 
147
147
  #### Last command under `msg.command` (optional)
148
148
 
@@ -172,7 +172,7 @@ To play or stop an animation, pass an object with the following content to the n
172
172
  |--|--|
173
173
  | payload (boolean) | `true`, starts the animation, `false`, stops the animation |
174
174
 
175
- ### Own animations
175
+ ### Custom animations
176
176
 
177
177
  If you pass your own animation to the node, the preselected, pre-defined animation (if set) will be temporarily replaced by yours. Own HueMagic animations are a sequence of commands that have been combined in an array. Each array element forms a step - whereby a step can also consist of several frames (transition effects).
178
178
 
@@ -273,7 +273,7 @@ In addition to simply switching it on and off, there are also many other options
273
273
  | gradient (object {hex […]}) | An object with a supported color object (e.g. `hex`,` rgb`, ...) and several colors to set a gradient to supported lights |
274
274
  | mixColor (object) | A color to be mixed with the current light color. Can accept `color`, `hex`, `rgb` or `xyColor` objects and optionally `amount` (int) to indicate the mixing ratio in percent |
275
275
  | image (string) | Path of an image (local or on the web) to set the current color of the light to the average color of the image |
276
- | saturation (int) | percentage of the saturation of the current color (beta) |
276
+ | saturation (int) | Percentage of the saturation of the current color (beta) |
277
277
  | colorTemp (int / string) | Value between 153 and 500 to set the color temperature of the light or the values `cold`, `normal`, `warm`, `hot` and `auto` - where `auto` is the color temperature based on the current time |
278
278
  | incrementColorTemp (int / boolean) | Value by how much the color temperature should be warmer or `true` to make the color temperature warmer in steps of 50 |
279
279
  | decrementColorTemp (int / boolean) | Value by how much the color temperature should be colder or `true` to make the color temperature colder in steps of 50 |
@@ -796,7 +796,14 @@ If the status of the node has changed via a certain command, the entire command
796
796
 
797
797
  # Changelog
798
798
 
799
- ### v4.0.5 (latest)
799
+ ### v4.1.0 (latest)
800
+
801
+ * New queue worker throttles the number of parallel requests to the bridge to avoid 503 API limit errors (can be configured in the Bridge configuration)
802
+ * Resources are now alphabetically sorted in the node´s configuration inetrface ([#282](https://github.com/Foddy/node-red-contrib-huemagic/pull/282)) (thx)
803
+ * "Hue Bridghtness" node was optimized to output more accurate "dark" and "dayLight" values
804
+ * Several optimizations in the documentation of some nodes
805
+
806
+ ### v4.0.5
800
807
 
801
808
  * The "Hue Group" node now contains the "resources" information with all linked resources behind the group/zone
802
809
  * Fixed an issue that caused Node-RED to restart if a command was sent before a node was initialized
@@ -25,6 +25,10 @@
25
25
  </button>
26
26
  </div>
27
27
  </div>
28
+ <div class="form-row">
29
+ <label for="node-config-input-worker"><i class="fa fa-cogs"></i> <span>Worker</span></label>
30
+ <input type="text" id="node-config-input-worker" placeholder="10" style="width: calc(100% - 105px)">
31
+ </div>
28
32
  <div class="form-row" style="margin-top: 30px">
29
33
  <div style="display: inline-flex; width: calc(100% - 105px)">
30
34
  <input type="checkbox" id="node-input-autoupdates" style="flex: 15px;">
@@ -47,6 +51,9 @@
47
51
  name: { value:"Hue Bridge", required: true },
48
52
  bridge: { value:"", required: true },
49
53
  key: { value:"", required: true },
54
+ worker: { value: 10, required: true, validate:function(v) {
55
+ return (!isNaN(v) && v > 0)
56
+ }},
50
57
  autoupdates: { value: true },
51
58
  disableupdates: { value: false }
52
59
  },
@@ -9,6 +9,7 @@ module.exports = function(RED)
9
9
  const diff = require("deep-object-diff").diff;
10
10
  const axios = require('axios');
11
11
  const https = require('https');
12
+ const fastq = require('fastq');
12
13
 
13
14
  // READABLE RESOURCE MESSAGES
14
15
  const { HueBridgeMessage,
@@ -32,6 +33,7 @@ module.exports = function(RED)
32
33
  this.resourcesInGroups = {};
33
34
  this.lastStates = {};
34
35
  this.events = new events.EventEmitter();
36
+ this.patchQueue = null;
35
37
 
36
38
  // RESOURCE ID PATTERN
37
39
  this.validResourceID = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi;
@@ -435,24 +437,41 @@ module.exports = function(RED)
435
437
  {
436
438
  return new Promise(function(resolve, reject)
437
439
  {
438
- // GET SERVICE ID
439
- if(version !== 1 && scope.resources[id] && scope.resources[id]["services"] && scope.resources[id]["services"][type])
440
+ if(!scope.patchQueue) { return false; }
441
+ scope.patchQueue.push({ type: type, id: id, patch: patch, version: version }, function (error, response)
440
442
  {
441
- const targetResource = Object.values(scope.resources[id]["services"][type])[0];
442
- id = targetResource.id;
443
- }
444
-
445
- // ACTION!
446
- API.request({ config: config, method: "PUT", resource: (version === 2) ? (type+"/"+id) : id, data: patch, version: version })
447
- .then(function(response) {
448
- resolve(response);
449
- })
450
- .catch(function(error) {
451
- reject(error);
443
+ if(error)
444
+ {
445
+ reject(error);
446
+ }
447
+ else
448
+ {
449
+ resolve(response);
450
+ }
452
451
  });
453
452
  });
454
453
  }
455
454
 
455
+ // PATCH RESOURCE (WORKER) / 7 PROCESSES IN PARALLEL
456
+ this.patchQueue = fastq(function({ type, id, patch, version }, callback)
457
+ {
458
+ // GET SERVICE ID
459
+ if(version !== 1 && scope.resources[id] && scope.resources[id]["services"] && scope.resources[id]["services"][type])
460
+ {
461
+ const targetResource = Object.values(scope.resources[id]["services"][type])[0];
462
+ id = targetResource.id;
463
+ }
464
+
465
+ // ACTION!
466
+ API.request({ config: config, method: "PUT", resource: (version === 2) ? (type+"/"+id) : id, data: patch, version: version })
467
+ .then(function(response) {
468
+ callback(null, response);
469
+ })
470
+ .catch(function(error) {
471
+ callback(error, null);
472
+ });
473
+ }, config.worker ? parseInt(config.worker) : 10);
474
+
456
475
  // RE-FETCH RULE (RECEIVES NO UPDATES VIA SSE)
457
476
  this.refetchRule = function(id)
458
477
  {
@@ -546,8 +565,6 @@ module.exports = function(RED)
546
565
  if((config.autoupdates && config.autoupdates == true) || typeof config.autoupdates == 'undefined')
547
566
  {
548
567
  if(scope.firmwareUpdateTimeout !== null) { clearTimeout(scope.firmwareUpdateTimeout); };
549
-
550
- scope.log("Checking for Hue Bridge firmware updates…");
551
568
  API.request({
552
569
  config: config,
553
570
  method: "PUT",
@@ -564,15 +581,15 @@ module.exports = function(RED)
564
581
  {
565
582
  if(scope.nodeActive == true)
566
583
  {
567
- scope.firmwareUpdateTimeout = setTimeout(function(){ scope.autoUpdateFirmware(); }, 60000 * 180);
584
+ scope.firmwareUpdateTimeout = setTimeout(function(){ scope.autoUpdateFirmware(); }, 60000 * 720);
568
585
  }
569
586
  })
570
587
  .catch(function(error)
571
588
  {
572
- // NO UPDATES AVAILABLE // TRY AGAIN IN 3H
589
+ // NO UPDATES AVAILABLE // TRY AGAIN IN 12H
573
590
  if(scope.nodeActive == true)
574
591
  {
575
- scope.firmwareUpdateTimeout = setTimeout(function(){ scope.autoUpdateFirmware(); }, 60000 * 180);
592
+ scope.firmwareUpdateTimeout = setTimeout(function(){ scope.autoUpdateFirmware(); }, 60000 * 720);
576
593
  }
577
594
  });
578
595
  }
@@ -597,6 +614,9 @@ module.exports = function(RED)
597
614
 
598
615
  // REMOVE FIRMWARE UPDATE TIMEOUT
599
616
  if(scope.firmwareUpdateTimeout !== null) { clearTimeout(scope.firmwareUpdateTimeout); }
617
+
618
+ // KILL QUEUE
619
+ scope.patchQueue.kill();
600
620
  });
601
621
  }
602
622
 
@@ -81,6 +81,19 @@
81
81
  buttonIcon.removeClass("fa-pencil");
82
82
  buttonIcon.addClass("fa-search");
83
83
  }
84
+
85
+ function sortResourcesBy(prop, resources)
86
+ {
87
+ return resources.sort((a, b) => {
88
+ if ( a[prop] < b[prop] ){
89
+ return -1;
90
+ }
91
+ if ( a[prop] > b[prop] ){
92
+ return 1;
93
+ }
94
+ return 0;
95
+ });
96
+ }
84
97
 
85
98
  function searchAndSelect()
86
99
  {
@@ -98,6 +111,7 @@
98
111
  $.get('hue/resources', { bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "motion" })
99
112
  .done( function(data) {
100
113
  var allResources = JSON.parse(data);
114
+ allResources = sortResourcesBy('name', allResources);
101
115
  if(allResources.length <= 0)
102
116
  {
103
117
  notification.close();
@@ -194,4 +208,4 @@
194
208
  }
195
209
  }
196
210
  });
197
- </script>
211
+ </script>
@@ -116,7 +116,7 @@ module.exports = function(RED)
116
116
  let currentState = bridge.get("light_level", tempSensorID);
117
117
  if(!currentState)
118
118
  {
119
- scope.error("The sensor in not yet available. Please wait for the bridge to connect before sending any command.");
119
+ scope.error("The sensor in not yet available. Please wait until HueMagic has established a connection with the bridge or check whether the resource ID in the configuration is valid..");
120
120
  return false;
121
121
  }
122
122
 
@@ -81,6 +81,19 @@
81
81
  buttonIcon.removeClass("fa-pencil");
82
82
  buttonIcon.addClass("fa-search");
83
83
  }
84
+
85
+ function sortResourcesBy(prop, resources)
86
+ {
87
+ return resources.sort((a, b) => {
88
+ if ( a[prop] < b[prop] ){
89
+ return -1;
90
+ }
91
+ if ( a[prop] > b[prop] ){
92
+ return 1;
93
+ }
94
+ return 0;
95
+ });
96
+ }
84
97
 
85
98
  function searchAndSelect()
86
99
  {
@@ -98,6 +111,7 @@
98
111
  $.get('hue/resources', { bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "button" })
99
112
  .done( function(data) {
100
113
  var allResources = JSON.parse(data);
114
+ allResources = sortResourcesBy('name', allResources);
101
115
  if(allResources.length <= 0)
102
116
  {
103
117
  notification.close();
@@ -42,11 +42,6 @@ module.exports = function(RED)
42
42
  bridge.subscribe("button", config.sensorid, function(info)
43
43
  {
44
44
  let currentState = bridge.get("button", info.id);
45
- if(!currentState)
46
- {
47
- scope.error("The button/switch in not yet available. Please wait for the bridge to connect before sending any command.");
48
- return false;
49
- }
50
45
 
51
46
  // RESOURCE FOUND?
52
47
  if(currentState !== false)
@@ -137,6 +132,11 @@ module.exports = function(RED)
137
132
  }
138
133
 
139
134
  let currentState = bridge.get("button", tempSensorID);
135
+ if(!currentState)
136
+ {
137
+ scope.error("The button/switch in not yet available. Please wait until HueMagic has established a connection with the bridge or check whether the resource ID in the configuration is valid..");
138
+ return false;
139
+ }
140
140
 
141
141
  // GET CURRENT STATE
142
142
  if( (typeof msg.payload != 'undefined' && typeof msg.payload.status != 'undefined') || (typeof msg.__user_inject_props__ != 'undefined' && msg.__user_inject_props__ == "status") )
@@ -81,6 +81,19 @@
81
81
  buttonIcon.removeClass("fa-pencil");
82
82
  buttonIcon.addClass("fa-search");
83
83
  }
84
+
85
+ function sortResourcesBy(prop, resources)
86
+ {
87
+ return resources.sort((a, b) => {
88
+ if ( a[prop] < b[prop] ){
89
+ return -1;
90
+ }
91
+ if ( a[prop] > b[prop] ){
92
+ return 1;
93
+ }
94
+ return 0;
95
+ });
96
+ }
84
97
 
85
98
  function searchAndSelect()
86
99
  {
@@ -98,6 +111,7 @@
98
111
  $.get('hue/resources', { bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "group" })
99
112
  .done( function(data) {
100
113
  var allResources = JSON.parse(data);
114
+ allResources = sortResourcesBy('name', allResources);
101
115
  if(allResources.length <= 0)
102
116
  {
103
117
  notification.close();
@@ -205,4 +219,4 @@
205
219
  }
206
220
  }
207
221
  });
208
- </script>
222
+ </script>
@@ -112,7 +112,7 @@ module.exports = function(RED)
112
112
  let currentState = bridge.get("group", tempGroupID, { colornames: config.colornamer ? true : false });
113
113
  if(!currentState)
114
114
  {
115
- scope.error("The group in not yet available. Please wait for the bridge to connect before sending any command.");
115
+ scope.error("The group in not yet available. Please wait until HueMagic has established a connection with the bridge or check whether the resource ID in the configuration is valid..");
116
116
  return false;
117
117
  }
118
118
 
@@ -88,6 +88,19 @@
88
88
  buttonIcon.removeClass("fa-pencil");
89
89
  buttonIcon.addClass("fa-search");
90
90
  }
91
+
92
+ function sortResourcesBy(prop, resources)
93
+ {
94
+ return resources.sort((a, b) => {
95
+ if ( a[prop] < b[prop] ){
96
+ return -1;
97
+ }
98
+ if ( a[prop] > b[prop] ){
99
+ return 1;
100
+ }
101
+ return 0;
102
+ });
103
+ }
91
104
 
92
105
  function searchAndSelect()
93
106
  {
@@ -105,6 +118,7 @@
105
118
  $.get('hue/resources', { bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "light" })
106
119
  .done( function(data) {
107
120
  var allResources = JSON.parse(data);
121
+ allResources = sortResourcesBy('name', allResources);
108
122
  if(allResources.length <= 0)
109
123
  {
110
124
  notification.close();
@@ -201,4 +215,4 @@
201
215
  }
202
216
  }
203
217
  });
204
- </script>
218
+ </script>
@@ -125,7 +125,7 @@ module.exports = function(RED)
125
125
  let currentState = bridge.get("light", tempLightID, { colornames: config.colornamer ? true : false });
126
126
  if(!currentState)
127
127
  {
128
- scope.error("The light in not yet available. Please wait for the bridge to connect before sending any command.");
128
+ scope.error("The light in not yet available. Please wait until HueMagic has established a connection with the bridge or check whether the resource ID in the configuration is valid..");
129
129
  return false;
130
130
  }
131
131
 
@@ -81,6 +81,19 @@
81
81
  buttonIcon.removeClass("fa-pencil");
82
82
  buttonIcon.addClass("fa-search");
83
83
  }
84
+
85
+ function sortResourcesBy(prop, resources)
86
+ {
87
+ return resources.sort((a, b) => {
88
+ if ( a[prop] < b[prop] ){
89
+ return -1;
90
+ }
91
+ if ( a[prop] > b[prop] ){
92
+ return 1;
93
+ }
94
+ return 0;
95
+ });
96
+ }
84
97
 
85
98
  function searchAndSelect()
86
99
  {
@@ -98,6 +111,7 @@
98
111
  $.get('hue/resources', { bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "motion" })
99
112
  .done( function(data) {
100
113
  var allResources = JSON.parse(data);
114
+ allResources = sortResourcesBy('name', allResources);
101
115
  if(allResources.length <= 0)
102
116
  {
103
117
  notification.close();
@@ -194,4 +208,4 @@
194
208
  }
195
209
  }
196
210
  });
197
- </script>
211
+ </script>
@@ -110,7 +110,7 @@ module.exports = function(RED)
110
110
  let currentState = bridge.get("motion", tempSensorID);
111
111
  if(!currentState)
112
112
  {
113
- scope.error("The sensor in not yet available. Please wait for the bridge to connect before sending any command.");
113
+ scope.error("The sensor in not yet available. Please wait until HueMagic has established a connection with the bridge or check whether the resource ID in the configuration is valid..");
114
114
  return false;
115
115
  }
116
116
 
@@ -81,6 +81,19 @@
81
81
  buttonIcon.removeClass("fa-pencil");
82
82
  buttonIcon.addClass("fa-search");
83
83
  }
84
+
85
+ function sortResourcesBy(prop, resources)
86
+ {
87
+ return resources.sort((a, b) => {
88
+ if ( a[prop] < b[prop] ){
89
+ return -1;
90
+ }
91
+ if ( a[prop] > b[prop] ){
92
+ return 1;
93
+ }
94
+ return 0;
95
+ });
96
+ }
84
97
 
85
98
  function searchAndSelect()
86
99
  {
@@ -98,6 +111,7 @@
98
111
  $.get('hue/resources', { bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "rule" })
99
112
  .done( function(data) {
100
113
  var allResources = JSON.parse(data);
114
+ allResources = sortResourcesBy('name', allResources);
101
115
  if(allResources.length <= 0)
102
116
  {
103
117
  notification.close();
@@ -187,4 +201,4 @@
187
201
  }
188
202
  }
189
203
  });
190
- </script>
204
+ </script>
@@ -100,7 +100,7 @@ module.exports = function(RED)
100
100
  let currentState = bridge.get("rule", "rule_" + tempRuleID);
101
101
  if(!currentState)
102
102
  {
103
- scope.error("The rule in not yet available. Please wait for the bridge to connect before sending any command.");
103
+ scope.error("The rule in not yet available. Please wait until HueMagic has established a connection with the bridge or check whether the resource ID in the configuration is valid..");
104
104
  return false;
105
105
  }
106
106
 
@@ -67,6 +67,19 @@
67
67
  buttonIcon.removeClass("fa-pencil");
68
68
  buttonIcon.addClass("fa-search");
69
69
  }
70
+
71
+ function sortResourcesBy(prop, resources)
72
+ {
73
+ return resources.sort((a, b) => {
74
+ if ( a[prop] < b[prop] ){
75
+ return -1;
76
+ }
77
+ if ( a[prop] > b[prop] ){
78
+ return 1;
79
+ }
80
+ return 0;
81
+ });
82
+ }
70
83
 
71
84
  function searchAndSelectScenes()
72
85
  {
@@ -84,6 +97,7 @@
84
97
  $.get('hue/resources', { bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "scene" })
85
98
  .done( function(data) {
86
99
  var allResources = JSON.parse(data);
100
+ allResources = sortResourcesBy('name', allResources);
87
101
  if(allResources.length <= 0)
88
102
  {
89
103
  notification.close();
@@ -167,4 +181,4 @@
167
181
  }
168
182
  }
169
183
  });
170
- </script>
184
+ </script>
@@ -81,6 +81,19 @@
81
81
  buttonIcon.removeClass("fa-pencil");
82
82
  buttonIcon.addClass("fa-search");
83
83
  }
84
+
85
+ function sortResourcesBy(prop, resources)
86
+ {
87
+ return resources.sort((a, b) => {
88
+ if ( a[prop] < b[prop] ){
89
+ return -1;
90
+ }
91
+ if ( a[prop] > b[prop] ){
92
+ return 1;
93
+ }
94
+ return 0;
95
+ });
96
+ }
84
97
 
85
98
  function searchAndSelect()
86
99
  {
@@ -98,6 +111,7 @@
98
111
  $.get('hue/resources', { bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "temperature" })
99
112
  .done( function(data) {
100
113
  var allResources = JSON.parse(data);
114
+ allResources = sortResourcesBy('name', allResources);
101
115
  if(allResources.length <= 0)
102
116
  {
103
117
  notification.close();
@@ -194,4 +208,4 @@
194
208
  }
195
209
  }
196
210
  });
197
- </script>
211
+ </script>
@@ -39,11 +39,6 @@ module.exports = function(RED)
39
39
  bridge.subscribe("temperature", config.sensorid, function(info)
40
40
  {
41
41
  let currentState = bridge.get("temperature", info.id);
42
- if(!currentState)
43
- {
44
- scope.error("The sensor in not yet available. Please wait for the bridge to connect before sending any command.");
45
- return false;
46
- }
47
42
 
48
43
  // RESOURCE FOUND?
49
44
  if(currentState !== false)
@@ -121,6 +116,11 @@ module.exports = function(RED)
121
116
  }
122
117
 
123
118
  let currentState = bridge.get("temperature", tempSensorID);
119
+ if(!currentState)
120
+ {
121
+ scope.error("The sensor in not yet available. Please wait until HueMagic has established a connection with the bridge or check whether the resource ID in the configuration is valid..");
122
+ return false;
123
+ }
124
124
 
125
125
  // GET CURRENT STATE
126
126
  if( (typeof msg.payload != 'undefined' && typeof msg.payload.status != 'undefined') || (typeof msg.__user_inject_props__ != 'undefined' && msg.__user_inject_props__ == "status") )
@@ -13,6 +13,14 @@ Geben Sie die Hue Bridge-IP-Adresse manuell ein oder drücken Sie den Button, um
13
13
 
14
14
  Geben Sie den Hue Bridge API-Schlüssel manuell ein oder drücken Sie den Button, um einen neuen Schlüssel zu erstellen. Wenn Sie einen neuen Schlüssel erstellen möchten, müssen Sie innerhalb des Zeitfensters von 20 Sekunden den physischen Button der Bridge betätigen, um den Prozess abzuschließen.
15
15
 
16
+ ### Worker
17
+
18
+ Der "Worker"-Wert bestimmt die Anzahl der parallelen Befehle, die HueMagic an die Bridge gleichzeitig schicken darf. Laut offizieller Dokumentation der Philips Hue Bridge, sollten nicht mehr als 10 Befehle pro Sekunde abgeschickt werden, da sonst die Gefahr besteht, dass die Bridge die Anfragen nicht so schnell verarbeiten kann und Fehler auswirft.
19
+
20
+ Wenn mehr Befehle gleichzeitig abgeschickt werden als der hier gesetzte Wert, wird HueMagic die Befehle nacheinander ausführen, sobald der Durchsatz wieder möglich ist.
21
+
22
+ Setzen Sie hier einen Wert unter 10 (z. B. 4 bis 7), wenn Sie auch außerhalb von HueMagic Befehle an die Bridge senden, um den von Philips Hue empfohlenen Durchsatz an Befehlen / Sekunde einzuhalten.
23
+
16
24
  ### Automatische Firmware-Updates
17
25
 
18
26
  HueMagic prüft periodisch nach verfügbaren Philips Hue Firmware Updates und installiert sie automatisch, wenn sie verfügbar sind. Sie können dieses Verhalten deaktivieren, indem Sie die entsprechende Checkbox anklicken.
@@ -13,6 +13,14 @@ Enter the Hue Bridge IP address manually or press the button to call up all loca
13
13
 
14
14
  Enter the Hue Bridge API key manually or press the button to create a new key. If you want to create a new key, you have to press the physical button of the bridge within the time window of 20 seconds to complete the process.
15
15
 
16
+ ### Worker
17
+
18
+ The "Worker" value determines the number of parallel commands that HueMagic is allowed to send to the bridge at the same time. According to the official documentation of the Philips Hue bridge, no more than 10 commands should be sent per second, otherwise there is a risk that the bridge will not be able to process the requests as quickly and will throw errors.
19
+
20
+ If more commands are sent at the same time than the value set here, HueMagic will execute the commands in sequence as soon as throughput is possible again.
21
+
22
+ Set this to a value below 10 (e.g. 4 to 7) if you also send commands to the bridge outside of HueMagic in order to comply with the Philips Hue recommended throughput of commands/second.
23
+
16
24
  ### Automatic firmware updates
17
25
 
18
26
  HueMagic periodically checks for available Philips Hue firmware updates and automatically installs them when they are available. You can deactivate this behavior by clicking the corresponding checkbox.
@@ -79,7 +79,7 @@ If the "fetch" command has been used on the node, the bridge outputs the corresp
79
79
 
80
80
  #### Global status messages under `msg.updated` (optional)
81
81
 
82
- Unless deactivated, the node outputs an updated status message for each resource on the bridge. The status message under * msg.updated * follows the pattern of the respective resource and varies depending on the type of device that was last updated.
82
+ Unless deactivated, the node outputs an updated status message for each resource on the bridge. The status message under `msg.updated` follows the pattern of the respective resource and varies depending on the type of device that was last updated.
83
83
 
84
84
  #### Last command under `msg.command` (optional)
85
85
 
@@ -38,7 +38,7 @@ In addition to simply switching it on and off, there are also many other options
38
38
  : gradient (object {hex […]}): An object with a supported color object (e.g. `hex`,` rgb`, ...) and several colors to set a gradient to supported lights
39
39
  : mixColor (object): A color to be mixed with the current light color. Can accept `color`, `hex`, `rgb` or `xyColor` objects and optionally `amount` (int) to indicate the mixing ratio in percent
40
40
  : image (string): Path of an image (local or on the web) to set the current color of the light to the average color of the image
41
- : saturation (int): percentage of the saturation of the current color (beta)
41
+ : saturation (int): Percentage of the saturation of the current color (beta)
42
42
  : colorTemp (int | string): Value between 153 and 500 to set the color temperature of the light or the values `cold`, `normal`, `warm`, `hot` and `auto` - where `auto` is the color temperature based on the current time
43
43
  : incrementColorTemp (int | boolean): Value by how much the color temperature should be warmer or `true` to make the color temperature warmer in steps of 50
44
44
  : decrementColorTemp (int | boolean): Value by how much the color temperature should be colder or `true` to make the color temperature colder in steps of 50
@@ -13,7 +13,7 @@ To play or stop an animation, pass an object with the following content to the n
13
13
 
14
14
  : payload (boolean): `true`, starts the animation, `false`, stops the animation
15
15
 
16
- ### Own animations
16
+ ### Custom animations
17
17
 
18
18
  If you pass your own animation to the node, the preselected, pre-defined animation (if set) will be temporarily replaced by yours. Own HueMagic animations are a sequence of commands that have been combined in an array. Each array element forms a step - whereby a step can also consist of several frames (transition effects).
19
19
 
@@ -80,8 +80,8 @@ class HueBrightnessMessage
80
80
  this.message.payload.connectionStatus = connectivity ? connectivity.status : "unknown"; // NEW!
81
81
  this.message.payload.lux = realLUX;
82
82
  this.message.payload.lightLevel = service.light.light_level;
83
- this.message.payload.dark = (realLUX < 200);
84
- this.message.payload.daylight = (realLUX > 200);
83
+ this.message.payload.dark = (realLUX < 90);
84
+ this.message.payload.daylight = (realLUX >= 90);
85
85
  this.message.payload.updated = resource.updated;
86
86
 
87
87
  this.message.info = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-huemagic",
3
- "version": "4.0.5",
3
+ "version": "4.1.0",
4
4
  "description": "Philips Hue node to control bridges, lights, groups, scenes, rules, taps, switches, buttons, motion sensors, temperature sensors and Lux sensors using Node-RED.",
5
5
  "author": "foddy",
6
6
  "homepage": "https://github.com/Foddy/node-red-contrib-huemagic",
@@ -52,6 +52,7 @@
52
52
  "dayjs": "^1.10.7",
53
53
  "deep-object-diff": "^1.1.0",
54
54
  "eventsource": "^1.1.0",
55
+ "fastq": "^1.13.0",
55
56
  "get-image-colors": "^4.0.0"
56
57
  }
57
58
  }