homey-api 3.4.22 → 3.4.24

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.
@@ -3208,25 +3208,6 @@
3208
3208
  ],
3209
3209
  "parameters": {}
3210
3210
  },
3211
- "pairApi": {
3212
- "method": "post",
3213
- "path": "/pair",
3214
- "private": true,
3215
- "scopes": [
3216
- "homey.system"
3217
- ],
3218
- "parameters": {
3219
- "code": {
3220
- "in": "body",
3221
- "type": "string",
3222
- "required": true
3223
- },
3224
- "zone": {
3225
- "in": "body",
3226
- "type": "string"
3227
- }
3228
- }
3229
- },
3230
3211
  "updateDCLPaaCerts": {
3231
3212
  "method": "get",
3232
3213
  "path": "/update-dcl-paa-certs",
@@ -3299,6 +3280,208 @@
3299
3280
  }
3300
3281
  }
3301
3282
  },
3283
+ "ManagerMoods": {
3284
+ "id": "moods",
3285
+ "idCamelCase": "moods",
3286
+ "private": true,
3287
+ "items": {
3288
+ "Mood": {
3289
+ "id": "mood",
3290
+ "schema": {
3291
+ "type": "object",
3292
+ "properties": {
3293
+ "id": {
3294
+ "type": "string"
3295
+ },
3296
+ "name": {
3297
+ "type": "string"
3298
+ },
3299
+ "devices": {
3300
+ "type": "object",
3301
+ "additionalProperties": false,
3302
+ "patternProperties": {
3303
+ "^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$": {
3304
+ "type": "object",
3305
+ "additionalProperties": false,
3306
+ "properties": {
3307
+ "state": {
3308
+ "type": "object",
3309
+ "additionalProperties": false,
3310
+ "patternProperties": {
3311
+ ".*": {
3312
+ "anyOf": [
3313
+ {
3314
+ "type": "string"
3315
+ },
3316
+ {
3317
+ "type": "boolean"
3318
+ },
3319
+ {
3320
+ "type": "number"
3321
+ }
3322
+ ]
3323
+ }
3324
+ }
3325
+ }
3326
+ }
3327
+ }
3328
+ }
3329
+ }
3330
+ },
3331
+ "additionalProperties": false
3332
+ }
3333
+ }
3334
+ },
3335
+ "operations": {
3336
+ "getState": {
3337
+ "method": "get",
3338
+ "path": "/state",
3339
+ "private": false,
3340
+ "scopes": [
3341
+ "homey.system.readonly"
3342
+ ],
3343
+ "parameters": {}
3344
+ },
3345
+ "getMoods": {
3346
+ "method": "get",
3347
+ "path": "/mood",
3348
+ "private": false,
3349
+ "scopes": [
3350
+ "homey.mood.readonly"
3351
+ ],
3352
+ "crud": {
3353
+ "type": "getAll",
3354
+ "item": "Mood"
3355
+ },
3356
+ "parameters": {}
3357
+ },
3358
+ "getMood": {
3359
+ "method": "get",
3360
+ "path": "/mood/:id",
3361
+ "private": false,
3362
+ "scopes": [
3363
+ "homey.mood.readonly"
3364
+ ],
3365
+ "crud": {
3366
+ "type": "getOne",
3367
+ "item": "Mood"
3368
+ },
3369
+ "parameters": {
3370
+ "id": {
3371
+ "in": "path",
3372
+ "type": "string",
3373
+ "required": true
3374
+ }
3375
+ }
3376
+ },
3377
+ "createMood": {
3378
+ "method": "post",
3379
+ "path": "/mood",
3380
+ "private": false,
3381
+ "scopes": [
3382
+ "homey.mood"
3383
+ ],
3384
+ "crud": {
3385
+ "type": "createOne",
3386
+ "item": "Mood"
3387
+ },
3388
+ "parameters": {
3389
+ "mood": {
3390
+ "in": "body",
3391
+ "type": "object",
3392
+ "root": true,
3393
+ "required": true,
3394
+ "properties": {
3395
+ "name": {
3396
+ "type": "string",
3397
+ "required": true
3398
+ },
3399
+ "devices": {
3400
+ "type": "object",
3401
+ "required": true
3402
+ }
3403
+ }
3404
+ }
3405
+ }
3406
+ },
3407
+ "updateMood": {
3408
+ "method": "put",
3409
+ "path": "/mood/:id",
3410
+ "private": false,
3411
+ "scopes": [
3412
+ "homey.mood"
3413
+ ],
3414
+ "crud": {
3415
+ "type": "updateOne",
3416
+ "item": "Mood"
3417
+ },
3418
+ "parameters": {
3419
+ "id": {
3420
+ "in": "path",
3421
+ "type": "string",
3422
+ "required": true
3423
+ },
3424
+ "mood": {
3425
+ "in": "body",
3426
+ "type": "object",
3427
+ "root": true,
3428
+ "required": true,
3429
+ "properties": {
3430
+ "name": {
3431
+ "type": "string"
3432
+ },
3433
+ "devices": {
3434
+ "type": "object"
3435
+ }
3436
+ }
3437
+ }
3438
+ }
3439
+ },
3440
+ "triggerMood": {
3441
+ "method": "post",
3442
+ "path": "/mood/:id/trigger",
3443
+ "private": false,
3444
+ "scopes": [
3445
+ "homey.mood"
3446
+ ],
3447
+ "parameters": {
3448
+ "id": {
3449
+ "in": "path",
3450
+ "type": "string",
3451
+ "required": true
3452
+ }
3453
+ }
3454
+ },
3455
+ "deleteMood": {
3456
+ "method": "delete",
3457
+ "path": "/mood/:id",
3458
+ "private": false,
3459
+ "scopes": [
3460
+ "homey.mood"
3461
+ ],
3462
+ "crud": {
3463
+ "type": "deleteOne",
3464
+ "item": "Mood"
3465
+ },
3466
+ "parameters": {
3467
+ "id": {
3468
+ "in": "path",
3469
+ "type": "string",
3470
+ "required": true
3471
+ }
3472
+ }
3473
+ },
3474
+ "debug": {
3475
+ "method": "get",
3476
+ "path": "/debug",
3477
+ "private": true,
3478
+ "scopes": [
3479
+ "homey.mood"
3480
+ ],
3481
+ "parameters": {}
3482
+ }
3483
+ }
3484
+ },
3302
3485
  "ManagerNotifications": {
3303
3486
  "id": "notifications",
3304
3487
  "idCamelCase": "notifications",
@@ -3993,6 +4176,44 @@
3993
4176
  "homey.system.readonly"
3994
4177
  ],
3995
4178
  "parameters": {}
4179
+ },
4180
+ "getActiveDataset": {
4181
+ "method": "get",
4182
+ "path": "/active-dataset",
4183
+ "private": true,
4184
+ "scopes": [
4185
+ "homey.system"
4186
+ ],
4187
+ "parameters": {}
4188
+ },
4189
+ "reset": {
4190
+ "method": "get",
4191
+ "path": "/reset",
4192
+ "private": true,
4193
+ "scopes": [
4194
+ "homey.system"
4195
+ ],
4196
+ "parameters": {
4197
+ "target": {
4198
+ "in": "query",
4199
+ "type": "string"
4200
+ }
4201
+ }
4202
+ },
4203
+ "executeCommand": {
4204
+ "method": "post",
4205
+ "path": "/execute-command",
4206
+ "private": true,
4207
+ "scopes": [
4208
+ "homey.system"
4209
+ ],
4210
+ "parameters": {
4211
+ "command": {
4212
+ "in": "body",
4213
+ "type": "string",
4214
+ "required": true
4215
+ }
4216
+ }
3996
4217
  }
3997
4218
  }
3998
4219
  },
@@ -4925,6 +5146,15 @@
4925
5146
  "required": true
4926
5147
  }
4927
5148
  }
5149
+ },
5150
+ "attemptNvmFix": {
5151
+ "method": "put",
5152
+ "path": "/attempt-nvm-fix",
5153
+ "private": true,
5154
+ "scopes": [
5155
+ "homey.system"
5156
+ ],
5157
+ "parameters": {}
4928
5158
  }
4929
5159
  }
4930
5160
  }
@@ -1358,6 +1358,16 @@ export namespace HomeyAPIV3Local.ManagerLogic {
1358
1358
  }
1359
1359
  }
1360
1360
 
1361
+ export namespace HomeyAPIV3Local.ManagerMoods {
1362
+ export class Mood {
1363
+ id: string;
1364
+
1365
+ name: string;
1366
+
1367
+ devices: object;
1368
+ }
1369
+ }
1370
+
1361
1371
  export namespace HomeyAPIV3Local.ManagerNotifications {
1362
1372
  export class Notification {
1363
1373
  id: string;
@@ -9950,12 +9960,6 @@ export namespace HomeyAPIV3Local {
9950
9960
 
9951
9961
  getState(): Promise<any>;
9952
9962
 
9953
- pairApi(opts: {
9954
- code: string;
9955
-
9956
- zone?: string;
9957
- }): Promise<any>;
9958
-
9959
9963
  updateDCLPaaCerts(): Promise<any>;
9960
9964
 
9961
9965
  interview(opts: { nodeId: string }): Promise<any>;
@@ -9969,6 +9973,38 @@ export namespace HomeyAPIV3Local {
9969
9973
  getState(): Promise<any>;
9970
9974
  }
9971
9975
 
9976
+ export class ManagerMoods extends HomeyAPIV3.ManagerMoods {
9977
+ getState(): Promise<any>;
9978
+
9979
+ getMoods(): Promise<{ [key: string]: HomeyAPIV3Local.ManagerMoods.Mood }>;
9980
+
9981
+ getMood(opts: { id: string }): Promise<HomeyAPIV3Local.ManagerMoods.Mood>;
9982
+
9983
+ createMood(opts: {
9984
+ mood: {
9985
+ name: string;
9986
+
9987
+ devices: object;
9988
+ };
9989
+ }): Promise<HomeyAPIV3Local.ManagerMoods.Mood>;
9990
+
9991
+ updateMood(opts: {
9992
+ id: string;
9993
+
9994
+ mood: {
9995
+ name?: string;
9996
+
9997
+ devices?: object;
9998
+ };
9999
+ }): Promise<HomeyAPIV3Local.ManagerMoods.Mood>;
10000
+
10001
+ triggerMood(opts: { id: string }): Promise<any>;
10002
+
10003
+ deleteMood(opts: { id: string }): Promise<any>;
10004
+
10005
+ debug(): Promise<any>;
10006
+ }
10007
+
9972
10008
  export class ManagerNotifications extends HomeyAPIV3.ManagerNotifications {
9973
10009
  getState(): Promise<any>;
9974
10010
 
@@ -10129,6 +10165,12 @@ export namespace HomeyAPIV3Local {
10129
10165
 
10130
10166
  export class ManagerThread extends HomeyAPIV3.ManagerThread {
10131
10167
  getState(): Promise<any>;
10168
+
10169
+ getActiveDataset(): Promise<any>;
10170
+
10171
+ reset(opts: { target?: string }): Promise<any>;
10172
+
10173
+ executeCommand(opts: { command: string }): Promise<any>;
10132
10174
  }
10133
10175
 
10134
10176
  export class ManagerUpdates extends HomeyAPIV3.ManagerUpdates {
@@ -10291,6 +10333,8 @@ export namespace HomeyAPIV3Local {
10291
10333
  setLogEnabled(opts: { enabled: boolean }): Promise<any>;
10292
10334
 
10293
10335
  setLBTThreshold(opts: { threshold: number }): Promise<any>;
10336
+
10337
+ attemptNvmFix(): Promise<any>;
10294
10338
  }
10295
10339
  }
10296
10340
 
@@ -834,6 +834,10 @@ class HomeyAPIV3 extends HomeyAPI {
834
834
  return this.__connectPromise;
835
835
  }
836
836
 
837
+ isConnecting() {
838
+ return this.__connectPromise != null;
839
+ }
840
+
837
841
  async disconnect() {
838
842
  // Should we wait for connect here?
839
843
 
package/lib/Util.js CHANGED
@@ -236,16 +236,21 @@ class Util {
236
236
  static async promiseAny(promises) {
237
237
  if (promises.length === 0) return;
238
238
  const rejections = [];
239
+ let rejectionCount = 0;
239
240
 
240
241
  return new Promise((resolve, reject) => {
241
242
  promises.forEach((promise, i) => {
242
243
  promise
243
244
  .then(result => resolve(result))
244
245
  .catch(err => {
246
+ rejectionCount = rejectionCount + 1;
245
247
  rejections[i] = err;
246
248
 
247
249
  // Check if all promises have been rejected
248
- if (rejections.filter(Boolean).length === promises.length) {
250
+ if (rejectionCount === promises.length) {
251
+ const error = new Error('All Promises rejected');
252
+ error.error = rejections;
253
+ error.name = 'AggregateError';
249
254
  reject(rejections);
250
255
  }
251
256
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.4.22",
3
+ "version": "3.4.24",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [