homey-api 3.0.0-rc.1 → 3.0.0-rc.11
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/assets/specifications/HomeyAPIV3Local.json +269 -5
- package/assets/types/homey-api.d.ts +267 -59
- package/assets/types/homey-api.private.d.ts +267 -59
- package/lib/HomeyAPI/HomeyAPI.js +12 -7
- package/lib/HomeyAPI/HomeyAPIV2/ManagerDevices/Capability.js +2 -2
- package/lib/HomeyAPI/HomeyAPIV2/ManagerDevices/Device.js +2 -2
- package/lib/HomeyAPI/HomeyAPIV2/ManagerDevices.js +0 -14
- package/lib/HomeyAPI/HomeyAPIV2/ManagerDrivers/Driver.js +2 -2
- package/lib/HomeyAPI/HomeyAPIV2/ManagerDrivers/PairSession.js +20 -0
- package/lib/HomeyAPI/HomeyAPIV2/ManagerDrivers.js +17 -0
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlow/AdvancedFlow.js +16 -3
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlow/Flow.js +25 -2
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlow/FlowCardAction.js +2 -2
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlow/FlowCardCondition.js +2 -2
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlow/FlowCardTrigger.js +2 -2
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlow.js +36 -13
- package/lib/HomeyAPI/HomeyAPIV2/ManagerFlowToken/FlowToken.js +3 -3
- package/lib/HomeyAPI/HomeyAPIV2/ManagerInsights/Log.js +2 -3
- package/lib/HomeyAPI/HomeyAPIV2/ManagerInsights.js +17 -0
- package/lib/HomeyAPI/HomeyAPIV3/Item.js +14 -1
- package/lib/HomeyAPI/HomeyAPIV3/Manager.js +29 -46
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDevices/Device.js +12 -12
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDevices/DeviceCapability.js +1 -1
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDrivers/PairSession.js +9 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDrivers.js +2 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerFlow/Flow.js +8 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerFlow/FlowCard.js +8 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerFlowToken/FlowToken.js +12 -4
- package/lib/HomeyAPI/HomeyAPIV3/ManagerInsights/Log.js +14 -0
- package/package.json +1 -1
|
@@ -5371,7 +5371,7 @@
|
|
|
5371
5371
|
|
|
5372
5372
|
|
|
5373
5373
|
|
|
5374
|
-
debug: function,
|
|
5374
|
+
debug: function | null,
|
|
5375
5375
|
|
|
5376
5376
|
|
|
5377
5377
|
},
|
|
@@ -6411,62 +6411,6 @@
|
|
|
6411
6411
|
|
|
6412
6412
|
|
|
6413
6413
|
|
|
6414
|
-
makeCapabilityInstance(
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
capabilityId: string,
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
listener: {
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
value: number | boolean | string,
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
},
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
):
|
|
6435
|
-
HomeyAPIV2.ManagerDevices.Device.DeviceCapability;
|
|
6436
|
-
|
|
6437
|
-
setCapabilityValue(
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
opts: {
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
capabilityId: string,
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
value: number | boolean | string,
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
opts: {
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
duration: number,
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
},
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
},
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
):
|
|
6468
|
-
Promise<void>;
|
|
6469
|
-
|
|
6470
6414
|
}
|
|
6471
6415
|
|
|
6472
6416
|
}
|
|
@@ -7670,6 +7614,22 @@
|
|
|
7670
7614
|
|
|
7671
7615
|
|
|
7672
7616
|
|
|
7617
|
+
|
|
7618
|
+
|
|
7619
|
+
|
|
7620
|
+
|
|
7621
|
+
|
|
7622
|
+
export namespace HomeyAPIV3Local.ManagerAlarms {
|
|
7623
|
+
|
|
7624
|
+
export class Alarm {
|
|
7625
|
+
|
|
7626
|
+
|
|
7627
|
+
|
|
7628
|
+
|
|
7629
|
+
|
|
7630
|
+
}
|
|
7631
|
+
|
|
7632
|
+
}
|
|
7673
7633
|
|
|
7674
7634
|
|
|
7675
7635
|
|
|
@@ -16234,6 +16194,150 @@
|
|
|
16234
16194
|
|
|
16235
16195
|
|
|
16236
16196
|
|
|
16197
|
+
isConnected(
|
|
16198
|
+
|
|
16199
|
+
):
|
|
16200
|
+
Boolean;
|
|
16201
|
+
|
|
16202
|
+
connect(
|
|
16203
|
+
|
|
16204
|
+
):
|
|
16205
|
+
Promise<void>;
|
|
16206
|
+
|
|
16207
|
+
disconnect(
|
|
16208
|
+
|
|
16209
|
+
):
|
|
16210
|
+
Promise<void>;
|
|
16211
|
+
|
|
16212
|
+
}
|
|
16213
|
+
|
|
16214
|
+
export class ManagerAlarms extends HomeyAPIV3Local.Manager {
|
|
16215
|
+
|
|
16216
|
+
|
|
16217
|
+
|
|
16218
|
+
|
|
16219
|
+
|
|
16220
|
+
getAlarms(
|
|
16221
|
+
|
|
16222
|
+
):
|
|
16223
|
+
Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
|
|
16224
|
+
|
|
16225
|
+
getAlarm(
|
|
16226
|
+
|
|
16227
|
+
|
|
16228
|
+
|
|
16229
|
+
|
|
16230
|
+
opts: {
|
|
16231
|
+
|
|
16232
|
+
|
|
16233
|
+
id: string,
|
|
16234
|
+
|
|
16235
|
+
|
|
16236
|
+
},
|
|
16237
|
+
|
|
16238
|
+
|
|
16239
|
+
|
|
16240
|
+
|
|
16241
|
+
):
|
|
16242
|
+
Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
|
|
16243
|
+
|
|
16244
|
+
createAlarm(
|
|
16245
|
+
|
|
16246
|
+
|
|
16247
|
+
|
|
16248
|
+
|
|
16249
|
+
opts: {
|
|
16250
|
+
|
|
16251
|
+
|
|
16252
|
+
alarm: {
|
|
16253
|
+
|
|
16254
|
+
|
|
16255
|
+
name: string,
|
|
16256
|
+
|
|
16257
|
+
|
|
16258
|
+
|
|
16259
|
+
time: string,
|
|
16260
|
+
|
|
16261
|
+
|
|
16262
|
+
|
|
16263
|
+
enabled: boolean,
|
|
16264
|
+
|
|
16265
|
+
|
|
16266
|
+
|
|
16267
|
+
repetition: object,
|
|
16268
|
+
|
|
16269
|
+
|
|
16270
|
+
},
|
|
16271
|
+
|
|
16272
|
+
|
|
16273
|
+
},
|
|
16274
|
+
|
|
16275
|
+
|
|
16276
|
+
|
|
16277
|
+
|
|
16278
|
+
):
|
|
16279
|
+
Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
|
|
16280
|
+
|
|
16281
|
+
updateAlarm(
|
|
16282
|
+
|
|
16283
|
+
|
|
16284
|
+
|
|
16285
|
+
|
|
16286
|
+
opts: {
|
|
16287
|
+
|
|
16288
|
+
|
|
16289
|
+
id: string,
|
|
16290
|
+
|
|
16291
|
+
|
|
16292
|
+
|
|
16293
|
+
alarm: {
|
|
16294
|
+
|
|
16295
|
+
|
|
16296
|
+
name: string,
|
|
16297
|
+
|
|
16298
|
+
|
|
16299
|
+
|
|
16300
|
+
time: string,
|
|
16301
|
+
|
|
16302
|
+
|
|
16303
|
+
|
|
16304
|
+
enabled: boolean,
|
|
16305
|
+
|
|
16306
|
+
|
|
16307
|
+
|
|
16308
|
+
repetition: object,
|
|
16309
|
+
|
|
16310
|
+
|
|
16311
|
+
},
|
|
16312
|
+
|
|
16313
|
+
|
|
16314
|
+
},
|
|
16315
|
+
|
|
16316
|
+
|
|
16317
|
+
|
|
16318
|
+
|
|
16319
|
+
):
|
|
16320
|
+
Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
|
|
16321
|
+
|
|
16322
|
+
deleteAlarm(
|
|
16323
|
+
|
|
16324
|
+
|
|
16325
|
+
|
|
16326
|
+
|
|
16327
|
+
opts: {
|
|
16328
|
+
|
|
16329
|
+
|
|
16330
|
+
id: string,
|
|
16331
|
+
|
|
16332
|
+
|
|
16333
|
+
},
|
|
16334
|
+
|
|
16335
|
+
|
|
16336
|
+
|
|
16337
|
+
|
|
16338
|
+
):
|
|
16339
|
+
Promise<any>;
|
|
16340
|
+
|
|
16237
16341
|
isConnected(
|
|
16238
16342
|
|
|
16239
16343
|
):
|
|
@@ -17577,7 +17681,7 @@
|
|
|
17577
17681
|
|
|
17578
17682
|
|
|
17579
17683
|
|
|
17580
|
-
data:
|
|
17684
|
+
data: *,
|
|
17581
17685
|
|
|
17582
17686
|
|
|
17583
17687
|
},
|
|
@@ -17604,7 +17708,7 @@
|
|
|
17604
17708
|
|
|
17605
17709
|
|
|
17606
17710
|
|
|
17607
|
-
data:
|
|
17711
|
+
data: *,
|
|
17608
17712
|
|
|
17609
17713
|
|
|
17610
17714
|
},
|
|
@@ -18512,6 +18616,44 @@
|
|
|
18512
18616
|
):
|
|
18513
18617
|
Promise<HomeyAPIV3Local.ManagerFlowToken.FlowToken>;
|
|
18514
18618
|
|
|
18619
|
+
getFlowToken(
|
|
18620
|
+
|
|
18621
|
+
|
|
18622
|
+
|
|
18623
|
+
|
|
18624
|
+
opts: {
|
|
18625
|
+
|
|
18626
|
+
|
|
18627
|
+
id: string,
|
|
18628
|
+
|
|
18629
|
+
|
|
18630
|
+
},
|
|
18631
|
+
|
|
18632
|
+
|
|
18633
|
+
|
|
18634
|
+
|
|
18635
|
+
):
|
|
18636
|
+
Promise<HomeyAPIV3Local.ManagerFlowToken.FlowToken>;
|
|
18637
|
+
|
|
18638
|
+
getFlowTokenValue(
|
|
18639
|
+
|
|
18640
|
+
|
|
18641
|
+
|
|
18642
|
+
|
|
18643
|
+
opts: {
|
|
18644
|
+
|
|
18645
|
+
|
|
18646
|
+
id: string,
|
|
18647
|
+
|
|
18648
|
+
|
|
18649
|
+
},
|
|
18650
|
+
|
|
18651
|
+
|
|
18652
|
+
|
|
18653
|
+
|
|
18654
|
+
):
|
|
18655
|
+
Promise<any>;
|
|
18656
|
+
|
|
18515
18657
|
isConnected(
|
|
18516
18658
|
|
|
18517
18659
|
):
|
|
@@ -19829,6 +19971,25 @@
|
|
|
19829
19971
|
|
|
19830
19972
|
rebootOTA(
|
|
19831
19973
|
|
|
19974
|
+
):
|
|
19975
|
+
Promise<any>;
|
|
19976
|
+
|
|
19977
|
+
setDebug(
|
|
19978
|
+
|
|
19979
|
+
|
|
19980
|
+
|
|
19981
|
+
|
|
19982
|
+
opts: {
|
|
19983
|
+
|
|
19984
|
+
|
|
19985
|
+
namespace: string,
|
|
19986
|
+
|
|
19987
|
+
|
|
19988
|
+
},
|
|
19989
|
+
|
|
19990
|
+
|
|
19991
|
+
|
|
19992
|
+
|
|
19832
19993
|
):
|
|
19833
19994
|
Promise<any>;
|
|
19834
19995
|
|
|
@@ -20439,6 +20600,25 @@
|
|
|
20439
20600
|
|
|
20440
20601
|
getZones(
|
|
20441
20602
|
|
|
20603
|
+
):
|
|
20604
|
+
Promise<HomeyAPIV3Local.ManagerZones.Zone>;
|
|
20605
|
+
|
|
20606
|
+
getZone(
|
|
20607
|
+
|
|
20608
|
+
|
|
20609
|
+
|
|
20610
|
+
|
|
20611
|
+
opts: {
|
|
20612
|
+
|
|
20613
|
+
|
|
20614
|
+
id: string,
|
|
20615
|
+
|
|
20616
|
+
|
|
20617
|
+
},
|
|
20618
|
+
|
|
20619
|
+
|
|
20620
|
+
|
|
20621
|
+
|
|
20442
20622
|
):
|
|
20443
20623
|
Promise<HomeyAPIV3Local.ManagerZones.Zone>;
|
|
20444
20624
|
|
|
@@ -20584,6 +20764,30 @@
|
|
|
20584
20764
|
|
|
20585
20765
|
flashFirmware(
|
|
20586
20766
|
|
|
20767
|
+
):
|
|
20768
|
+
Promise<any>;
|
|
20769
|
+
|
|
20770
|
+
getLog(
|
|
20771
|
+
|
|
20772
|
+
):
|
|
20773
|
+
Promise<any>;
|
|
20774
|
+
|
|
20775
|
+
setLogEnabled(
|
|
20776
|
+
|
|
20777
|
+
|
|
20778
|
+
|
|
20779
|
+
|
|
20780
|
+
opts: {
|
|
20781
|
+
|
|
20782
|
+
|
|
20783
|
+
enabled: boolean,
|
|
20784
|
+
|
|
20785
|
+
|
|
20786
|
+
},
|
|
20787
|
+
|
|
20788
|
+
|
|
20789
|
+
|
|
20790
|
+
|
|
20587
20791
|
):
|
|
20588
20792
|
Promise<any>;
|
|
20589
20793
|
|
|
@@ -20621,6 +20825,10 @@
|
|
|
20621
20825
|
|
|
20622
20826
|
|
|
20623
20827
|
|
|
20828
|
+
|
|
20829
|
+
|
|
20830
|
+
|
|
20831
|
+
|
|
20624
20832
|
|
|
20625
20833
|
|
|
20626
20834
|
|
package/lib/HomeyAPI/HomeyAPI.js
CHANGED
|
@@ -129,22 +129,22 @@ class HomeyAPI {
|
|
|
129
129
|
* Create a {@link HomeyAPIV3Local} instance for use in the Apps SDK.
|
|
130
130
|
* @param {Object} opts
|
|
131
131
|
* @param {Homey} opts.homey — Homey instance
|
|
132
|
-
* @param {Function} opts.debug — Debug
|
|
132
|
+
* @param {Function|null} opts.debug — Debug function, defaults to `null`
|
|
133
133
|
*/
|
|
134
134
|
static async createAppAPI({
|
|
135
135
|
homey,
|
|
136
|
-
debug =
|
|
136
|
+
debug = null,
|
|
137
137
|
} = {}) {
|
|
138
138
|
if (!homey) {
|
|
139
139
|
throw new Error('Invalid Homey');
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
if (
|
|
143
|
-
|
|
142
|
+
if (debug === true) {
|
|
143
|
+
debug = (...props) => homey.app.log('[homey-api]', ...props);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
const props = {
|
|
147
|
-
debug,
|
|
147
|
+
debug: debug ?? function debug() { },
|
|
148
148
|
token: await homey.api.getOwnerApiToken(),
|
|
149
149
|
baseUrl: await homey.api.getLocalUrl(),
|
|
150
150
|
strategy: [],
|
|
@@ -154,16 +154,21 @@ class HomeyAPI {
|
|
|
154
154
|
},
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
-
if (homey.platformVersion === 1) {
|
|
157
|
+
if (homey.platform === 'local' && homey.platformVersion === 1) {
|
|
158
158
|
const HomeyAPIV2 = require('./HomeyAPIV2');
|
|
159
159
|
return new HomeyAPIV2(props);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
if (homey.platformVersion === 2) {
|
|
162
|
+
if (homey.platform === 'local' && homey.platformVersion === 2) {
|
|
163
163
|
const HomeyAPIV3Local = require('./HomeyAPIV3Local');
|
|
164
164
|
return new HomeyAPIV3Local(props);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
if (homey.platform === 'cloud' && homey.platformVersion === 2) {
|
|
168
|
+
const HomeyAPIV3Cloud = require('./HomeyAPIV3Cloud');
|
|
169
|
+
return new HomeyAPIV3Cloud(props);
|
|
170
|
+
}
|
|
171
|
+
|
|
167
172
|
throw new Error(`Invalid Homey Platform Version: ${homey.platformVersion}`);
|
|
168
173
|
}
|
|
169
174
|
|
|
@@ -4,8 +4,8 @@ const CapabilityV3 = require('../../HomeyAPIV3/ManagerDevices/Capability');
|
|
|
4
4
|
|
|
5
5
|
class Capability extends CapabilityV3 {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
item = super.
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
item = super.transformGet(item);
|
|
9
9
|
|
|
10
10
|
item.id = `${item.uri}:${item.id}`;
|
|
11
11
|
item.ownerUri = item.uri;
|
|
@@ -4,8 +4,8 @@ const DeviceV3 = require('../../HomeyAPIV3/ManagerDevices/Device');
|
|
|
4
4
|
|
|
5
5
|
class Device extends DeviceV3 {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
item = super.
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
item = super.transformGet(item);
|
|
9
9
|
|
|
10
10
|
item.driverId = `${item.driverUri}:${item.driverId}`;
|
|
11
11
|
delete item.driverUri;
|
|
@@ -12,20 +12,6 @@ class ManagerDevices extends Manager {
|
|
|
12
12
|
Device,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async getCapability({
|
|
16
|
-
$cache = true,
|
|
17
|
-
id,
|
|
18
|
-
}) {
|
|
19
|
-
if ($cache === true && this.__cache['capability'][id]) {
|
|
20
|
-
return this.__cache['capability'][id];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return this.__super__getCapability({
|
|
24
|
-
id: id.split(':').reverse()[0],
|
|
25
|
-
uri: id.split(':', 3).join(':'),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
15
|
}
|
|
30
16
|
|
|
31
17
|
module.exports = ManagerDevices;
|
|
@@ -4,8 +4,8 @@ const DriverV3 = require('../../HomeyAPIV3/ManagerDrivers/Driver');
|
|
|
4
4
|
|
|
5
5
|
class Driver extends DriverV3 {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
item = super.
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
item = super.transformGet(item);
|
|
9
9
|
|
|
10
10
|
item.ownerId = item.id;
|
|
11
11
|
item.ownerUri = item.uri;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const PairSessionV3 = require('../../HomeyAPIV3/ManagerDrivers/PairSession');
|
|
4
|
+
|
|
5
|
+
class PairSession extends PairSessionV3 {
|
|
6
|
+
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
item = super.transformGet(item);
|
|
9
|
+
|
|
10
|
+
item.driverId = `${item.driverUri}:${item.driverId}`;
|
|
11
|
+
item.ownerUri = item.driverUri;
|
|
12
|
+
|
|
13
|
+
delete item.driverUri;
|
|
14
|
+
|
|
15
|
+
return item;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = PairSession;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const ManagerDriversV3 = require('../HomeyAPIV3/ManagerDrivers');
|
|
4
4
|
const Driver = require('./ManagerDrivers/Driver');
|
|
5
|
+
const PairSession = require('./ManagerDrivers/PairSession');
|
|
5
6
|
|
|
6
7
|
class ManagerDrivers extends ManagerDriversV3 {
|
|
7
8
|
|
|
8
9
|
static CRUD = {
|
|
9
10
|
...super.CRUD,
|
|
10
11
|
Driver,
|
|
12
|
+
PairSession,
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
async getDriver({
|
|
@@ -24,6 +26,21 @@ class ManagerDrivers extends ManagerDriversV3 {
|
|
|
24
26
|
});
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
async createPairSession({
|
|
30
|
+
pairsession,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
if (pairsession.driverId) {
|
|
34
|
+
pairsession.driverUri = pairsession.driverId.split(':', 3).join(':');
|
|
35
|
+
pairsession.driverId = pairsession.driverId.split(':').reverse()[0];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return this.__super__createPairSession({
|
|
39
|
+
pairsession,
|
|
40
|
+
...props,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
module.exports = ManagerDrivers;
|
|
@@ -4,9 +4,22 @@ const AdvancedFlowV3 = require('../../HomeyAPIV3/ManagerFlow/Flow');
|
|
|
4
4
|
|
|
5
5
|
class AdvancedFlow extends AdvancedFlowV3 {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
|
|
9
|
-
card
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
if (item.cards) {
|
|
9
|
+
for (const card of Object.values(item.cards)) {
|
|
10
|
+
card.id = `${card.ownerUri}:${card.id}`;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return item;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static transformSet(item) {
|
|
18
|
+
if (item.cards) {
|
|
19
|
+
for (const card of Object.values(item.cards)) {
|
|
20
|
+
card.ownerUri = card.id.split(':', 3).join(':');
|
|
21
|
+
card.id = card.id.split(':').reverse()[0];
|
|
22
|
+
}
|
|
10
23
|
}
|
|
11
24
|
|
|
12
25
|
return item;
|
|
@@ -4,8 +4,8 @@ const FlowV3 = require('../../HomeyAPIV3/ManagerFlow/Flow');
|
|
|
4
4
|
|
|
5
5
|
class Flow extends FlowV3 {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
item = super.
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
item = super.transformGet(item);
|
|
9
9
|
|
|
10
10
|
if (item.trigger) {
|
|
11
11
|
item.trigger.id = `${item.trigger.uri}:${item.trigger.id}`;
|
|
@@ -29,6 +29,29 @@ class Flow extends FlowV3 {
|
|
|
29
29
|
return item;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
static transformSet(item) {
|
|
33
|
+
if (item.trigger) {
|
|
34
|
+
item.trigger.uri = item.trigger.id.split(':', 3).join(':');
|
|
35
|
+
item.trigger.id = item.trigger.id.split(':').reverse()[0];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (Array.isArray(item.conditions)) {
|
|
39
|
+
item.conditions.forEach(card => {
|
|
40
|
+
card.uri = card.id.split(':', 3).join(':');
|
|
41
|
+
card.id = card.id.split(':').reverse()[0];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (Array.isArray(item.actions)) {
|
|
46
|
+
item.actions.forEach(card => {
|
|
47
|
+
card.uri = card.id.split(':', 3).join(':');
|
|
48
|
+
card.id = card.id.split(':').reverse()[0];
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return item;
|
|
53
|
+
}
|
|
54
|
+
|
|
32
55
|
}
|
|
33
56
|
|
|
34
57
|
module.exports = Flow;
|
|
@@ -4,8 +4,8 @@ const FlowCardActionV3 = require('../../HomeyAPIV3/ManagerFlow/FlowCardAction');
|
|
|
4
4
|
|
|
5
5
|
class FlowCardAction extends FlowCardActionV3 {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
item = super.
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
item = super.transformGet(item);
|
|
9
9
|
|
|
10
10
|
item.id = `${item.uri}:${item.id}`;
|
|
11
11
|
item.ownerUri = item.uri;
|
|
@@ -4,8 +4,8 @@ const FlowCardConditionV3 = require('../../HomeyAPIV3/ManagerFlow/FlowCardCondit
|
|
|
4
4
|
|
|
5
5
|
class FlowCardCondition extends FlowCardConditionV3 {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
item = super.
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
item = super.transformGet(item);
|
|
9
9
|
|
|
10
10
|
item.id = `${item.uri}:${item.id}`;
|
|
11
11
|
item.ownerUri = item.uri;
|
|
@@ -4,8 +4,8 @@ const FlowCardTriggerV3 = require('../../HomeyAPIV3/ManagerFlow/FlowCardTrigger'
|
|
|
4
4
|
|
|
5
5
|
class FlowCardTrigger extends FlowCardTriggerV3 {
|
|
6
6
|
|
|
7
|
-
static
|
|
8
|
-
item = super.
|
|
7
|
+
static transformGet(item) {
|
|
8
|
+
item = super.transformGet(item);
|
|
9
9
|
|
|
10
10
|
item.id = `${item.uri}:${item.id}`;
|
|
11
11
|
item.ownerUri = item.uri;
|