homey-api 1.5.24 → 1.5.27
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.
|
@@ -837,6 +837,23 @@
|
|
|
837
837
|
}
|
|
838
838
|
}
|
|
839
839
|
},
|
|
840
|
+
"addHomeyLicense": {
|
|
841
|
+
"path": "/homey/{homeyId}/license/{license}",
|
|
842
|
+
"method": "post",
|
|
843
|
+
"private": true,
|
|
844
|
+
"parameters": {
|
|
845
|
+
"homeyId": {
|
|
846
|
+
"in": "path",
|
|
847
|
+
"type": "string",
|
|
848
|
+
"required": true
|
|
849
|
+
},
|
|
850
|
+
"license": {
|
|
851
|
+
"in": "path",
|
|
852
|
+
"type": "string",
|
|
853
|
+
"required": true
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
},
|
|
840
857
|
"createHomeyUser": {
|
|
841
858
|
"path": "/homey/{homeyId}/user",
|
|
842
859
|
"method": "post",
|
|
@@ -329,6 +329,32 @@
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
},
|
|
332
|
+
"deferSubscription": {
|
|
333
|
+
"path": "/subscription/defer",
|
|
334
|
+
"method": "post",
|
|
335
|
+
"parameters": {
|
|
336
|
+
"sku": {
|
|
337
|
+
"type": "string",
|
|
338
|
+
"in": "body"
|
|
339
|
+
},
|
|
340
|
+
"packageName": {
|
|
341
|
+
"type": "string",
|
|
342
|
+
"in": "body"
|
|
343
|
+
},
|
|
344
|
+
"athomId": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"in": "body"
|
|
347
|
+
},
|
|
348
|
+
"quantity": {
|
|
349
|
+
"type": "number",
|
|
350
|
+
"in": "body"
|
|
351
|
+
},
|
|
352
|
+
"duration": {
|
|
353
|
+
"type": "string",
|
|
354
|
+
"in": "body"
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
332
358
|
"getExpiredSubscriptions": {
|
|
333
359
|
"path": "/subscription/expired",
|
|
334
360
|
"method": "post",
|
|
@@ -2534,6 +2534,29 @@
|
|
|
2534
2534
|
|
|
2535
2535
|
|
|
2536
2536
|
|
|
2537
|
+
):
|
|
2538
|
+
Promise<any>;
|
|
2539
|
+
|
|
2540
|
+
addHomeyLicense(
|
|
2541
|
+
|
|
2542
|
+
|
|
2543
|
+
|
|
2544
|
+
|
|
2545
|
+
opts: {
|
|
2546
|
+
|
|
2547
|
+
|
|
2548
|
+
homeyId: string,
|
|
2549
|
+
|
|
2550
|
+
|
|
2551
|
+
|
|
2552
|
+
license: string,
|
|
2553
|
+
|
|
2554
|
+
|
|
2555
|
+
},
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
|
|
2537
2560
|
):
|
|
2538
2561
|
Promise<any>;
|
|
2539
2562
|
|
|
@@ -4619,6 +4642,41 @@
|
|
|
4619
4642
|
|
|
4620
4643
|
|
|
4621
4644
|
|
|
4645
|
+
):
|
|
4646
|
+
Promise<any>;
|
|
4647
|
+
|
|
4648
|
+
deferSubscription(
|
|
4649
|
+
|
|
4650
|
+
|
|
4651
|
+
|
|
4652
|
+
|
|
4653
|
+
opts: {
|
|
4654
|
+
|
|
4655
|
+
|
|
4656
|
+
sku: string,
|
|
4657
|
+
|
|
4658
|
+
|
|
4659
|
+
|
|
4660
|
+
packageName: string,
|
|
4661
|
+
|
|
4662
|
+
|
|
4663
|
+
|
|
4664
|
+
athomId: string,
|
|
4665
|
+
|
|
4666
|
+
|
|
4667
|
+
|
|
4668
|
+
quantity: number,
|
|
4669
|
+
|
|
4670
|
+
|
|
4671
|
+
|
|
4672
|
+
duration: string,
|
|
4673
|
+
|
|
4674
|
+
|
|
4675
|
+
},
|
|
4676
|
+
|
|
4677
|
+
|
|
4678
|
+
|
|
4679
|
+
|
|
4622
4680
|
):
|
|
4623
4681
|
Promise<any>;
|
|
4624
4682
|
|
|
@@ -5532,6 +5590,19 @@
|
|
|
5532
5590
|
):
|
|
5533
5591
|
string;
|
|
5534
5592
|
|
|
5593
|
+
promiseAny(
|
|
5594
|
+
|
|
5595
|
+
|
|
5596
|
+
|
|
5597
|
+
|
|
5598
|
+
promises: Array<Promise>,
|
|
5599
|
+
|
|
5600
|
+
|
|
5601
|
+
|
|
5602
|
+
|
|
5603
|
+
):
|
|
5604
|
+
Promise<any>;
|
|
5605
|
+
|
|
5535
5606
|
}
|
|
5536
5607
|
|
|
5537
5608
|
|
|
@@ -416,8 +416,8 @@ class Manager extends EventEmitter {
|
|
|
416
416
|
this.__debug('onConnect');
|
|
417
417
|
this.__connected = true;
|
|
418
418
|
},
|
|
419
|
-
onDisconnect:
|
|
420
|
-
this.__debug(
|
|
419
|
+
onDisconnect: reason => {
|
|
420
|
+
this.__debug(`onDisconnect Reason:${reason}`);
|
|
421
421
|
this.__connected = false;
|
|
422
422
|
|
|
423
423
|
// Clear CRUD Item cache
|
|
@@ -489,6 +489,7 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
489
489
|
|
|
490
490
|
await this.connect();
|
|
491
491
|
await new Promise((resolve, reject) => {
|
|
492
|
+
this.__ioNamespace.once('disconnect', reject);
|
|
492
493
|
this.__ioNamespace.emit('subscribe', uri, err => {
|
|
493
494
|
if (err) return reject(err);
|
|
494
495
|
return resolve();
|
|
@@ -504,8 +505,8 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
504
505
|
onConnect();
|
|
505
506
|
|
|
506
507
|
// On Disconnect
|
|
507
|
-
const __onDisconnect =
|
|
508
|
-
onDisconnect();
|
|
508
|
+
const __onDisconnect = reason => {
|
|
509
|
+
onDisconnect(reason);
|
|
509
510
|
};
|
|
510
511
|
this.__io.on('disconnect', __onDisconnect);
|
|
511
512
|
|
|
@@ -549,6 +550,7 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
549
550
|
return new Promise((resolve, reject) => {
|
|
550
551
|
this.__debug(`SocketIOClient ${baseUrl}`);
|
|
551
552
|
this.__io = SocketIOClient(baseUrl, {
|
|
553
|
+
autoConnect: false,
|
|
552
554
|
transports: ['websocket'],
|
|
553
555
|
transportOptions: {
|
|
554
556
|
pingTimeout: 8000,
|
|
@@ -606,6 +608,7 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
606
608
|
reject(err);
|
|
607
609
|
});
|
|
608
610
|
});
|
|
611
|
+
this.__io.connect();
|
|
609
612
|
});
|
|
610
613
|
});
|
|
611
614
|
this.io.catch(err => {
|
|
@@ -666,28 +669,29 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
666
669
|
throw err;
|
|
667
670
|
})
|
|
668
671
|
.then(({ namespace }) => {
|
|
672
|
+
this.__debug('SocketIOClient.onHandshakeClientSuccess', `Namespace: ${namespace}`);
|
|
673
|
+
|
|
669
674
|
return new Promise((resolve, reject) => {
|
|
670
|
-
this.__debug('SocketIOClient.onHandshakeClientSuccess', `Namespace: ${namespace}`);
|
|
671
675
|
this.__ioNamespace = this.__io.io.socket(namespace);
|
|
672
676
|
this.__ioNamespace.once('connect', () => {
|
|
673
|
-
this.__debug(
|
|
677
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onConnect`);
|
|
674
678
|
resolve();
|
|
675
679
|
});
|
|
676
680
|
this.__ioNamespace.once('connect_error', err => {
|
|
677
|
-
this.__debug(
|
|
681
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onConnectError`, err.message);
|
|
678
682
|
reject(err);
|
|
679
683
|
});
|
|
680
684
|
this.__ioNamespace.on('reconnecting', attempt => {
|
|
681
|
-
this.__debug(`SocketIOClient.Namespace.onReconnecting (Attempt #${attempt})`);
|
|
685
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnecting (Attempt #${attempt})`);
|
|
682
686
|
});
|
|
683
687
|
this.__ioNamespace.on('reconnect', () => {
|
|
684
|
-
this.__debug(
|
|
688
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnect`);
|
|
685
689
|
});
|
|
686
690
|
this.__ioNamespace.on('reconnect_error', err => {
|
|
687
|
-
this.__debug(
|
|
691
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnectError`, err.message);
|
|
688
692
|
});
|
|
689
693
|
this.__ioNamespace.on('disconnect', reason => {
|
|
690
|
-
this.__debug(
|
|
694
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onDisconnect`, reason);
|
|
691
695
|
});
|
|
692
696
|
this.__ioNamespace.connect();
|
|
693
697
|
});
|