homey-api 3.0.17 → 3.0.19
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.
|
@@ -18,6 +18,81 @@ class ManagerFlow extends Manager {
|
|
|
18
18
|
FlowCardAction,
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
async getFlowCardTrigger({
|
|
22
|
+
$cache = true,
|
|
23
|
+
id,
|
|
24
|
+
}) {
|
|
25
|
+
if ($cache === true && this.__cache['flowcardtrigger'][id]) {
|
|
26
|
+
return this.__cache['flowcardtrigger'][id];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return this.__super__getFlowCardTrigger({
|
|
30
|
+
id: id,
|
|
31
|
+
uri: id.split(':', 3).join(':'),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async getFlowCardCondition({
|
|
36
|
+
$cache = true,
|
|
37
|
+
id,
|
|
38
|
+
}) {
|
|
39
|
+
if ($cache === true && this.__cache['flowcardcondition'][id]) {
|
|
40
|
+
return this.__cache['flowcardcondition'][id];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return this.__super__getFlowCardCondition({
|
|
44
|
+
id: id,
|
|
45
|
+
uri: id.split(':', 3).join(':'),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async runFlowCardCondition({
|
|
50
|
+
id,
|
|
51
|
+
...props
|
|
52
|
+
}) {
|
|
53
|
+
return this.__super__runFlowCardCondition({
|
|
54
|
+
id: id,
|
|
55
|
+
uri: id.split(':', 3).join(':'),
|
|
56
|
+
...props,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async getFlowCardAction({
|
|
61
|
+
$cache = true,
|
|
62
|
+
id,
|
|
63
|
+
}) {
|
|
64
|
+
if ($cache === true && this.__cache['flowcardaction'][id]) {
|
|
65
|
+
return this.__cache['flowcardaction'][id];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return this.__super__getFlowCardAction({
|
|
69
|
+
id: id,
|
|
70
|
+
uri: id.split(':', 3).join(':'),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async runFlowCardAction({
|
|
75
|
+
id,
|
|
76
|
+
...props
|
|
77
|
+
}) {
|
|
78
|
+
return this.__super__runFlowCardAction({
|
|
79
|
+
id: id,
|
|
80
|
+
uri: id.split(':', 3).join(':'),
|
|
81
|
+
...props,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async getFlowCardAutocomplete({
|
|
86
|
+
id,
|
|
87
|
+
...props
|
|
88
|
+
}) {
|
|
89
|
+
return this.__super__getFlowCardAutocomplete({
|
|
90
|
+
id: id,
|
|
91
|
+
uri: id.split(':', 3).join(':'),
|
|
92
|
+
...props,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
21
96
|
}
|
|
22
97
|
|
|
23
98
|
module.exports = ManagerFlow;
|
|
@@ -398,6 +398,7 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
398
398
|
headers['Authorization'] = `Bearer ${this.__token}`;
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
+
const originalBody = body;
|
|
401
402
|
if (['PUT', 'POST'].includes(method)) {
|
|
402
403
|
if (body && json === true) {
|
|
403
404
|
headers['Content-Type'] = 'application/json';
|
|
@@ -451,7 +452,7 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
451
452
|
method,
|
|
452
453
|
headers,
|
|
453
454
|
path,
|
|
454
|
-
|
|
455
|
+
originalBody,
|
|
455
456
|
retryAfterRefresh: true,
|
|
456
457
|
});
|
|
457
458
|
}
|
|
@@ -551,7 +552,9 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
551
552
|
|
|
552
553
|
await this.connect();
|
|
553
554
|
await new Promise((resolve, reject) => {
|
|
554
|
-
this.__ioNamespace.once('disconnect',
|
|
555
|
+
this.__ioNamespace.once('disconnect', (reason) => {
|
|
556
|
+
reject(reason);
|
|
557
|
+
});
|
|
555
558
|
this.__ioNamespace.emit('subscribe', uri, err => {
|
|
556
559
|
if (err) {
|
|
557
560
|
this.__debug('Failed to subscribe', uri, err);
|
package/lib/Util.js
CHANGED