homey-api 3.0.27 → 3.1.0

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.
@@ -1095,6 +1095,25 @@
1095
1095
  }
1096
1096
  }
1097
1097
  },
1098
+ "addTagToMailChimpUser": {
1099
+ "path": "/mail/mailchimp/tag",
1100
+ "method": "post",
1101
+ "private": true,
1102
+ "parameters": {
1103
+ "listId": {
1104
+ "type": "string",
1105
+ "in": "body"
1106
+ },
1107
+ "userId": {
1108
+ "type": "string",
1109
+ "in": "body"
1110
+ },
1111
+ "tag": {
1112
+ "type": "string",
1113
+ "in": "body"
1114
+ }
1115
+ }
1116
+ },
1098
1117
  "getAppInstallsStatistics": {
1099
1118
  "path": "/stats/app-installs",
1100
1119
  "method": "get",
@@ -2659,6 +2659,14 @@ export class AthomCloudAPI {
2659
2659
  userId?: string;
2660
2660
  }): Promise<any>;
2661
2661
 
2662
+ addTagToMailChimpUser(opts: {
2663
+ listId?: string;
2664
+
2665
+ userId?: string;
2666
+
2667
+ tag?: string;
2668
+ }): Promise<any>;
2669
+
2662
2670
  getAppInstallsStatistics(): Promise<any>;
2663
2671
 
2664
2672
  getAppDriversStatistics(): Promise<any>;
@@ -3183,6 +3191,14 @@ export class AthomCloudAPI {
3183
3191
  userId?: string;
3184
3192
  }): Promise<any>;
3185
3193
 
3194
+ addTagToMailChimpUser(opts: {
3195
+ listId?: string;
3196
+
3197
+ userId?: string;
3198
+
3199
+ tag?: string;
3200
+ }): Promise<any>;
3201
+
3186
3202
  getAppInstallsStatistics(): Promise<any>;
3187
3203
 
3188
3204
  getAppDriversStatistics(): Promise<any>;
@@ -5687,6 +5703,14 @@ export class AthomCloudAPI {
5687
5703
  userId?: string;
5688
5704
  }): Promise<any>;
5689
5705
 
5706
+ addTagToMailChimpUser(opts: {
5707
+ listId?: string;
5708
+
5709
+ userId?: string;
5710
+
5711
+ tag?: string;
5712
+ }): Promise<any>;
5713
+
5690
5714
  getAppInstallsStatistics(): Promise<any>;
5691
5715
 
5692
5716
  getAppDriversStatistics(): Promise<any>;
@@ -6211,6 +6235,14 @@ export class AthomCloudAPI {
6211
6235
  userId?: string;
6212
6236
  }): Promise<any>;
6213
6237
 
6238
+ addTagToMailChimpUser(opts: {
6239
+ listId?: string;
6240
+
6241
+ userId?: string;
6242
+
6243
+ tag?: string;
6244
+ }): Promise<any>;
6245
+
6214
6246
  getAppInstallsStatistics(): Promise<any>;
6215
6247
 
6216
6248
  getAppDriversStatistics(): Promise<any>;
@@ -433,7 +433,7 @@ class Manager extends EventEmitter {
433
433
  }
434
434
 
435
435
  __debug(...props) {
436
- this.homey.__debug(`[${this.constructor.name}]`, ...props);
436
+ this.homey.__debug(`[Manager${this.constructor.ID[0].toUpperCase() + this.constructor.ID.slice(1)}]`, ...props);
437
437
  }
438
438
 
439
439
  /**
@@ -625,10 +625,15 @@ class HomeyAPIV3 extends HomeyAPI {
625
625
 
626
626
  return {
627
627
  unsubscribe: () => {
628
- this.__homeySocket.emit('unsubscribe', uri);
629
- this.__homeySocket.removeListener(uri, __onEvent);
630
- this.__socket.removeListener('disconnect', __onDisconnect);
631
- this.__socket.removeListener('reconnect', __onReconnect);
628
+ if (this.__homeySocket) {
629
+ this.__homeySocket.emit('unsubscribe', uri);
630
+ this.__homeySocket.removeListener(uri, __onEvent);
631
+ }
632
+
633
+ if (this.__socket) {
634
+ this.__socket.removeListener('disconnect', __onDisconnect);
635
+ this.__socket.removeListener('reconnect', __onReconnect);
636
+ }
632
637
  },
633
638
  };
634
639
  }
@@ -713,9 +718,11 @@ class HomeyAPIV3 extends HomeyAPI {
713
718
  async disconnect() {
714
719
  // Should we wait for connect here?
715
720
 
721
+ // Also disconnect __homeySocket?
722
+
716
723
  if (this.__socket) {
717
724
  await new Promise(resolve => {
718
- this.__socket.once('disconnect', resolve());
725
+ this.__socket.once('disconnect', () => resolve());
719
726
  this.__socket.disconnect();
720
727
  this.__socket.removeAllListeners();
721
728
  this.__socket = null;
@@ -726,9 +733,16 @@ class HomeyAPIV3 extends HomeyAPI {
726
733
  }
727
734
 
728
735
  destroy() {
736
+ if (this.__homeySocket) {
737
+ this.__homeySocket.removeAllListeners();
738
+ this.__homeySocket.close();
739
+ this.__homeySocket = null;
740
+ }
741
+
729
742
  if (this.__socket) {
730
743
  this.__socket.removeAllListeners();
731
744
  this.__socket.close();
745
+ this.__socket = null;
732
746
  }
733
747
  }
734
748
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.0.27",
3
+ "version": "3.1.0",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [