homey-api 3.4.12 → 3.4.13
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.
|
@@ -29,7 +29,7 @@ class Homey extends APIDefinition {
|
|
|
29
29
|
* @param {string|array} [opts.strategy] - One string, or an array of {@link HomeyAPI#DISCOVERY_STRATEGIES} strings, to connect to the Homey.
|
|
30
30
|
* @returns {Promise<HomeyAPI>}
|
|
31
31
|
*/
|
|
32
|
-
async authenticate({ strategy } = {}) {
|
|
32
|
+
async authenticate({ strategy, reconnect } = {}) {
|
|
33
33
|
const HomeyAPI = (() => {
|
|
34
34
|
if (this.apiVersion === 1) return HomeyAPIV1;
|
|
35
35
|
if (this.apiVersion === 2) return HomeyAPIV2;
|
|
@@ -40,6 +40,7 @@ class Homey extends APIDefinition {
|
|
|
40
40
|
|
|
41
41
|
const homey = new HomeyAPI({
|
|
42
42
|
strategy,
|
|
43
|
+
reconnect,
|
|
43
44
|
api: this.__api,
|
|
44
45
|
properties: this.__properties,
|
|
45
46
|
debug: (...props) => {
|
|
@@ -49,6 +49,7 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
49
49
|
baseUrl = null,
|
|
50
50
|
token = null,
|
|
51
51
|
session = null,
|
|
52
|
+
reconnect = true,
|
|
52
53
|
...props
|
|
53
54
|
}) {
|
|
54
55
|
super({ properties, ...props });
|
|
@@ -65,6 +66,12 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
65
66
|
writable: true,
|
|
66
67
|
});
|
|
67
68
|
|
|
69
|
+
Object.defineProperty(this, '__reconnect', {
|
|
70
|
+
value: reconnect,
|
|
71
|
+
enumerable: false,
|
|
72
|
+
writable: true,
|
|
73
|
+
});
|
|
74
|
+
|
|
68
75
|
Object.defineProperty(this, '__token', {
|
|
69
76
|
value: token,
|
|
70
77
|
enumerable: false,
|
|
@@ -655,9 +662,7 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
655
662
|
};
|
|
656
663
|
}
|
|
657
664
|
|
|
658
|
-
async connect({
|
|
659
|
-
reconnect = true
|
|
660
|
-
} = {}) {
|
|
665
|
+
async connect() {
|
|
661
666
|
if (!this.__connectPromise) {
|
|
662
667
|
this.__connectPromise = Promise.resolve().then(async () => {
|
|
663
668
|
// Ensure Base URL
|
|
@@ -676,7 +681,7 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
676
681
|
pingTimeout: 8000,
|
|
677
682
|
pingInterval: 5000,
|
|
678
683
|
},
|
|
679
|
-
reconnection:
|
|
684
|
+
reconnection: this.__reconnect,
|
|
680
685
|
});
|
|
681
686
|
|
|
682
687
|
this.__socket.on('disconnect', reason => {
|