homey-api 3.13.0 → 3.13.2
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/lib/HomeyAPI/HomeyAPIV2/ManagerApps/App.js +15 -0
- package/lib/HomeyAPI/HomeyAPIV2/ManagerApps.js +13 -0
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlow/AdvancedFlow.js +22 -7
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlow/Flow.js +25 -18
- package/lib/HomeyAPI/HomeyAPIV2.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const AppV3 = require('../../HomeyAPIV3/ManagerApps/App');
|
|
4
|
+
|
|
5
|
+
class App extends AppV3 {
|
|
6
|
+
static transformGet(item) {
|
|
7
|
+
item = super.transformGet(item);
|
|
8
|
+
item.color = item.brandColor;
|
|
9
|
+
delete item.brandColor;
|
|
10
|
+
|
|
11
|
+
return item;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = App;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const ManagerAppsV3 = require('../HomeyAPIV3/ManagerApps');
|
|
4
|
+
const App = require('./ManagerApps/App');
|
|
5
|
+
|
|
6
|
+
class ManagerApps extends ManagerAppsV3 {
|
|
7
|
+
static CRUD = {
|
|
8
|
+
...super.CRUD,
|
|
9
|
+
App,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = ManagerApps;
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
const AdvancedFlowV3 = require('../../HomeyAPIV3/ManagerFlow/AdvancedFlow');
|
|
4
4
|
|
|
5
5
|
class AdvancedFlow extends AdvancedFlowV3 {
|
|
6
|
-
|
|
7
6
|
static transformGet(item) {
|
|
8
7
|
if (item.cards) {
|
|
9
8
|
for (const card of Object.values(item.cards)) {
|
|
9
|
+
if (card.type !== 'trigger' && card.type !== 'condition' && card.type !== 'action') {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
|
|
10
13
|
card.id = `${card.ownerUri}:${card.id}`;
|
|
11
14
|
}
|
|
12
15
|
}
|
|
@@ -17,16 +20,28 @@ class AdvancedFlow extends AdvancedFlowV3 {
|
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
static transformSet(item) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const nextItem = {
|
|
24
|
+
...item,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
if (nextItem.cards) {
|
|
28
|
+
nextItem.cards = { ...nextItem.cards };
|
|
29
|
+
|
|
30
|
+
for (const [key, card] of Object.entries(nextItem.cards)) {
|
|
31
|
+
if (card.type !== 'trigger' && card.type !== 'condition' && card.type !== 'action') {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
nextItem.cards[key] = {
|
|
36
|
+
...card,
|
|
37
|
+
ownerUri: card.id.split(':', 3).join(':'),
|
|
38
|
+
id: card.id.split(':').reverse()[0],
|
|
39
|
+
};
|
|
24
40
|
}
|
|
25
41
|
}
|
|
26
42
|
|
|
27
|
-
return
|
|
43
|
+
return nextItem;
|
|
28
44
|
}
|
|
29
|
-
|
|
30
45
|
}
|
|
31
46
|
|
|
32
47
|
module.exports = AdvancedFlow;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const FlowV3 = require('../../HomeyAPIV3/ManagerFlow/Flow');
|
|
4
4
|
|
|
5
5
|
class Flow extends FlowV3 {
|
|
6
|
-
|
|
7
6
|
static transformGet(item) {
|
|
8
7
|
item = super.transformGet(item);
|
|
9
8
|
|
|
@@ -13,14 +12,14 @@ class Flow extends FlowV3 {
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
if (Array.isArray(item.conditions)) {
|
|
16
|
-
item.conditions.forEach(card => {
|
|
15
|
+
item.conditions.forEach((card) => {
|
|
17
16
|
card.id = `${card.uri}:${card.id}`;
|
|
18
17
|
delete card.uri;
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
if (Array.isArray(item.actions)) {
|
|
23
|
-
item.actions.forEach(card => {
|
|
22
|
+
item.actions.forEach((card) => {
|
|
24
23
|
card.id = `${card.uri}:${card.id}`;
|
|
25
24
|
delete card.uri;
|
|
26
25
|
});
|
|
@@ -32,28 +31,36 @@ class Flow extends FlowV3 {
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
static transformSet(item) {
|
|
35
|
-
|
|
36
|
-
item
|
|
37
|
-
|
|
34
|
+
const nextItem = {
|
|
35
|
+
...item,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
if (nextItem.trigger) {
|
|
39
|
+
nextItem.trigger = {
|
|
40
|
+
...nextItem.trigger,
|
|
41
|
+
uri: nextItem.trigger.id.split(':', 3).join(':'),
|
|
42
|
+
id: nextItem.trigger.id.split(':').slice(3).join(':'),
|
|
43
|
+
};
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
if (Array.isArray(
|
|
41
|
-
|
|
42
|
-
card
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
if (Array.isArray(nextItem.conditions)) {
|
|
47
|
+
nextItem.conditions = nextItem.conditions.map((card) => ({
|
|
48
|
+
...card,
|
|
49
|
+
uri: card.id.split(':', 3).join(':'),
|
|
50
|
+
id: card.id.split(':').slice(3).join(':'),
|
|
51
|
+
}));
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
if (Array.isArray(
|
|
48
|
-
|
|
49
|
-
card
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
if (Array.isArray(nextItem.actions)) {
|
|
55
|
+
nextItem.actions = nextItem.actions.map((card) => ({
|
|
56
|
+
...card,
|
|
57
|
+
uri: card.id.split(':', 3).join(':'),
|
|
58
|
+
id: card.id.split(':').slice(3).join(':'),
|
|
59
|
+
}));
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
return
|
|
62
|
+
return nextItem;
|
|
55
63
|
}
|
|
56
|
-
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
module.exports = Flow;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const HomeyAPIV3 = require('./HomeyAPIV3');
|
|
4
4
|
const ManagerFlow = require('./HomeyAPIV2/ManagerFlow');
|
|
5
5
|
const ManagerFlowToken = require('./HomeyAPIV2/ManagerFlowToken');
|
|
6
|
+
const ManagerApps = require('./HomeyAPIV2/ManagerApps');
|
|
6
7
|
const ManagerDevices = require('./HomeyAPIV2/ManagerDevices');
|
|
7
8
|
const ManagerDrivers = require('./HomeyAPIV2/ManagerDrivers');
|
|
8
9
|
const ManagerDevkit = require('./HomeyAPIV2/ManagerDevkit');
|
|
@@ -16,7 +17,6 @@ const ManagerInsights = require('./HomeyAPIV2/ManagerInsights');
|
|
|
16
17
|
* @extends HomeyAPIV3
|
|
17
18
|
*/
|
|
18
19
|
class HomeyAPIV2 extends HomeyAPIV3 {
|
|
19
|
-
|
|
20
20
|
static DEFAULT_TIMEOUT = 1000 * 30;
|
|
21
21
|
|
|
22
22
|
static MANAGERS = {
|
|
@@ -27,6 +27,7 @@ class HomeyAPIV2 extends HomeyAPIV3 {
|
|
|
27
27
|
ManagerDrivers,
|
|
28
28
|
ManagerDevkit,
|
|
29
29
|
ManagerInsights,
|
|
30
|
+
ManagerApps,
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
get platform() {
|
|
@@ -36,7 +37,6 @@ class HomeyAPIV2 extends HomeyAPIV3 {
|
|
|
36
37
|
get platformVersion() {
|
|
37
38
|
return 1;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
module.exports = HomeyAPIV2;
|