homey-api 3.16.0 → 3.16.1
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/HomeyAPI.js
CHANGED
|
@@ -228,20 +228,6 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
228
228
|
throw new Error('No Discovery Strategies Available');
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
// TODO
|
|
232
|
-
// maybe we should always ping
|
|
233
|
-
|
|
234
|
-
// Don't discover, just set the only strategy
|
|
235
|
-
if (Object.keys(urls).length === 1) {
|
|
236
|
-
this.__baseUrl = Object.values(urls)[0];
|
|
237
|
-
this.__strategyId = Object.keys(urls)[0];
|
|
238
|
-
|
|
239
|
-
return {
|
|
240
|
-
baseUrl: this.__baseUrl,
|
|
241
|
-
strategyId: this.__strategyId,
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
|
|
245
231
|
this.__debug(`Discovery Strategies: ${Object.keys(urls).join(',')}`);
|
|
246
232
|
|
|
247
233
|
// Create the returned Promise
|
|
@@ -448,7 +434,7 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
448
434
|
} else if (pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL]) {
|
|
449
435
|
pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL]
|
|
450
436
|
.then((result) => resolve(result))
|
|
451
|
-
.catch(() => {
|
|
437
|
+
.catch((err) => {
|
|
452
438
|
if (pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
|
|
453
439
|
pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
|
|
454
440
|
.then((result) => resolve(result))
|
|
@@ -463,12 +449,14 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
463
449
|
|
|
464
450
|
reject(new APIErrorHomeyOffline(err));
|
|
465
451
|
});
|
|
452
|
+
} else {
|
|
453
|
+
reject(new APIErrorHomeyOffline(err));
|
|
466
454
|
}
|
|
467
455
|
});
|
|
468
456
|
} else if (pings[HomeyAPI.DISCOVERY_STRATEGIES.MDNS]) {
|
|
469
457
|
pings[HomeyAPI.DISCOVERY_STRATEGIES.MDNS]
|
|
470
458
|
.then((result) => resolve(result))
|
|
471
|
-
.catch(() => {
|
|
459
|
+
.catch((err) => {
|
|
472
460
|
if (pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
|
|
473
461
|
pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
|
|
474
462
|
.then((result) => resolve(result))
|
|
@@ -483,12 +471,14 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
483
471
|
|
|
484
472
|
reject(new APIErrorHomeyOffline(err));
|
|
485
473
|
});
|
|
474
|
+
} else {
|
|
475
|
+
reject(new APIErrorHomeyOffline(err));
|
|
486
476
|
}
|
|
487
477
|
});
|
|
488
478
|
} else if (pings[HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED]) {
|
|
489
479
|
pings[HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED]
|
|
490
480
|
.then((result) => resolve(result))
|
|
491
|
-
.catch(() => {
|
|
481
|
+
.catch((err) => {
|
|
492
482
|
if (pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
|
|
493
483
|
pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
|
|
494
484
|
.then((result) => resolve(result))
|
|
@@ -503,6 +493,8 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
503
493
|
|
|
504
494
|
reject(new APIErrorHomeyOffline(err));
|
|
505
495
|
});
|
|
496
|
+
} else {
|
|
497
|
+
reject(new APIErrorHomeyOffline(err));
|
|
506
498
|
}
|
|
507
499
|
});
|
|
508
500
|
} else if (pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
|
|
@@ -660,6 +652,7 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
660
652
|
this.__token = store.token;
|
|
661
653
|
this.__session = store.session;
|
|
662
654
|
|
|
655
|
+
await this.baseUrl; // Ensure discovery has completed
|
|
663
656
|
return;
|
|
664
657
|
}
|
|
665
658
|
|
|
@@ -32,6 +32,11 @@ class HomeyAPIV3Cloud extends HomeyAPIV3 {
|
|
|
32
32
|
strategy,
|
|
33
33
|
...props,
|
|
34
34
|
});
|
|
35
|
+
|
|
36
|
+
// Seed the version cache with the initial value from the Cloud API,
|
|
37
|
+
// then remove the own data property so the prototype getter is used.
|
|
38
|
+
this.__versionCache[this.id] ??= this.version;
|
|
39
|
+
delete this.version;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
get tier() {
|
|
@@ -42,6 +47,10 @@ class HomeyAPIV3Cloud extends HomeyAPIV3 {
|
|
|
42
47
|
return this.__versionCache[this.id];
|
|
43
48
|
}
|
|
44
49
|
|
|
50
|
+
set version(value) {
|
|
51
|
+
this.__versionCache[this.id] = value;
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
get platform() {
|
|
46
55
|
return 'cloud';
|
|
47
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homey-api",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.1",
|
|
4
4
|
"description": "Homey API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "SEE LICENSE",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"homey-api": "^3.0.8",
|
|
74
74
|
"http-server": "^0.12.3",
|
|
75
75
|
"jest": "^30.0.0-alpha.2",
|
|
76
|
-
"jsdoc": "
|
|
76
|
+
"jsdoc": "4.0.5",
|
|
77
77
|
"jsdoc-to-markdown": "^8.0.0",
|
|
78
78
|
"jsdoc-ts-utils": "^4.0.0",
|
|
79
79
|
"jsdoc-tsimport-plugin": "^1.0.5",
|