homey-api 3.0.10 → 3.0.12
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/HomeyAPIV3Cloud.json +225 -36
- package/assets/specifications/HomeyAPIV3Local.json +168 -7
- package/assets/types/homey-api.d.ts +57 -11
- package/assets/types/homey-api.private.d.ts +81 -11
- package/lib/AthomCloudAPI/User.js +2 -0
- package/lib/AthomCloudAPI.js +71 -17
- package/lib/EventEmitter.js +1 -0
- package/lib/HomeyAPI/HomeyAPIV2/ManagerDevices/Device.js +0 -1
- package/lib/HomeyAPI/HomeyAPIV2/ManagerDrivers/Driver.js +1 -1
- package/lib/HomeyAPI/HomeyAPIV3/Manager.js +233 -176
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDevices/Capability.js +5 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDevices/Device.js +24 -10
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDevices/DeviceCapability.js +2 -2
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDrivers/Driver.js +10 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerDrivers/PairSession.js +8 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerFlow/FlowCardAction.js +10 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerFlow/FlowCardCondition.js +10 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerFlow/FlowCardTrigger.js +10 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerFlowToken/FlowToken.js +15 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerInsights/Log.js +15 -0
- package/lib/HomeyAPI/HomeyAPIV3/ManagerUsers.js +57 -0
- package/lib/HomeyAPI/HomeyAPIV3.js +20 -4
- package/package.json +1 -1
|
@@ -1359,6 +1359,10 @@ export namespace HomeyAPIV3Local.ManagerVirtualDevice {
|
|
|
1359
1359
|
id: string;
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
1362
|
+
export class VirtualDeviceMatter {
|
|
1363
|
+
id: string;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1362
1366
|
export class VirtualDeviceVirtualButton {
|
|
1363
1367
|
id: string;
|
|
1364
1368
|
}
|
|
@@ -1391,6 +1395,10 @@ export namespace HomeyAPIV3Local.ManagerVirtualDevice {
|
|
|
1391
1395
|
id: string;
|
|
1392
1396
|
}
|
|
1393
1397
|
|
|
1398
|
+
export class VirtualDriverMatter {
|
|
1399
|
+
id: string;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1394
1402
|
export class VirtualDriverVirtualButton {
|
|
1395
1403
|
id: string;
|
|
1396
1404
|
}
|
|
@@ -1783,7 +1791,7 @@ export namespace HomeyAPIV3Cloud {
|
|
|
1783
1791
|
|
|
1784
1792
|
id: string;
|
|
1785
1793
|
|
|
1786
|
-
value:
|
|
1794
|
+
value: any;
|
|
1787
1795
|
}): Promise<any>;
|
|
1788
1796
|
|
|
1789
1797
|
unsetAppSetting(opts: {
|
|
@@ -1955,7 +1963,7 @@ export namespace HomeyAPIV3Cloud {
|
|
|
1955
1963
|
|
|
1956
1964
|
event: string;
|
|
1957
1965
|
|
|
1958
|
-
data?:
|
|
1966
|
+
data?: any;
|
|
1959
1967
|
}): Promise<any>;
|
|
1960
1968
|
|
|
1961
1969
|
emitPairingCallback(opts: {
|
|
@@ -1963,7 +1971,7 @@ export namespace HomeyAPIV3Cloud {
|
|
|
1963
1971
|
|
|
1964
1972
|
callbackId: string;
|
|
1965
1973
|
|
|
1966
|
-
data?:
|
|
1974
|
+
data?: any;
|
|
1967
1975
|
}): Promise<any>;
|
|
1968
1976
|
|
|
1969
1977
|
createPairSessionDevice(opts: {
|
|
@@ -2138,10 +2146,22 @@ export namespace HomeyAPIV3Cloud {
|
|
|
2138
2146
|
|
|
2139
2147
|
deleteFlowFolder(opts: { id: string }): Promise<any>;
|
|
2140
2148
|
|
|
2149
|
+
getFlowCardTrigger(opts: {
|
|
2150
|
+
id: string;
|
|
2151
|
+
|
|
2152
|
+
uri: string;
|
|
2153
|
+
}): Promise<HomeyAPIV3Cloud.ManagerFlow.FlowCardTrigger>;
|
|
2154
|
+
|
|
2141
2155
|
getFlowCardTriggers(): Promise<{
|
|
2142
2156
|
[key: string]: HomeyAPIV3Cloud.ManagerFlow.FlowCardTrigger;
|
|
2143
2157
|
}>;
|
|
2144
2158
|
|
|
2159
|
+
getFlowCardCondition(opts: {
|
|
2160
|
+
id: string;
|
|
2161
|
+
|
|
2162
|
+
uri: string;
|
|
2163
|
+
}): Promise<HomeyAPIV3Cloud.ManagerFlow.FlowCardCondition>;
|
|
2164
|
+
|
|
2145
2165
|
getFlowCardConditions(): Promise<{
|
|
2146
2166
|
[key: string]: HomeyAPIV3Cloud.ManagerFlow.FlowCardCondition;
|
|
2147
2167
|
}>;
|
|
@@ -2160,6 +2180,12 @@ export namespace HomeyAPIV3Cloud {
|
|
|
2160
2180
|
droptoken?: string;
|
|
2161
2181
|
}): Promise<any>;
|
|
2162
2182
|
|
|
2183
|
+
getFlowCardAction(opts: {
|
|
2184
|
+
id: string;
|
|
2185
|
+
|
|
2186
|
+
uri: string;
|
|
2187
|
+
}): Promise<HomeyAPIV3Cloud.ManagerFlow.FlowCardAction>;
|
|
2188
|
+
|
|
2163
2189
|
getFlowCardActions(): Promise<{
|
|
2164
2190
|
[key: string]: HomeyAPIV3Cloud.ManagerFlow.FlowCardAction;
|
|
2165
2191
|
}>;
|
|
@@ -2223,6 +2249,12 @@ export namespace HomeyAPIV3Cloud {
|
|
|
2223
2249
|
getFlowTokens(): Promise<{
|
|
2224
2250
|
[key: string]: HomeyAPIV3Cloud.ManagerFlowToken.FlowToken;
|
|
2225
2251
|
}>;
|
|
2252
|
+
|
|
2253
|
+
getFlowToken(opts: {
|
|
2254
|
+
id: string;
|
|
2255
|
+
}): Promise<HomeyAPIV3Cloud.ManagerFlowToken.FlowToken>;
|
|
2256
|
+
|
|
2257
|
+
getFlowTokenValue(opts: { id: string }): Promise<any>;
|
|
2226
2258
|
}
|
|
2227
2259
|
|
|
2228
2260
|
export class ManagerGeolocation extends HomeyAPIV3.ManagerGeolocation {
|
|
@@ -2238,12 +2270,6 @@ export namespace HomeyAPIV3Cloud {
|
|
|
2238
2270
|
|
|
2239
2271
|
unsetOptionLocation(): Promise<any>;
|
|
2240
2272
|
|
|
2241
|
-
getOptionMode(): Promise<any>;
|
|
2242
|
-
|
|
2243
|
-
setOptionMode(opts: { value: any }): Promise<any>;
|
|
2244
|
-
|
|
2245
|
-
unsetOptionMode(): Promise<any>;
|
|
2246
|
-
|
|
2247
2273
|
getState(): Promise<any>;
|
|
2248
2274
|
}
|
|
2249
2275
|
|
|
@@ -2306,6 +2332,10 @@ export namespace HomeyAPIV3Cloud {
|
|
|
2306
2332
|
export class ManagerLogic extends HomeyAPIV3.ManagerLogic {
|
|
2307
2333
|
getState(): Promise<any>;
|
|
2308
2334
|
|
|
2335
|
+
getVariable(opts: {
|
|
2336
|
+
id: string;
|
|
2337
|
+
}): Promise<HomeyAPIV3Cloud.ManagerLogic.Variable>;
|
|
2338
|
+
|
|
2309
2339
|
getVariables(): Promise<{
|
|
2310
2340
|
[key: string]: HomeyAPIV3Cloud.ManagerLogic.Variable;
|
|
2311
2341
|
}>;
|
|
@@ -2396,6 +2426,8 @@ export namespace HomeyAPIV3Cloud {
|
|
|
2396
2426
|
value?: boolean;
|
|
2397
2427
|
}): Promise<any>;
|
|
2398
2428
|
|
|
2429
|
+
getPresent(opts: { id: string }): Promise<any>;
|
|
2430
|
+
|
|
2399
2431
|
setAsleepMe(opts: {
|
|
2400
2432
|
value?: boolean;
|
|
2401
2433
|
|
|
@@ -2409,6 +2441,8 @@ export namespace HomeyAPIV3Cloud {
|
|
|
2409
2441
|
|
|
2410
2442
|
value?: boolean;
|
|
2411
2443
|
}): Promise<any>;
|
|
2444
|
+
|
|
2445
|
+
getAsleep(opts: { id: string }): Promise<any>;
|
|
2412
2446
|
}
|
|
2413
2447
|
|
|
2414
2448
|
export class ManagerRF extends HomeyAPIV3.ManagerRF {
|
|
@@ -2572,6 +2606,8 @@ export namespace HomeyAPIV3Cloud {
|
|
|
2572
2606
|
|
|
2573
2607
|
getZones(): Promise<{ [key: string]: HomeyAPIV3Cloud.ManagerZones.Zone }>;
|
|
2574
2608
|
|
|
2609
|
+
getZone(opts: { id: string }): Promise<HomeyAPIV3Cloud.ManagerZones.Zone>;
|
|
2610
|
+
|
|
2575
2611
|
createZone(opts: {
|
|
2576
2612
|
zone: {
|
|
2577
2613
|
name: string;
|
|
@@ -3492,9 +3528,9 @@ export namespace HomeyAPIV3Local {
|
|
|
3492
3528
|
|
|
3493
3529
|
getExperiments(): Promise<any>;
|
|
3494
3530
|
|
|
3495
|
-
enableExperiment(opts: {
|
|
3531
|
+
enableExperiment(opts: { id: string }): Promise<any>;
|
|
3496
3532
|
|
|
3497
|
-
disableExperiment(opts: {
|
|
3533
|
+
disableExperiment(opts: { id: string }): Promise<any>;
|
|
3498
3534
|
}
|
|
3499
3535
|
|
|
3500
3536
|
export class ManagerFlow extends HomeyAPIV3.ManagerFlow {
|
|
@@ -3828,6 +3864,12 @@ export namespace HomeyAPIV3Local {
|
|
|
3828
3864
|
}
|
|
3829
3865
|
|
|
3830
3866
|
export class ManagerMatter extends HomeyAPIV3.ManagerMatter {
|
|
3867
|
+
getOptionPaaSettings(): Promise<any>;
|
|
3868
|
+
|
|
3869
|
+
setOptionPaaSettings(opts: { value: any }): Promise<any>;
|
|
3870
|
+
|
|
3871
|
+
unsetOptionPaaSettings(): Promise<any>;
|
|
3872
|
+
|
|
3831
3873
|
getState(): Promise<any>;
|
|
3832
3874
|
}
|
|
3833
3875
|
|
|
@@ -3987,6 +4029,10 @@ export namespace HomeyAPIV3Local {
|
|
|
3987
4029
|
rebootOTA(): Promise<any>;
|
|
3988
4030
|
|
|
3989
4031
|
setDebug(opts: { namespace: string }): Promise<any>;
|
|
4032
|
+
|
|
4033
|
+
enableWifi(): Promise<any>;
|
|
4034
|
+
|
|
4035
|
+
disableWifi(): Promise<any>;
|
|
3990
4036
|
}
|
|
3991
4037
|
|
|
3992
4038
|
export class ManagerThread extends HomeyAPIV3.ManagerThread {
|
|
@@ -1409,6 +1409,10 @@ export namespace HomeyAPIV3Local.ManagerVirtualDevice {
|
|
|
1409
1409
|
id: string;
|
|
1410
1410
|
}
|
|
1411
1411
|
|
|
1412
|
+
export class VirtualDeviceMatter {
|
|
1413
|
+
id: string;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1412
1416
|
export class VirtualDeviceVirtualButton {
|
|
1413
1417
|
id: string;
|
|
1414
1418
|
}
|
|
@@ -1441,6 +1445,10 @@ export namespace HomeyAPIV3Local.ManagerVirtualDevice {
|
|
|
1441
1445
|
id: string;
|
|
1442
1446
|
}
|
|
1443
1447
|
|
|
1448
|
+
export class VirtualDriverMatter {
|
|
1449
|
+
id: string;
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1444
1452
|
export class VirtualDriverVirtualButton {
|
|
1445
1453
|
id: string;
|
|
1446
1454
|
}
|
|
@@ -7545,7 +7553,7 @@ export namespace HomeyAPIV3Cloud {
|
|
|
7545
7553
|
|
|
7546
7554
|
id: string;
|
|
7547
7555
|
|
|
7548
|
-
value:
|
|
7556
|
+
value: any;
|
|
7549
7557
|
}): Promise<any>;
|
|
7550
7558
|
|
|
7551
7559
|
unsetAppSetting(opts: {
|
|
@@ -7753,7 +7761,7 @@ export namespace HomeyAPIV3Cloud {
|
|
|
7753
7761
|
|
|
7754
7762
|
event: string;
|
|
7755
7763
|
|
|
7756
|
-
data?:
|
|
7764
|
+
data?: any;
|
|
7757
7765
|
}): Promise<any>;
|
|
7758
7766
|
|
|
7759
7767
|
emitPairingCallback(opts: {
|
|
@@ -7761,7 +7769,7 @@ export namespace HomeyAPIV3Cloud {
|
|
|
7761
7769
|
|
|
7762
7770
|
callbackId: string;
|
|
7763
7771
|
|
|
7764
|
-
data?:
|
|
7772
|
+
data?: any;
|
|
7765
7773
|
}): Promise<any>;
|
|
7766
7774
|
|
|
7767
7775
|
createPairSessionDevice(opts: {
|
|
@@ -7936,10 +7944,22 @@ export namespace HomeyAPIV3Cloud {
|
|
|
7936
7944
|
|
|
7937
7945
|
deleteFlowFolder(opts: { id: string }): Promise<any>;
|
|
7938
7946
|
|
|
7947
|
+
getFlowCardTrigger(opts: {
|
|
7948
|
+
id: string;
|
|
7949
|
+
|
|
7950
|
+
uri: string;
|
|
7951
|
+
}): Promise<HomeyAPIV3Cloud.ManagerFlow.FlowCardTrigger>;
|
|
7952
|
+
|
|
7939
7953
|
getFlowCardTriggers(): Promise<{
|
|
7940
7954
|
[key: string]: HomeyAPIV3Cloud.ManagerFlow.FlowCardTrigger;
|
|
7941
7955
|
}>;
|
|
7942
7956
|
|
|
7957
|
+
getFlowCardCondition(opts: {
|
|
7958
|
+
id: string;
|
|
7959
|
+
|
|
7960
|
+
uri: string;
|
|
7961
|
+
}): Promise<HomeyAPIV3Cloud.ManagerFlow.FlowCardCondition>;
|
|
7962
|
+
|
|
7943
7963
|
getFlowCardConditions(): Promise<{
|
|
7944
7964
|
[key: string]: HomeyAPIV3Cloud.ManagerFlow.FlowCardCondition;
|
|
7945
7965
|
}>;
|
|
@@ -7958,6 +7978,12 @@ export namespace HomeyAPIV3Cloud {
|
|
|
7958
7978
|
droptoken?: string;
|
|
7959
7979
|
}): Promise<any>;
|
|
7960
7980
|
|
|
7981
|
+
getFlowCardAction(opts: {
|
|
7982
|
+
id: string;
|
|
7983
|
+
|
|
7984
|
+
uri: string;
|
|
7985
|
+
}): Promise<HomeyAPIV3Cloud.ManagerFlow.FlowCardAction>;
|
|
7986
|
+
|
|
7961
7987
|
getFlowCardActions(): Promise<{
|
|
7962
7988
|
[key: string]: HomeyAPIV3Cloud.ManagerFlow.FlowCardAction;
|
|
7963
7989
|
}>;
|
|
@@ -8021,6 +8047,12 @@ export namespace HomeyAPIV3Cloud {
|
|
|
8021
8047
|
getFlowTokens(): Promise<{
|
|
8022
8048
|
[key: string]: HomeyAPIV3Cloud.ManagerFlowToken.FlowToken;
|
|
8023
8049
|
}>;
|
|
8050
|
+
|
|
8051
|
+
getFlowToken(opts: {
|
|
8052
|
+
id: string;
|
|
8053
|
+
}): Promise<HomeyAPIV3Cloud.ManagerFlowToken.FlowToken>;
|
|
8054
|
+
|
|
8055
|
+
getFlowTokenValue(opts: { id: string }): Promise<any>;
|
|
8024
8056
|
}
|
|
8025
8057
|
|
|
8026
8058
|
export class ManagerGeolocation extends HomeyAPIV3.ManagerGeolocation {
|
|
@@ -8036,12 +8068,6 @@ export namespace HomeyAPIV3Cloud {
|
|
|
8036
8068
|
|
|
8037
8069
|
unsetOptionLocation(): Promise<any>;
|
|
8038
8070
|
|
|
8039
|
-
getOptionMode(): Promise<any>;
|
|
8040
|
-
|
|
8041
|
-
setOptionMode(opts: { value: any }): Promise<any>;
|
|
8042
|
-
|
|
8043
|
-
unsetOptionMode(): Promise<any>;
|
|
8044
|
-
|
|
8045
8071
|
getState(): Promise<any>;
|
|
8046
8072
|
}
|
|
8047
8073
|
|
|
@@ -8104,6 +8130,10 @@ export namespace HomeyAPIV3Cloud {
|
|
|
8104
8130
|
export class ManagerLogic extends HomeyAPIV3.ManagerLogic {
|
|
8105
8131
|
getState(): Promise<any>;
|
|
8106
8132
|
|
|
8133
|
+
getVariable(opts: {
|
|
8134
|
+
id: string;
|
|
8135
|
+
}): Promise<HomeyAPIV3Cloud.ManagerLogic.Variable>;
|
|
8136
|
+
|
|
8107
8137
|
getVariables(): Promise<{
|
|
8108
8138
|
[key: string]: HomeyAPIV3Cloud.ManagerLogic.Variable;
|
|
8109
8139
|
}>;
|
|
@@ -8194,6 +8224,8 @@ export namespace HomeyAPIV3Cloud {
|
|
|
8194
8224
|
value?: boolean;
|
|
8195
8225
|
}): Promise<any>;
|
|
8196
8226
|
|
|
8227
|
+
getPresent(opts: { id: string }): Promise<any>;
|
|
8228
|
+
|
|
8197
8229
|
setAsleepMe(opts: {
|
|
8198
8230
|
value?: boolean;
|
|
8199
8231
|
|
|
@@ -8207,6 +8239,8 @@ export namespace HomeyAPIV3Cloud {
|
|
|
8207
8239
|
|
|
8208
8240
|
value?: boolean;
|
|
8209
8241
|
}): Promise<any>;
|
|
8242
|
+
|
|
8243
|
+
getAsleep(opts: { id: string }): Promise<any>;
|
|
8210
8244
|
}
|
|
8211
8245
|
|
|
8212
8246
|
export class ManagerRF extends HomeyAPIV3.ManagerRF {
|
|
@@ -8363,6 +8397,14 @@ export namespace HomeyAPIV3Cloud {
|
|
|
8363
8397
|
|
|
8364
8398
|
opts?: object;
|
|
8365
8399
|
}): Promise<any>;
|
|
8400
|
+
|
|
8401
|
+
verifyFirmware(): Promise<any>;
|
|
8402
|
+
|
|
8403
|
+
flashFirmware(opts: { keepNV: boolean }): Promise<any>;
|
|
8404
|
+
|
|
8405
|
+
getLastFlashResult(): Promise<any>;
|
|
8406
|
+
|
|
8407
|
+
eraseNV(): Promise<any>;
|
|
8366
8408
|
}
|
|
8367
8409
|
|
|
8368
8410
|
export class ManagerZones extends HomeyAPIV3.ManagerZones {
|
|
@@ -8370,6 +8412,8 @@ export namespace HomeyAPIV3Cloud {
|
|
|
8370
8412
|
|
|
8371
8413
|
getZones(): Promise<{ [key: string]: HomeyAPIV3Cloud.ManagerZones.Zone }>;
|
|
8372
8414
|
|
|
8415
|
+
getZone(opts: { id: string }): Promise<HomeyAPIV3Cloud.ManagerZones.Zone>;
|
|
8416
|
+
|
|
8373
8417
|
createZone(opts: {
|
|
8374
8418
|
zone: {
|
|
8375
8419
|
name: string;
|
|
@@ -9356,9 +9400,9 @@ export namespace HomeyAPIV3Local {
|
|
|
9356
9400
|
|
|
9357
9401
|
getExperiments(): Promise<any>;
|
|
9358
9402
|
|
|
9359
|
-
enableExperiment(opts: {
|
|
9403
|
+
enableExperiment(opts: { id: string }): Promise<any>;
|
|
9360
9404
|
|
|
9361
|
-
disableExperiment(opts: {
|
|
9405
|
+
disableExperiment(opts: { id: string }): Promise<any>;
|
|
9362
9406
|
}
|
|
9363
9407
|
|
|
9364
9408
|
export class ManagerFlow extends HomeyAPIV3.ManagerFlow {
|
|
@@ -9692,7 +9736,27 @@ export namespace HomeyAPIV3Local {
|
|
|
9692
9736
|
}
|
|
9693
9737
|
|
|
9694
9738
|
export class ManagerMatter extends HomeyAPIV3.ManagerMatter {
|
|
9739
|
+
getOptionPaaSettings(): Promise<any>;
|
|
9740
|
+
|
|
9741
|
+
setOptionPaaSettings(opts: { value: any }): Promise<any>;
|
|
9742
|
+
|
|
9743
|
+
unsetOptionPaaSettings(): Promise<any>;
|
|
9744
|
+
|
|
9695
9745
|
getState(): Promise<any>;
|
|
9746
|
+
|
|
9747
|
+
pairApi(opts: {
|
|
9748
|
+
code: string;
|
|
9749
|
+
|
|
9750
|
+
zone?: string;
|
|
9751
|
+
}): Promise<any>;
|
|
9752
|
+
|
|
9753
|
+
updateDCLPaaCerts(): Promise<any>;
|
|
9754
|
+
|
|
9755
|
+
interview(opts: { nodeId: string }): Promise<any>;
|
|
9756
|
+
|
|
9757
|
+
makeDeviceApi(opts: { nodeId: string }): Promise<any>;
|
|
9758
|
+
|
|
9759
|
+
readBasicInformation(opts: { nodeId: string }): Promise<any>;
|
|
9696
9760
|
}
|
|
9697
9761
|
|
|
9698
9762
|
export class ManagerMobile extends HomeyAPIV3.ManagerMobile {
|
|
@@ -9851,6 +9915,10 @@ export namespace HomeyAPIV3Local {
|
|
|
9851
9915
|
rebootOTA(): Promise<any>;
|
|
9852
9916
|
|
|
9853
9917
|
setDebug(opts: { namespace: string }): Promise<any>;
|
|
9918
|
+
|
|
9919
|
+
enableWifi(): Promise<any>;
|
|
9920
|
+
|
|
9921
|
+
disableWifi(): Promise<any>;
|
|
9854
9922
|
}
|
|
9855
9923
|
|
|
9856
9924
|
export class ManagerThread extends HomeyAPIV3.ManagerThread {
|
|
@@ -10009,6 +10077,8 @@ export namespace HomeyAPIV3Local {
|
|
|
10009
10077
|
getLog(): Promise<any>;
|
|
10010
10078
|
|
|
10011
10079
|
setLogEnabled(opts: { enabled: boolean }): Promise<any>;
|
|
10080
|
+
|
|
10081
|
+
setLBTThreshold(opts: { threshold: number }): Promise<any>;
|
|
10012
10082
|
}
|
|
10013
10083
|
}
|
|
10014
10084
|
|
|
@@ -40,6 +40,7 @@ class User extends APIDefinition {
|
|
|
40
40
|
*/
|
|
41
41
|
getHomeyById(id) {
|
|
42
42
|
const homey = this.homeys.find(homey => homey.id === id);
|
|
43
|
+
|
|
43
44
|
if (!homey) {
|
|
44
45
|
throw new Error(`Homey Not Found: ${id}`);
|
|
45
46
|
}
|
|
@@ -52,6 +53,7 @@ class User extends APIDefinition {
|
|
|
52
53
|
*/
|
|
53
54
|
getFirstHomey() {
|
|
54
55
|
const homey = this.homeys[0];
|
|
56
|
+
|
|
55
57
|
if (!homey) {
|
|
56
58
|
throw new Error('No Homey Available');
|
|
57
59
|
}
|
package/lib/AthomCloudAPI.js
CHANGED
|
@@ -126,17 +126,10 @@ for(const {@link HomeyAPIV2.ManagerDevices.Device device} of Object.values(devic
|
|
|
126
126
|
*/
|
|
127
127
|
async isLoggedIn() {
|
|
128
128
|
const store = await this.__getStore();
|
|
129
|
-
if (!store.token
|
|
130
|
-
|| !store.token.access_token) return false;
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
return true;
|
|
137
|
-
} catch (err) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
130
|
+
if (!store.token || !store.token.access_token) return false;
|
|
131
|
+
|
|
132
|
+
return true;
|
|
140
133
|
}
|
|
141
134
|
|
|
142
135
|
/**
|
|
@@ -145,20 +138,56 @@ for(const {@link HomeyAPIV2.ManagerDevices.Device device} of Object.values(devic
|
|
|
145
138
|
* @param {object} [opts.$cache=true] - Use the cache
|
|
146
139
|
* @returns {Promise<AthomCloudAPI.User>}
|
|
147
140
|
*/
|
|
148
|
-
async getAuthenticatedUser({
|
|
149
|
-
$cache = true,
|
|
150
|
-
} = {}) {
|
|
141
|
+
async getAuthenticatedUser({ $cache = true } = {}) {
|
|
151
142
|
if ($cache === true && this.__user instanceof User) {
|
|
152
143
|
return this.__user;
|
|
153
144
|
}
|
|
154
145
|
|
|
146
|
+
const properties = await this.call({
|
|
147
|
+
method: 'get',
|
|
148
|
+
path: '/user/me',
|
|
149
|
+
});
|
|
150
|
+
|
|
155
151
|
this.__user = new User({
|
|
156
152
|
api: this,
|
|
157
|
-
properties:
|
|
158
|
-
method: 'get',
|
|
159
|
-
path: '/user/me',
|
|
160
|
-
}),
|
|
153
|
+
properties: properties,
|
|
161
154
|
});
|
|
155
|
+
|
|
156
|
+
return this.__user;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async getAuthenticatedUserFromStore({ $cache = true } = {}) {
|
|
160
|
+
if ($cache === true && this.__user instanceof User) {
|
|
161
|
+
return this.__user;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if ($cache === true && this.__user == null) {
|
|
165
|
+
const store = await this.__getStore();
|
|
166
|
+
|
|
167
|
+
if (store.user) {
|
|
168
|
+
this.__user = new User({
|
|
169
|
+
api: this,
|
|
170
|
+
properties: store.user,
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
return this.__user;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const properties = await this.call({
|
|
178
|
+
method: 'get',
|
|
179
|
+
path: '/user/me',
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
this.__user = new User({
|
|
183
|
+
api: this,
|
|
184
|
+
properties: properties,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
await this.__setStore({
|
|
188
|
+
user: properties,
|
|
189
|
+
})
|
|
190
|
+
|
|
162
191
|
return this.__user;
|
|
163
192
|
}
|
|
164
193
|
|
|
@@ -201,6 +230,31 @@ for(const {@link HomeyAPIV2.ManagerDevices.Device device} of Object.values(devic
|
|
|
201
230
|
return `${this.baseUrl}/oauth2/authorise?${search.toString()}`;
|
|
202
231
|
}
|
|
203
232
|
|
|
233
|
+
async getDelegatedLoginUrl(args = {}) {
|
|
234
|
+
if (args.baseUrl == null) {
|
|
235
|
+
throw new TypeError('baseUrl is required');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const token = await this.createDelegationToken({
|
|
239
|
+
audience: args.audience,
|
|
240
|
+
meta: args.meta,
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
const search = new URLSearchParams();
|
|
244
|
+
search.append('user_token', token);
|
|
245
|
+
|
|
246
|
+
if (typeof args.state === 'string') {
|
|
247
|
+
search.append('state', args.state);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (typeof args.resource === 'string') {
|
|
251
|
+
search.append('resource', args.resource);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const seperator = args.baseUrl.indexOf('?') >= 0 ? '&' : '?';
|
|
255
|
+
return args.baseUrl + seperator + search.toString();
|
|
256
|
+
}
|
|
257
|
+
|
|
204
258
|
/**
|
|
205
259
|
* Logout and delete the local token.
|
|
206
260
|
* @returns {Promise<void>}
|
package/lib/EventEmitter.js
CHANGED