@switchbot/homebridge-switchbot 1.2.1-beta.0 → 1.2.1-beta.4

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/config.schema.json +2 -2
  3. package/dist/devices/bots.d.ts +1 -1
  4. package/dist/devices/bots.d.ts.map +1 -1
  5. package/dist/devices/bots.js +26 -21
  6. package/dist/devices/bots.js.map +1 -1
  7. package/dist/devices/colorbulb.d.ts.map +1 -1
  8. package/dist/devices/colorbulb.js +1 -0
  9. package/dist/devices/colorbulb.js.map +1 -1
  10. package/dist/devices/contact.d.ts.map +1 -1
  11. package/dist/devices/contact.js +1 -0
  12. package/dist/devices/contact.js.map +1 -1
  13. package/dist/devices/curtains.d.ts +2 -2
  14. package/dist/devices/curtains.d.ts.map +1 -1
  15. package/dist/devices/curtains.js +7 -5
  16. package/dist/devices/curtains.js.map +1 -1
  17. package/dist/devices/humidifiers.d.ts.map +1 -1
  18. package/dist/devices/humidifiers.js +3 -1
  19. package/dist/devices/humidifiers.js.map +1 -1
  20. package/dist/devices/meters.d.ts.map +1 -1
  21. package/dist/devices/meters.js +1 -0
  22. package/dist/devices/meters.js.map +1 -1
  23. package/dist/devices/motion.d.ts.map +1 -1
  24. package/dist/devices/motion.js +1 -0
  25. package/dist/devices/motion.js.map +1 -1
  26. package/dist/irdevices/airconditioners.js +2 -2
  27. package/dist/irdevices/airconditioners.js.map +1 -1
  28. package/dist/irdevices/airpurifiers.js +2 -2
  29. package/dist/irdevices/airpurifiers.js.map +1 -1
  30. package/dist/irdevices/cameras.js +2 -2
  31. package/dist/irdevices/cameras.js.map +1 -1
  32. package/dist/irdevices/fans.js +2 -2
  33. package/dist/irdevices/fans.js.map +1 -1
  34. package/dist/irdevices/lights.js +2 -2
  35. package/dist/irdevices/lights.js.map +1 -1
  36. package/dist/irdevices/others.js +2 -2
  37. package/dist/irdevices/others.js.map +1 -1
  38. package/dist/irdevices/waterheaters.js +2 -2
  39. package/dist/irdevices/waterheaters.js.map +1 -1
  40. package/dist/platform.d.ts.map +1 -1
  41. package/dist/platform.js +29 -25
  42. package/dist/platform.js.map +1 -1
  43. package/package.json +5 -5
  44. package/src/devices/bots.ts +28 -22
  45. package/src/devices/colorbulb.ts +1 -0
  46. package/src/devices/contact.ts +1 -0
  47. package/src/devices/curtains.ts +11 -7
  48. package/src/devices/humidifiers.ts +3 -1
  49. package/src/devices/meters.ts +1 -0
  50. package/src/devices/motion.ts +1 -0
  51. package/src/irdevices/airconditioners.ts +2 -2
  52. package/src/irdevices/airpurifiers.ts +2 -2
  53. package/src/irdevices/cameras.ts +2 -2
  54. package/src/irdevices/fans.ts +2 -2
  55. package/src/irdevices/lights.ts +2 -2
  56. package/src/irdevices/others.ts +2 -2
  57. package/src/irdevices/waterheaters.ts +2 -2
  58. package/src/platform.ts +29 -25
@@ -264,8 +264,8 @@ export class Fan {
264
264
  this.platform.log.error(`Fan: ${this.accessory.displayName} Hub Device is offline.`);
265
265
  break;
266
266
  case 190:
267
- this.platform.log.error(`Fan: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,`
268
- + ` Or command: ${JSON.stringify(push.data)} format is invalid`);
267
+ this.platform.log.error(`Fan: ${this.accessory.displayName} Device internal error due to device states not synchronized`
268
+ + ` with server, Or command: ${JSON.stringify(push.data)} format is invalid`);
269
269
  break;
270
270
  case 100:
271
271
  this.platform.debug(`Fan: ${this.accessory.displayName} Command successfully sent.`);
@@ -176,8 +176,8 @@ export class Light {
176
176
  this.platform.log.error(`Light: ${this.accessory.displayName} Hub Device is offline.`);
177
177
  break;
178
178
  case 190:
179
- this.platform.log.error(`Light: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,`
180
- + ` Or command: ${JSON.stringify(push.data)} format is invalid`);
179
+ this.platform.log.error(`Light: ${this.accessory.displayName} Device internal error due to device states not synchronized`
180
+ + ` with server, Or command: ${JSON.stringify(push.data)} format is invalid`);
181
181
  break;
182
182
  case 100:
183
183
  this.platform.debug(`Light: ${this.accessory.displayName} Command successfully sent.`);
@@ -163,8 +163,8 @@ export class Others {
163
163
  this.platform.log.error(`Other: ${this.accessory.displayName} Hub Device is offline.`);
164
164
  break;
165
165
  case 190:
166
- this.platform.log.error(`Other: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,`
167
- + ` Or command: ${JSON.stringify(push.data)} format is invalid`);
166
+ this.platform.log.error(`Other: ${this.accessory.displayName} Device internal error due to device states not synchronized`
167
+ + ` with server, Or command: ${JSON.stringify(push.data)} format is invalid`);
168
168
  break;
169
169
  case 100:
170
170
  this.platform.debug(`Other: ${this.accessory.displayName} Command successfully sent.`);
@@ -156,8 +156,8 @@ export class WaterHeater {
156
156
  this.platform.log.error(`Water Heater: ${this.accessory.displayName} Hub Device is offline.`);
157
157
  break;
158
158
  case 190:
159
- this.platform.log.error(`Water Heater: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,`
160
- + ` Or command: ${JSON.stringify(push.data)} format is invalid`);
159
+ this.platform.log.error(`Water Heater: ${this.accessory.displayName} Device internal error due to device states not synchronized`
160
+ + ` with server, Or command: ${JSON.stringify(push.data)} format is invalid`);
161
161
  break;
162
162
  case 100:
163
163
  this.platform.debug(`Water Heater: ${this.accessory.displayName} Command successfully sent.`);
package/src/platform.ts CHANGED
@@ -444,7 +444,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
444
444
  accessory.context.model = device.deviceType;
445
445
  accessory.context.deviceID = device.deviceId;
446
446
  accessory.context.firmwareRevision = this.version;
447
- await this.connectionTypeExistingAccessory(device, accessory);
447
+ await this.connectionTypeNewAccessory(device, accessory);
448
448
  // create the accessory handler for the newly create accessory
449
449
  // this is imported from `platformAccessory.ts`
450
450
  new Humidifier(this, accessory, device);
@@ -501,7 +501,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
501
501
  accessory.context.model = device.deviceType;
502
502
  accessory.context.deviceID = device.deviceId;
503
503
  accessory.context.firmwareRevision = this.version;
504
- await this.connectionTypeExistingAccessory(device, accessory);
504
+ await this.connectionTypeNewAccessory(device, accessory);
505
505
  // accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
506
506
  // create the accessory handler for the newly create accessory
507
507
  // this is imported from `platformAccessory.ts`
@@ -555,7 +555,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
555
555
  accessory.context.model = device.deviceType;
556
556
  accessory.context.deviceID = device.deviceId;
557
557
  accessory.context.firmwareRevision = this.version;
558
- await this.connectionTypeExistingAccessory(device, accessory);
558
+ await this.connectionTypeNewAccessory(device, accessory);
559
559
  // create the accessory handler for the newly create accessory
560
560
  // this is imported from `platformAccessory.ts`
561
561
  new Meter(this, accessory, device);
@@ -586,6 +586,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
586
586
  existingAccessory.context.deviceID = device.deviceId;
587
587
  existingAccessory.displayName = device.deviceName;
588
588
  existingAccessory.context.firmwareRevision = this.version;
589
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
589
590
  this.api.updatePlatformAccessories([existingAccessory]);
590
591
  // create the accessory handler for the restored accessory
591
592
  // this is imported from `platformAccessory.ts`
@@ -607,6 +608,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
607
608
  accessory.context.model = device.deviceType;
608
609
  accessory.context.deviceID = device.deviceId;
609
610
  accessory.context.firmwareRevision = this.version;
611
+ await this.connectionTypeNewAccessory(device, accessory);
610
612
  // create the accessory handler for the newly create accessory
611
613
  // this is imported from `platformAccessory.ts`
612
614
  new Motion(this, accessory, device);
@@ -637,6 +639,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
637
639
  existingAccessory.context.deviceID = device.deviceId;
638
640
  existingAccessory.displayName = device.deviceName;
639
641
  existingAccessory.context.firmwareRevision = this.version;
642
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
640
643
  this.api.updatePlatformAccessories([existingAccessory]);
641
644
  // create the accessory handler for the restored accessory
642
645
  // this is imported from `platformAccessory.ts`
@@ -658,6 +661,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
658
661
  accessory.context.model = device.deviceType;
659
662
  accessory.context.deviceID = device.deviceId;
660
663
  accessory.context.firmwareRevision = this.version;
664
+ await this.connectionTypeNewAccessory(device, accessory);
661
665
  // create the accessory handler for the newly create accessory
662
666
  // this is imported from `platformAccessory.ts`
663
667
  new Contact(this, accessory, device);
@@ -720,7 +724,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
720
724
  accessory.context.model = device.deviceType;
721
725
  accessory.context.deviceID = device.deviceId;
722
726
  accessory.context.firmwareRevision = this.version;
723
- await this.connectionTypeExistingAccessory(device, accessory);
727
+ await this.connectionTypeNewAccessory(device, accessory);
724
728
  // create the accessory handler for the newly create accessory
725
729
  // this is imported from `platformAccessory.ts`
726
730
  new Curtain(this, accessory, device);
@@ -786,7 +790,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
786
790
  accessory.context.model = device.deviceType;
787
791
  accessory.context.deviceID = device.deviceId;
788
792
  accessory.context.firmwareRevision = this.version;
789
- await this.connectionTypeExistingAccessory(device, accessory);
793
+ await this.connectionTypeNewAccessory(device, accessory);
790
794
  // create the accessory handler for the newly create accessory
791
795
  // this is imported from `platformAccessory.ts`
792
796
  new Plug(this, accessory, device);
@@ -839,7 +843,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
839
843
  accessory.context.model = device.deviceType;
840
844
  accessory.context.deviceID = device.deviceId;
841
845
  accessory.context.firmwareRevision = this.version;
842
- await this.connectionTypeExistingAccessory(device, accessory);
846
+ await this.connectionTypeNewAccessory(device, accessory);
843
847
  // create the accessory handler for the newly create accessory
844
848
  // this is imported from `platformAccessory.ts`
845
849
  new ColorBulb(this, accessory, device);
@@ -892,7 +896,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
892
896
  accessory.context.model = device.deviceType;
893
897
  accessory.context.deviceID = device.deviceId;
894
898
  accessory.context.firmwareRevision = this.version;
895
- await this.connectionTypeExistingAccessory(device, accessory);
899
+ await this.connectionTypeNewAccessory(device, accessory);
896
900
  // create the accessory handler for the newly create accessory
897
901
  // this is imported from `platformAccessory.ts`
898
902
  new IndoorCam(this, accessory, device);
@@ -921,7 +925,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
921
925
  existingAccessory.context.deviceID = device.deviceId;
922
926
  existingAccessory.displayName = device.deviceName;
923
927
  existingAccessory.context.firmwareRevision = this.version;
924
- existingAccessory.context.connectionType = 'OpenAPI';
928
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
925
929
  this.api.updatePlatformAccessories([existingAccessory]);
926
930
  // create the accessory handler for the restored accessory
927
931
  // this is imported from `platformAccessory.ts`
@@ -940,7 +944,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
940
944
  accessory.context.model = device.remoteType;
941
945
  accessory.context.deviceID = device.deviceId;
942
946
  accessory.context.firmwareRevision = this.version;
943
- accessory.context.connectionType = 'OpenAPI';
947
+ await this.connectionTypeNewAccessory(device, accessory);
944
948
  // create the accessory handler for the newly create accessory
945
949
  // this is imported from `platformAccessory.ts`
946
950
  new TV(this, accessory, device);
@@ -976,7 +980,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
976
980
  existingAccessory.context.deviceID = device.deviceId;
977
981
  existingAccessory.displayName = device.deviceName;
978
982
  existingAccessory.context.firmwareRevision = this.version;
979
- existingAccessory.context.connectionType = 'OpenAPI';
983
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
980
984
  this.api.updatePlatformAccessories([existingAccessory]);
981
985
  // create the accessory handler for the restored accessory
982
986
  // this is imported from `platformAccessory.ts`
@@ -998,7 +1002,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
998
1002
  accessory.context.model = device.remoteType;
999
1003
  accessory.context.deviceID = device.deviceId;
1000
1004
  accessory.context.firmwareRevision = this.version;
1001
- accessory.context.connectionType = 'OpenAPI';
1005
+ await this.connectionTypeNewAccessory(device, accessory);
1002
1006
  // create the accessory handler for the newly create accessory
1003
1007
  // this is imported from `platformAccessory.ts`
1004
1008
  new Fan(this, accessory, device);
@@ -1029,7 +1033,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1029
1033
  existingAccessory.context.deviceID = device.deviceId;
1030
1034
  existingAccessory.displayName = device.deviceName;
1031
1035
  existingAccessory.context.firmwareRevision = this.version;
1032
- existingAccessory.context.connectionType = 'OpenAPI';
1036
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
1033
1037
  this.api.updatePlatformAccessories([existingAccessory]);
1034
1038
  // create the accessory handler for the restored accessory
1035
1039
  // this is imported from `platformAccessory.ts`
@@ -1051,7 +1055,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1051
1055
  accessory.context.model = device.remoteType;
1052
1056
  accessory.context.deviceID = device.deviceId;
1053
1057
  accessory.context.firmwareRevision = this.version;
1054
- accessory.context.connectionType = 'OpenAPI';
1058
+ await this.connectionTypeNewAccessory(device, accessory);
1055
1059
  // create the accessory handler for the newly create accessory
1056
1060
  // this is imported from `platformAccessory.ts`
1057
1061
  new Light(this, accessory, device);
@@ -1082,7 +1086,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1082
1086
  existingAccessory.context.deviceID = device.deviceId;
1083
1087
  existingAccessory.displayName = device.deviceName;
1084
1088
  existingAccessory.context.firmwareRevision = this.version;
1085
- existingAccessory.context.connectionType = 'OpenAPI';
1089
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
1086
1090
  this.api.updatePlatformAccessories([existingAccessory]);
1087
1091
  // create the accessory handler for the restored accessory
1088
1092
  // this is imported from `platformAccessory.ts`
@@ -1104,7 +1108,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1104
1108
  accessory.context.model = device.remoteType;
1105
1109
  accessory.context.deviceID = device.deviceId;
1106
1110
  accessory.context.firmwareRevision = this.version;
1107
- accessory.context.connectionType = 'OpenAPI';
1111
+ await this.connectionTypeNewAccessory(device, accessory);
1108
1112
  // create the accessory handler for the newly create accessory
1109
1113
  // this is imported from `platformAccessory.ts`
1110
1114
  new AirConditioner(this, accessory, device);
@@ -1135,7 +1139,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1135
1139
  existingAccessory.context.deviceID = device.deviceId;
1136
1140
  existingAccessory.displayName = device.deviceName;
1137
1141
  existingAccessory.context.firmwareRevision = this.version;
1138
- existingAccessory.context.connectionType = 'OpenAPI';
1142
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
1139
1143
  this.api.updatePlatformAccessories([existingAccessory]);
1140
1144
  // create the accessory handler for the restored accessory
1141
1145
  // this is imported from `platformAccessory.ts`
@@ -1157,7 +1161,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1157
1161
  accessory.context.model = device.remoteType;
1158
1162
  accessory.context.deviceID = device.deviceId;
1159
1163
  accessory.context.firmwareRevision = this.version;
1160
- accessory.context.connectionType = 'OpenAPI';
1164
+ await this.connectionTypeNewAccessory(device, accessory);
1161
1165
  // create the accessory handler for the newly create accessory
1162
1166
  // this is imported from `platformAccessory.ts`
1163
1167
  new AirPurifier(this, accessory, device);
@@ -1188,7 +1192,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1188
1192
  existingAccessory.context.deviceID = device.deviceId;
1189
1193
  existingAccessory.displayName = device.deviceName;
1190
1194
  existingAccessory.context.firmwareRevision = this.version;
1191
- existingAccessory.context.connectionType = 'OpenAPI';
1195
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
1192
1196
  this.api.updatePlatformAccessories([existingAccessory]);
1193
1197
  // create the accessory handler for the restored accessory
1194
1198
  // this is imported from `platformAccessory.ts`
@@ -1210,7 +1214,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1210
1214
  accessory.context.model = device.remoteType;
1211
1215
  accessory.context.deviceID = device.deviceId;
1212
1216
  accessory.context.firmwareRevision = this.version;
1213
- accessory.context.connectionType = 'OpenAPI';
1217
+ await this.connectionTypeNewAccessory(device, accessory);
1214
1218
  // create the accessory handler for the newly create accessory
1215
1219
  // this is imported from `platformAccessory.ts`
1216
1220
  new WaterHeater(this, accessory, device);
@@ -1241,7 +1245,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1241
1245
  existingAccessory.context.deviceID = device.deviceId;
1242
1246
  existingAccessory.displayName = device.deviceName;
1243
1247
  existingAccessory.context.firmwareRevision = this.version;
1244
- existingAccessory.context.connectionType = 'OpenAPI';
1248
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
1245
1249
  this.api.updatePlatformAccessories([existingAccessory]);
1246
1250
  // create the accessory handler for the restored accessory
1247
1251
  // this is imported from `platformAccessory.ts`
@@ -1263,7 +1267,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1263
1267
  accessory.context.model = device.remoteType;
1264
1268
  accessory.context.deviceID = device.deviceId;
1265
1269
  accessory.context.firmwareRevision = this.version;
1266
- accessory.context.connectionType = 'OpenAPI';
1270
+ await this.connectionTypeNewAccessory(device, accessory);
1267
1271
  // create the accessory handler for the newly create accessory
1268
1272
  // this is imported from `platformAccessory.ts`
1269
1273
  new VacuumCleaner(this, accessory, device);
@@ -1294,7 +1298,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1294
1298
  existingAccessory.context.deviceID = device.deviceId;
1295
1299
  existingAccessory.displayName = device.deviceName;
1296
1300
  existingAccessory.context.firmwareRevision = this.version;
1297
- existingAccessory.context.connectionType = 'OpenAPI';
1301
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
1298
1302
  this.api.updatePlatformAccessories([existingAccessory]);
1299
1303
  // create the accessory handler for the restored accessory
1300
1304
  // this is imported from `platformAccessory.ts`
@@ -1316,7 +1320,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1316
1320
  accessory.context.model = device.remoteType;
1317
1321
  accessory.context.deviceID = device.deviceId;
1318
1322
  accessory.context.firmwareRevision = this.version;
1319
- accessory.context.connectionType = 'OpenAPI';
1323
+ await this.connectionTypeNewAccessory(device, accessory);
1320
1324
  // create the accessory handler for the newly create accessory
1321
1325
  // this is imported from `platformAccessory.ts`
1322
1326
  new Camera(this, accessory, device);
@@ -1347,7 +1351,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1347
1351
  existingAccessory.context.deviceID = device.deviceId;
1348
1352
  existingAccessory.displayName = device.deviceName;
1349
1353
  existingAccessory.context.firmwareRevision = this.version;
1350
- existingAccessory.context.connectionType = 'OpenAPI';
1354
+ await this.connectionTypeExistingAccessory(device, existingAccessory);
1351
1355
  this.api.updatePlatformAccessories([existingAccessory]);
1352
1356
  // create the accessory handler for the restored accessory
1353
1357
  // this is imported from `platformAccessory.ts`
@@ -1369,7 +1373,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1369
1373
  accessory.context.model = device.remoteType;
1370
1374
  accessory.context.deviceID = device.deviceId;
1371
1375
  accessory.context.firmwareRevision = this.version;
1372
- accessory.context.connectionType = 'OpenAPI';
1376
+ await this.connectionTypeNewAccessory(device, accessory);
1373
1377
  // create the accessory handler for the newly create accessory
1374
1378
  // this is imported from `platformAccessory.ts`
1375
1379
  new Others(this, accessory, device);