node-red-contrib-huemagic 4.0.5 → 4.2.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 +70 -1
- package/README.md +21 -13
- package/huemagic/hue-bridge-config.html +7 -0
- package/huemagic/hue-bridge-config.js +168 -88
- package/huemagic/hue-brightness.html +15 -1
- package/huemagic/hue-brightness.js +26 -4
- package/huemagic/hue-buttons.html +14 -0
- package/huemagic/hue-buttons.js +5 -5
- package/huemagic/hue-group.html +15 -1
- package/huemagic/hue-group.js +149 -56
- package/huemagic/hue-light.html +15 -1
- package/huemagic/hue-light.js +192 -72
- package/huemagic/hue-motion.html +15 -1
- package/huemagic/hue-motion.js +27 -5
- package/huemagic/hue-rules.html +15 -1
- package/huemagic/hue-rules.js +26 -7
- package/huemagic/hue-scene.html +15 -1
- package/huemagic/hue-scene.js +62 -16
- package/huemagic/hue-temperature.html +15 -1
- package/huemagic/hue-temperature.js +30 -8
- package/huemagic/locales/de/hue-bridge-config.html +8 -0
- package/huemagic/locales/en-US/hue-bridge-config.html +8 -0
- package/huemagic/locales/en-US/hue-bridge.html +1 -1
- package/huemagic/locales/en-US/hue-light.html +1 -1
- package/huemagic/locales/en-US/hue-magic.html +1 -1
- package/huemagic/utils/api.js +3 -10
- package/huemagic/utils/messages.js +54 -52
- package/package.json +8 -3
package/huemagic/hue-motion.js
CHANGED
|
@@ -8,6 +8,7 @@ module.exports = function(RED)
|
|
|
8
8
|
|
|
9
9
|
const scope = this;
|
|
10
10
|
const bridge = RED.nodes.getNode(config.bridge);
|
|
11
|
+
const async = require('async');
|
|
11
12
|
|
|
12
13
|
// SAVE LAST COMMAND
|
|
13
14
|
this.lastCommand = null;
|
|
@@ -110,7 +111,7 @@ module.exports = function(RED)
|
|
|
110
111
|
let currentState = bridge.get("motion", tempSensorID);
|
|
111
112
|
if(!currentState)
|
|
112
113
|
{
|
|
113
|
-
scope.error("The sensor in not yet available. Please wait
|
|
114
|
+
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
115
|
return false;
|
|
115
116
|
}
|
|
116
117
|
|
|
@@ -151,9 +152,30 @@ module.exports = function(RED)
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
// PATCH!
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
async.retry({
|
|
156
|
+
times: 3,
|
|
157
|
+
errorFilter: function(err) {
|
|
158
|
+
return (err.status == 503);
|
|
159
|
+
},
|
|
160
|
+
interval: function(retryCount) { return retryCount*2000; }
|
|
161
|
+
},
|
|
162
|
+
function(callback, results)
|
|
163
|
+
{
|
|
164
|
+
bridge.patch("motion", tempSensorID, patchObject)
|
|
165
|
+
.then(function() { if(done) { callback(null, true); }})
|
|
166
|
+
.catch(function(errors) { callback(errors, null); });
|
|
167
|
+
},
|
|
168
|
+
function(errors, success)
|
|
169
|
+
{
|
|
170
|
+
if(errors)
|
|
171
|
+
{
|
|
172
|
+
scope.error(errors);
|
|
173
|
+
}
|
|
174
|
+
else if(done)
|
|
175
|
+
{
|
|
176
|
+
done();
|
|
177
|
+
}
|
|
178
|
+
});
|
|
157
179
|
}
|
|
158
180
|
else
|
|
159
181
|
{
|
|
@@ -175,4 +197,4 @@ module.exports = function(RED)
|
|
|
175
197
|
}
|
|
176
198
|
|
|
177
199
|
RED.nodes.registerType("hue-motion", HueMotion);
|
|
178
|
-
}
|
|
200
|
+
}
|
package/huemagic/hue-rules.html
CHANGED
|
@@ -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>
|
package/huemagic/hue-rules.js
CHANGED
|
@@ -8,6 +8,7 @@ module.exports = function(RED)
|
|
|
8
8
|
|
|
9
9
|
const scope = this;
|
|
10
10
|
const bridge = RED.nodes.getNode(config.bridge);
|
|
11
|
+
const async = require('async');
|
|
11
12
|
|
|
12
13
|
// SAVE LAST COMMAND
|
|
13
14
|
this.lastCommand = null;
|
|
@@ -100,7 +101,7 @@ module.exports = function(RED)
|
|
|
100
101
|
let currentState = bridge.get("rule", "rule_" + tempRuleID);
|
|
101
102
|
if(!currentState)
|
|
102
103
|
{
|
|
103
|
-
scope.error("The rule in not yet available. Please wait
|
|
104
|
+
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
105
|
return false;
|
|
105
106
|
}
|
|
106
107
|
|
|
@@ -111,12 +112,30 @@ module.exports = function(RED)
|
|
|
111
112
|
patchObject["status"] = (msg.payload == true) ? 'enabled' : 'disabled';
|
|
112
113
|
|
|
113
114
|
// PATCH!
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
async.retry({
|
|
116
|
+
times: 3,
|
|
117
|
+
errorFilter: function(err) {
|
|
118
|
+
return (err.status == 503);
|
|
119
|
+
},
|
|
120
|
+
interval: function(retryCount) { return retryCount*2000; }
|
|
121
|
+
},
|
|
122
|
+
function(callback, results)
|
|
123
|
+
{
|
|
124
|
+
bridge.patch("rules", "/rules/"+tempRuleID, patchObject, 1)
|
|
125
|
+
.then(function(response) { bridge.refetchRule(tempRuleID); callback(null, true); })
|
|
126
|
+
.catch(function(errors) { callback(errors, null); });
|
|
127
|
+
},
|
|
128
|
+
function(errors, success)
|
|
129
|
+
{
|
|
130
|
+
if(errors)
|
|
131
|
+
{
|
|
132
|
+
scope.error(errors);
|
|
133
|
+
}
|
|
134
|
+
else if(done)
|
|
135
|
+
{
|
|
136
|
+
done();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
120
139
|
}
|
|
121
140
|
else
|
|
122
141
|
{
|
package/huemagic/hue-scene.html
CHANGED
|
@@ -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>
|
package/huemagic/hue-scene.js
CHANGED
|
@@ -8,6 +8,7 @@ module.exports = function(RED)
|
|
|
8
8
|
|
|
9
9
|
const scope = this;
|
|
10
10
|
const bridge = RED.nodes.getNode(config.bridge);
|
|
11
|
+
const async = require('async');
|
|
11
12
|
|
|
12
13
|
// GET TARGET WIRED GROUPS
|
|
13
14
|
this.targetGroups = {};
|
|
@@ -72,9 +73,32 @@ module.exports = function(RED)
|
|
|
72
73
|
|
|
73
74
|
if(targetGroup)
|
|
74
75
|
{
|
|
75
|
-
|
|
76
|
-
.
|
|
77
|
-
|
|
76
|
+
// PATCH!
|
|
77
|
+
async.retry({
|
|
78
|
+
times: 3,
|
|
79
|
+
errorFilter: function(err) {
|
|
80
|
+
return (err.status == 503);
|
|
81
|
+
},
|
|
82
|
+
interval: function(retryCount) { return retryCount*2000; }
|
|
83
|
+
},
|
|
84
|
+
function(callback, results)
|
|
85
|
+
{
|
|
86
|
+
bridge.patch("group", targetGroup.info.idV1 + "/action", { "scene": targetSceneID }, 1)
|
|
87
|
+
.then(function() { callback(null, true); })
|
|
88
|
+
.catch(function(errors) {
|
|
89
|
+
callback(errors, null);
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
function(errors, success)
|
|
93
|
+
{
|
|
94
|
+
if(errors)
|
|
95
|
+
{
|
|
96
|
+
scope.error(errors);
|
|
97
|
+
}
|
|
98
|
+
else if(done)
|
|
99
|
+
{
|
|
100
|
+
done();
|
|
101
|
+
}
|
|
78
102
|
});
|
|
79
103
|
}
|
|
80
104
|
}
|
|
@@ -87,27 +111,49 @@ module.exports = function(RED)
|
|
|
87
111
|
else
|
|
88
112
|
{
|
|
89
113
|
// RECALL SCENE
|
|
90
|
-
patchObject["recall"] = {
|
|
114
|
+
patchObject["recall"] = { action: "active" };
|
|
91
115
|
|
|
92
116
|
// CHANGE NODE UI STATE
|
|
93
117
|
scope.status({fill: "grey", shape: "ring", text: "hue-scene.node.command"});
|
|
94
118
|
|
|
95
119
|
// PATCH!
|
|
96
|
-
|
|
97
|
-
|
|
120
|
+
async.retry({
|
|
121
|
+
times: 3,
|
|
122
|
+
errorFilter: function(err) {
|
|
123
|
+
return (err.status == 503);
|
|
124
|
+
},
|
|
125
|
+
interval: function(retryCount) { return retryCount*2000; }
|
|
126
|
+
},
|
|
127
|
+
function(callback, results)
|
|
98
128
|
{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
129
|
+
bridge.patch("scene", sceneDef, patchObject)
|
|
130
|
+
.then(function()
|
|
131
|
+
{
|
|
132
|
+
scope.status({fill: "blue", shape: "dot", text: "hue-scene.node.recalled"});
|
|
133
|
+
|
|
134
|
+
// RESET STATUS AFTER 1 SECOND
|
|
135
|
+
setTimeout(function() {
|
|
136
|
+
scope.status({});
|
|
137
|
+
}, 1000);
|
|
138
|
+
|
|
139
|
+
callback(null, true);
|
|
140
|
+
})
|
|
141
|
+
.catch(function(errors) { callback(errors, null); });
|
|
142
|
+
},
|
|
143
|
+
function(errors, success)
|
|
144
|
+
{
|
|
145
|
+
if(errors)
|
|
146
|
+
{
|
|
147
|
+
scope.error(errors);
|
|
148
|
+
}
|
|
149
|
+
else if(done)
|
|
150
|
+
{
|
|
151
|
+
done();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
108
154
|
}
|
|
109
155
|
});
|
|
110
156
|
}
|
|
111
157
|
|
|
112
158
|
RED.nodes.registerType("hue-scene", HueScene);
|
|
113
|
-
}
|
|
159
|
+
}
|
|
@@ -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>
|
|
@@ -8,6 +8,7 @@ module.exports = function(RED)
|
|
|
8
8
|
|
|
9
9
|
const scope = this;
|
|
10
10
|
const bridge = RED.nodes.getNode(config.bridge);
|
|
11
|
+
const async = require('async');
|
|
11
12
|
|
|
12
13
|
// SAVE LAST COMMAND
|
|
13
14
|
this.lastCommand = null;
|
|
@@ -39,11 +40,6 @@ module.exports = function(RED)
|
|
|
39
40
|
bridge.subscribe("temperature", config.sensorid, function(info)
|
|
40
41
|
{
|
|
41
42
|
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
43
|
|
|
48
44
|
// RESOURCE FOUND?
|
|
49
45
|
if(currentState !== false)
|
|
@@ -121,6 +117,11 @@ module.exports = function(RED)
|
|
|
121
117
|
}
|
|
122
118
|
|
|
123
119
|
let currentState = bridge.get("temperature", tempSensorID);
|
|
120
|
+
if(!currentState)
|
|
121
|
+
{
|
|
122
|
+
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.");
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
124
125
|
|
|
125
126
|
// GET CURRENT STATE
|
|
126
127
|
if( (typeof msg.payload != 'undefined' && typeof msg.payload.status != 'undefined') || (typeof msg.__user_inject_props__ != 'undefined' && msg.__user_inject_props__ == "status") )
|
|
@@ -159,9 +160,30 @@ module.exports = function(RED)
|
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
// PATCH!
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
async.retry({
|
|
164
|
+
times: 3,
|
|
165
|
+
errorFilter: function(err) {
|
|
166
|
+
return (err.status == 503);
|
|
167
|
+
},
|
|
168
|
+
interval: function(retryCount) { return retryCount*2000; }
|
|
169
|
+
},
|
|
170
|
+
function(callback, results)
|
|
171
|
+
{
|
|
172
|
+
bridge.patch("temperature", tempSensorID, patchObject)
|
|
173
|
+
.then(function() { callback(null, true); })
|
|
174
|
+
.catch(function(errors) { callback(errors, null); });
|
|
175
|
+
},
|
|
176
|
+
function(errors, success)
|
|
177
|
+
{
|
|
178
|
+
if(errors)
|
|
179
|
+
{
|
|
180
|
+
scope.error(errors);
|
|
181
|
+
}
|
|
182
|
+
else if(done)
|
|
183
|
+
{
|
|
184
|
+
done();
|
|
185
|
+
}
|
|
186
|
+
});
|
|
165
187
|
}
|
|
166
188
|
else
|
|
167
189
|
{
|
|
@@ -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
|
|
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):
|
|
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
|
-
###
|
|
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
|
|
package/huemagic/utils/api.js
CHANGED
|
@@ -90,14 +90,7 @@ function API()
|
|
|
90
90
|
{
|
|
91
91
|
if(version === 2)
|
|
92
92
|
{
|
|
93
|
-
|
|
94
|
-
{
|
|
95
|
-
reject(response.data.errors);
|
|
96
|
-
}
|
|
97
|
-
else
|
|
98
|
-
{
|
|
99
|
-
resolve(response.data.data);
|
|
100
|
-
}
|
|
93
|
+
resolve(response.data.data);
|
|
101
94
|
}
|
|
102
95
|
else if(version === 1)
|
|
103
96
|
{
|
|
@@ -106,7 +99,7 @@ function API()
|
|
|
106
99
|
})
|
|
107
100
|
.catch(function(error)
|
|
108
101
|
{
|
|
109
|
-
reject(error);
|
|
102
|
+
reject({ status: error.response.status, errors: error.response.data.errors ? error.response.data.errors : error.response.data});
|
|
110
103
|
});
|
|
111
104
|
});
|
|
112
105
|
}
|
|
@@ -154,7 +147,7 @@ function API()
|
|
|
154
147
|
// ERROR? -> RETRY?
|
|
155
148
|
scope.events[config.id].onerror = function(error)
|
|
156
149
|
{
|
|
157
|
-
console.log("HueMagic:", "Connection to bridge lost. Trying to reconnect again in 30 seconds…",
|
|
150
|
+
console.log("HueMagic:", "Connection to bridge lost. Trying to reconnect again in 30 seconds…", error);
|
|
158
151
|
setTimeout(function(){ scope.subscribe(config, callback); }, 30000);
|
|
159
152
|
resolve(true);
|
|
160
153
|
}
|