@switchbot/homebridge-switchbot 1.3.1-beta.1 → 1.3.1-beta.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/config.schema.json +12 -25
  3. package/dist/devices/bots.d.ts +2 -0
  4. package/dist/devices/bots.d.ts.map +1 -1
  5. package/dist/devices/bots.js +136 -95
  6. package/dist/devices/bots.js.map +1 -1
  7. package/dist/devices/colorbulb.d.ts +1 -0
  8. package/dist/devices/colorbulb.d.ts.map +1 -1
  9. package/dist/devices/colorbulb.js +18 -4
  10. package/dist/devices/colorbulb.js.map +1 -1
  11. package/dist/devices/contact.js +1 -1
  12. package/dist/devices/contact.js.map +1 -1
  13. package/dist/devices/curtains.d.ts.map +1 -1
  14. package/dist/devices/curtains.js +6 -1
  15. package/dist/devices/curtains.js.map +1 -1
  16. package/dist/devices/humidifiers.d.ts +1 -0
  17. package/dist/devices/humidifiers.d.ts.map +1 -1
  18. package/dist/devices/humidifiers.js +15 -2
  19. package/dist/devices/humidifiers.js.map +1 -1
  20. package/dist/devices/indoorcam.d.ts.map +1 -1
  21. package/dist/devices/indoorcam.js +12 -1
  22. package/dist/devices/indoorcam.js.map +1 -1
  23. package/dist/devices/meters.d.ts +5 -11
  24. package/dist/devices/meters.d.ts.map +1 -1
  25. package/dist/devices/meters.js +49 -47
  26. package/dist/devices/meters.js.map +1 -1
  27. package/dist/devices/plugs.d.ts +2 -0
  28. package/dist/devices/plugs.d.ts.map +1 -1
  29. package/dist/devices/plugs.js +41 -16
  30. package/dist/devices/plugs.js.map +1 -1
  31. package/dist/irdevices/airconditioners.d.ts +2 -0
  32. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  33. package/dist/irdevices/airconditioners.js +17 -1
  34. package/dist/irdevices/airconditioners.js.map +1 -1
  35. package/dist/irdevices/airpurifiers.d.ts +2 -0
  36. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  37. package/dist/irdevices/airpurifiers.js +17 -0
  38. package/dist/irdevices/airpurifiers.js.map +1 -1
  39. package/dist/irdevices/cameras.d.ts +1 -0
  40. package/dist/irdevices/cameras.d.ts.map +1 -1
  41. package/dist/irdevices/cameras.js +9 -0
  42. package/dist/irdevices/cameras.js.map +1 -1
  43. package/dist/irdevices/fans.d.ts +1 -0
  44. package/dist/irdevices/fans.d.ts.map +1 -1
  45. package/dist/irdevices/fans.js +9 -0
  46. package/dist/irdevices/fans.js.map +1 -1
  47. package/dist/irdevices/lights.d.ts +1 -0
  48. package/dist/irdevices/lights.d.ts.map +1 -1
  49. package/dist/irdevices/lights.js +9 -0
  50. package/dist/irdevices/lights.js.map +1 -1
  51. package/dist/irdevices/others.d.ts +1 -0
  52. package/dist/irdevices/others.d.ts.map +1 -1
  53. package/dist/irdevices/others.js +9 -0
  54. package/dist/irdevices/others.js.map +1 -1
  55. package/dist/irdevices/tvs.d.ts +1 -0
  56. package/dist/irdevices/tvs.d.ts.map +1 -1
  57. package/dist/irdevices/tvs.js +9 -0
  58. package/dist/irdevices/tvs.js.map +1 -1
  59. package/dist/irdevices/vacuumcleaners.d.ts +1 -0
  60. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  61. package/dist/irdevices/vacuumcleaners.js +9 -0
  62. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  63. package/dist/irdevices/waterheaters.d.ts +1 -0
  64. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  65. package/dist/irdevices/waterheaters.js +9 -0
  66. package/dist/irdevices/waterheaters.js.map +1 -1
  67. package/dist/platform.d.ts +2 -0
  68. package/dist/platform.d.ts.map +1 -1
  69. package/dist/platform.js +106 -20
  70. package/dist/platform.js.map +1 -1
  71. package/dist/settings.d.ts +6 -5
  72. package/dist/settings.d.ts.map +1 -1
  73. package/dist/settings.js.map +1 -1
  74. package/homebridge-ui/public/index.html +5 -1
  75. package/package.json +7 -7
  76. package/src/devices/bots.ts +124 -85
  77. package/src/devices/colorbulb.ts +18 -4
  78. package/src/devices/contact.ts +1 -1
  79. package/src/devices/curtains.ts +7 -2
  80. package/src/devices/humidifiers.ts +17 -3
  81. package/src/devices/indoorcam.ts +13 -2
  82. package/src/devices/meters.ts +50 -48
  83. package/src/devices/plugs.ts +45 -18
  84. package/src/irdevices/airconditioners.ts +17 -1
  85. package/src/irdevices/airpurifiers.ts +18 -0
  86. package/src/irdevices/cameras.ts +10 -0
  87. package/src/irdevices/fans.ts +10 -0
  88. package/src/irdevices/lights.ts +10 -0
  89. package/src/irdevices/others.ts +10 -0
  90. package/src/irdevices/tvs.ts +10 -0
  91. package/src/irdevices/vacuumcleaners.ts +10 -0
  92. package/src/irdevices/waterheaters.ts +10 -0
  93. package/src/platform.ts +104 -20
  94. package/src/settings.ts +7 -5
@@ -15,6 +15,13 @@ class WaterHeater {
15
15
  // Config
16
16
  this.deviceDebug = this.platform.config.options?.debug === 'device' || this.platform.debugMode;
17
17
  this.debugDebug = this.platform.config.options?.debug === 'debug' || this.platform.debugMode;
18
+ // default placeholders
19
+ if (this.Active === undefined) {
20
+ this.Active = this.platform.Characteristic.Active.INACTIVE;
21
+ }
22
+ else {
23
+ this.Active = this.accessory.context.Active;
24
+ }
18
25
  // set accessory information
19
26
  accessory
20
27
  .getService(this.platform.Service.AccessoryInformation)
@@ -48,6 +55,8 @@ class WaterHeater {
48
55
  this.service.setCharacteristic(this.platform.Characteristic.InUse, this.platform.Characteristic.InUse.IN_USE);
49
56
  }
50
57
  this.Active = value;
58
+ this.ActiveCached = this.Active;
59
+ this.accessory.context.Active = this.ActiveCached;
51
60
  }
52
61
  updateHomeKitCharacteristics() {
53
62
  if (this.Active === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"waterheaters.js","sourceRoot":"","sources":["../../src/irdevices/waterheaters.ts"],"names":[],"mappings":";;;AAEA,0CAA4E;AAG5E;;;;GAIG;AACH,MAAa,WAAW;IAWtB,YACmB,QAA2B,EACpC,SAA4B,EAC7B,MAAk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BAChF,MAAM;YACR,KAAK,GAAG;gBACN,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,WAAW,6BAA6B,CAAC,CAAC;gBAC9F,MAAM;YACR;gBACE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,WAAW,sBAAsB,CAAC,CAAC;SAC1F;IACH,CAAC;IAEM,QAAQ,CAAC,CAAM;QACpB,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;CACF;AA5KD,kCA4KC"}
@@ -56,6 +56,8 @@ export declare class SwitchBotPlatform implements DynamicPlatformPlugin {
56
56
  private createOthers;
57
57
  connectionTypeNewAccessory(device: device & devicesConfig, accessory: PlatformAccessory): Promise<void>;
58
58
  connectionTypeExistingAccessory(device: device & devicesConfig, existingAccessory: PlatformAccessory): Promise<void>;
59
+ connectionTypeNewIRAccessory(device: irdevice & devicesConfig, accessory: PlatformAccessory): Promise<void>;
60
+ connectionTypeExistingIRAccessory(device: irdevice & devicesConfig, existingAccessory: PlatformAccessory): Promise<void>;
59
61
  unregisterPlatformAccessories(existingAccessory: PlatformAccessory): void;
60
62
  deviceListInfo(devices: deviceResponses): void;
61
63
  deviceInfo(device: irdevice & devicesConfig | device & devicesConfig): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAmBA,OAAc,EAAE,aAAa,EAAsB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5G,OAAO,EAAyC,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,aAAa,EAAE,MA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,gBAAgB;YAwDhB,SAAS;YA4DT,WAAW;YAuDX,YAAY;YAuDZ,aAAa;YAuDb,aAAa;IAiE3B,OAAO,CAAC,gBAAgB;YAaV,UAAU;YAuDV,eAAe;YAuDf,eAAe;YAuDf,QAAQ;YAsDR,SAAS;YAwDT,WAAW;YAuDX,oBAAoB;YAuDpB,iBAAiB;YAuDjB,iBAAiB;YAuDjB,mBAAmB;YAuDnB,YAAY;YAuDZ,YAAY;IAuDb,0BAA0B,CACrC,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,SAAS,EAAE,iBAAiB;IAQjB,+BAA+B,CAC1C,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,iBAAiB,EAAE,iBAAiB;IASzB,4BAA4B,CACvC,MAAM,EAAE,QAAQ,GAAG,aAAa,EAChC,SAAS,EAAE,iBAAiB;IAIjB,iCAAiC,CAC5C,MAAM,EAAE,QAAQ,GAAG,aAAa,EAChC,iBAAiB,EAAE,iBAAiB;IAK/B,6BAA6B,CAAC,iBAAiB,EAAE,iBAAiB;IAMlE,cAAc,CAAC,OAAO,EAAE,eAAe;IAMjC,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,MAAM,GAAG,aAAa;IAajF;;;;OAIG;IACH,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE;IAQnB;;;OAGG;IACH,MAAM,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE;CASrB"}
package/dist/platform.js CHANGED
@@ -249,8 +249,52 @@ class SwitchBotPlatform {
249
249
  }
250
250
  }
251
251
  catch (e) {
252
- this.log.error('Failed to Discover Devices.', JSON.stringify(e.message));
253
- this.debug(JSON.stringify(e));
252
+ if (e.message.includes('400')) {
253
+ this.log.error('Failed to Discover Devices: Bad Request');
254
+ this.debug('The client has issued an invalid request. This is commonly used to specify validation errors in a request payload.');
255
+ }
256
+ else if (e.message.includes('401')) {
257
+ this.log.error('Failed to Discover Devices: Unauthorized Request');
258
+ this.debug('Authorization for the API is required, but the request has not been authenticated.');
259
+ }
260
+ else if (e.message.includes('403')) {
261
+ this.log.error('Failed to Discover Devices: Forbidden Request');
262
+ this.debug('The request has been authenticated but does not have appropriate permissions, or a requested resource is not found.');
263
+ }
264
+ else if (e.message.includes('404')) {
265
+ this.log.error('Failed to Discover Devices: Requst Not Found');
266
+ this.debug('Specifies the requested path does not exist.');
267
+ }
268
+ else if (e.message.includes('406')) {
269
+ this.log.error('Failed to Discover Devices: Request Not Acceptable');
270
+ this.debug('The client has requested a MIME type via the Accept header for a value not supported by the server.');
271
+ }
272
+ else if (e.message.includes('415')) {
273
+ this.log.error('Failed to Discover Devices: Unsupported Requst Header');
274
+ this.debug('The client has defined a contentType header that is not supported by the server.');
275
+ }
276
+ else if (e.message.includes('422')) {
277
+ this.log.error('Failed to Discover Devices: Unprocessable Entity');
278
+ this.debug('The client has made a valid request, but the server cannot process it.'
279
+ + ' This is often used for APIs for which certain limits have been exceeded.');
280
+ }
281
+ else if (e.message.includes('429')) {
282
+ this.log.error('Failed to Discover Devices: Too Many Requests');
283
+ this.debug('The client has exceeded the number of requests allowed for a given time window.');
284
+ }
285
+ else if (e.message.includes('500')) {
286
+ this.log.error('Failed to Discover Devices: Internal Server Error');
287
+ this.debug('An unexpected error on the SmartThings servers has occurred. These errors should be rare.');
288
+ }
289
+ else {
290
+ this.log.error('Failed to Discover Devices');
291
+ }
292
+ if (this.config.options?.debug === 'device') {
293
+ this.log.error(`Failed to Discover Devices, Error Message: ${JSON.stringify(e.message)}`);
294
+ }
295
+ if (this.config.options?.debug === 'debug' || this.debugMode) {
296
+ this.log.error(`Failed to Discover Devices, Error: ${JSON.stringify(e)}`);
297
+ }
254
298
  }
255
299
  }
256
300
  createDevice(device) {
@@ -400,6 +444,7 @@ class SwitchBotPlatform {
400
444
  existingAccessory.context.deviceID = device.deviceId;
401
445
  existingAccessory.displayName = device.deviceName;
402
446
  existingAccessory.context.firmwareRevision = this.version;
447
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
403
448
  await this.connectionTypeExistingAccessory(device, existingAccessory);
404
449
  this.api.updatePlatformAccessories([existingAccessory]);
405
450
  // create the accessory handler for the restored accessory
@@ -422,6 +467,7 @@ class SwitchBotPlatform {
422
467
  accessory.context.model = device.deviceType;
423
468
  accessory.context.deviceID = device.deviceId;
424
469
  accessory.context.firmwareRevision = this.version;
470
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
425
471
  await this.connectionTypeNewAccessory(device, accessory);
426
472
  // create the accessory handler for the newly create accessory
427
473
  // this is imported from `platformAccessory.ts`
@@ -450,6 +496,7 @@ class SwitchBotPlatform {
450
496
  existingAccessory.context.deviceID = device.deviceId;
451
497
  existingAccessory.displayName = device.deviceName;
452
498
  existingAccessory.context.firmwareRevision = this.version;
499
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
453
500
  await this.connectionTypeExistingAccessory(device, existingAccessory);
454
501
  this.api.updatePlatformAccessories([existingAccessory]);
455
502
  // create the accessory handler for the restored accessory
@@ -473,6 +520,7 @@ class SwitchBotPlatform {
473
520
  accessory.context.model = device.deviceType;
474
521
  accessory.context.deviceID = device.deviceId;
475
522
  accessory.context.firmwareRevision = this.version;
523
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
476
524
  await this.connectionTypeNewAccessory(device, accessory);
477
525
  // accessory.context.firmwareRevision = findaccessories.accessoryAttribute.softwareRevision;
478
526
  // create the accessory handler for the newly create accessory
@@ -501,6 +549,7 @@ class SwitchBotPlatform {
501
549
  existingAccessory.context.deviceID = device.deviceId;
502
550
  existingAccessory.displayName = device.deviceName;
503
551
  existingAccessory.context.firmwareRevision = this.version;
552
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
504
553
  await this.connectionTypeExistingAccessory(device, existingAccessory);
505
554
  this.api.updatePlatformAccessories([existingAccessory]);
506
555
  // create the accessory handler for the restored accessory
@@ -523,6 +572,7 @@ class SwitchBotPlatform {
523
572
  accessory.context.model = device.deviceType;
524
573
  accessory.context.deviceID = device.deviceId;
525
574
  accessory.context.firmwareRevision = this.version;
575
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
526
576
  await this.connectionTypeNewAccessory(device, accessory);
527
577
  // create the accessory handler for the newly create accessory
528
578
  // this is imported from `platformAccessory.ts`
@@ -550,6 +600,7 @@ class SwitchBotPlatform {
550
600
  existingAccessory.context.deviceID = device.deviceId;
551
601
  existingAccessory.displayName = device.deviceName;
552
602
  existingAccessory.context.firmwareRevision = this.version;
603
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
553
604
  await this.connectionTypeExistingAccessory(device, existingAccessory);
554
605
  this.api.updatePlatformAccessories([existingAccessory]);
555
606
  // create the accessory handler for the restored accessory
@@ -572,6 +623,7 @@ class SwitchBotPlatform {
572
623
  accessory.context.model = device.deviceType;
573
624
  accessory.context.deviceID = device.deviceId;
574
625
  accessory.context.firmwareRevision = this.version;
626
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
575
627
  await this.connectionTypeNewAccessory(device, accessory);
576
628
  // create the accessory handler for the newly create accessory
577
629
  // this is imported from `platformAccessory.ts`
@@ -599,6 +651,7 @@ class SwitchBotPlatform {
599
651
  existingAccessory.context.deviceID = device.deviceId;
600
652
  existingAccessory.displayName = device.deviceName;
601
653
  existingAccessory.context.firmwareRevision = this.version;
654
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
602
655
  await this.connectionTypeExistingAccessory(device, existingAccessory);
603
656
  this.api.updatePlatformAccessories([existingAccessory]);
604
657
  // create the accessory handler for the restored accessory
@@ -621,6 +674,7 @@ class SwitchBotPlatform {
621
674
  accessory.context.model = device.deviceType;
622
675
  accessory.context.deviceID = device.deviceId;
623
676
  accessory.context.firmwareRevision = this.version;
677
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
624
678
  await this.connectionTypeNewAccessory(device, accessory);
625
679
  // create the accessory handler for the newly create accessory
626
680
  // this is imported from `platformAccessory.ts`
@@ -648,6 +702,7 @@ class SwitchBotPlatform {
648
702
  existingAccessory.context.deviceID = device.deviceId;
649
703
  existingAccessory.displayName = device.deviceName;
650
704
  existingAccessory.context.firmwareRevision = this.version;
705
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
651
706
  await this.connectionTypeExistingAccessory(device, existingAccessory);
652
707
  this.api.updatePlatformAccessories([existingAccessory]);
653
708
  // create the accessory handler for the restored accessory
@@ -682,6 +737,7 @@ class SwitchBotPlatform {
682
737
  accessory.context.model = device.deviceType;
683
738
  accessory.context.deviceID = device.deviceId;
684
739
  accessory.context.firmwareRevision = this.version;
740
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
685
741
  await this.connectionTypeNewAccessory(device, accessory);
686
742
  // create the accessory handler for the newly create accessory
687
743
  // this is imported from `platformAccessory.ts`
@@ -721,6 +777,7 @@ class SwitchBotPlatform {
721
777
  existingAccessory.context.deviceID = device.deviceId;
722
778
  existingAccessory.displayName = device.deviceName;
723
779
  existingAccessory.context.firmwareRevision = this.version;
780
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
724
781
  await this.connectionTypeExistingAccessory(device, existingAccessory);
725
782
  this.api.updatePlatformAccessories([existingAccessory]);
726
783
  // create the accessory handler for the restored accessory
@@ -743,6 +800,7 @@ class SwitchBotPlatform {
743
800
  accessory.context.model = device.deviceType;
744
801
  accessory.context.deviceID = device.deviceId;
745
802
  accessory.context.firmwareRevision = this.version;
803
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
746
804
  await this.connectionTypeNewAccessory(device, accessory);
747
805
  // create the accessory handler for the newly create accessory
748
806
  // this is imported from `platformAccessory.ts`
@@ -770,6 +828,7 @@ class SwitchBotPlatform {
770
828
  existingAccessory.context.deviceID = device.deviceId;
771
829
  existingAccessory.displayName = device.deviceName;
772
830
  existingAccessory.context.firmwareRevision = this.version;
831
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
773
832
  await this.connectionTypeExistingAccessory(device, existingAccessory);
774
833
  this.api.updatePlatformAccessories([existingAccessory]);
775
834
  // create the accessory handler for the restored accessory
@@ -792,6 +851,7 @@ class SwitchBotPlatform {
792
851
  accessory.context.model = device.deviceType;
793
852
  accessory.context.deviceID = device.deviceId;
794
853
  accessory.context.firmwareRevision = this.version;
854
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
795
855
  await this.connectionTypeNewAccessory(device, accessory);
796
856
  // create the accessory handler for the newly create accessory
797
857
  // this is imported from `platformAccessory.ts`
@@ -819,6 +879,7 @@ class SwitchBotPlatform {
819
879
  existingAccessory.context.deviceID = device.deviceId;
820
880
  existingAccessory.displayName = device.deviceName;
821
881
  existingAccessory.context.firmwareRevision = this.version;
882
+ existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
822
883
  await this.connectionTypeExistingAccessory(device, existingAccessory);
823
884
  this.api.updatePlatformAccessories([existingAccessory]);
824
885
  // create the accessory handler for the restored accessory
@@ -841,6 +902,7 @@ class SwitchBotPlatform {
841
902
  accessory.context.model = device.deviceType;
842
903
  accessory.context.deviceID = device.deviceId;
843
904
  accessory.context.firmwareRevision = this.version;
905
+ accessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
844
906
  await this.connectionTypeNewAccessory(device, accessory);
845
907
  // create the accessory handler for the newly create accessory
846
908
  // this is imported from `platformAccessory.ts`
@@ -866,7 +928,8 @@ class SwitchBotPlatform {
866
928
  existingAccessory.context.deviceID = device.deviceId;
867
929
  existingAccessory.displayName = device.deviceName;
868
930
  existingAccessory.context.firmwareRevision = this.version;
869
- await this.connectionTypeExistingAccessory(device, existingAccessory);
931
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
932
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
870
933
  this.api.updatePlatformAccessories([existingAccessory]);
871
934
  // create the accessory handler for the restored accessory
872
935
  // this is imported from `platformAccessory.ts`
@@ -884,7 +947,8 @@ class SwitchBotPlatform {
884
947
  accessory.context.model = device.remoteType;
885
948
  accessory.context.deviceID = device.deviceId;
886
949
  accessory.context.firmwareRevision = this.version;
887
- await this.connectionTypeNewAccessory(device, accessory);
950
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
951
+ await this.connectionTypeNewIRAccessory(device, accessory);
888
952
  // create the accessory handler for the newly create accessory
889
953
  // this is imported from `platformAccessory.ts`
890
954
  new tvs_1.TV(this, accessory, device);
@@ -915,7 +979,8 @@ class SwitchBotPlatform {
915
979
  existingAccessory.context.deviceID = device.deviceId;
916
980
  existingAccessory.displayName = device.deviceName;
917
981
  existingAccessory.context.firmwareRevision = this.version;
918
- await this.connectionTypeExistingAccessory(device, existingAccessory);
982
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
983
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
919
984
  this.api.updatePlatformAccessories([existingAccessory]);
920
985
  // create the accessory handler for the restored accessory
921
986
  // this is imported from `platformAccessory.ts`
@@ -937,7 +1002,8 @@ class SwitchBotPlatform {
937
1002
  accessory.context.model = device.remoteType;
938
1003
  accessory.context.deviceID = device.deviceId;
939
1004
  accessory.context.firmwareRevision = this.version;
940
- await this.connectionTypeNewAccessory(device, accessory);
1005
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1006
+ await this.connectionTypeNewIRAccessory(device, accessory);
941
1007
  // create the accessory handler for the newly create accessory
942
1008
  // this is imported from `platformAccessory.ts`
943
1009
  new fans_1.Fan(this, accessory, device);
@@ -964,7 +1030,8 @@ class SwitchBotPlatform {
964
1030
  existingAccessory.context.deviceID = device.deviceId;
965
1031
  existingAccessory.displayName = device.deviceName;
966
1032
  existingAccessory.context.firmwareRevision = this.version;
967
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1033
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1034
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
968
1035
  this.api.updatePlatformAccessories([existingAccessory]);
969
1036
  // create the accessory handler for the restored accessory
970
1037
  // this is imported from `platformAccessory.ts`
@@ -986,7 +1053,8 @@ class SwitchBotPlatform {
986
1053
  accessory.context.model = device.remoteType;
987
1054
  accessory.context.deviceID = device.deviceId;
988
1055
  accessory.context.firmwareRevision = this.version;
989
- await this.connectionTypeNewAccessory(device, accessory);
1056
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1057
+ await this.connectionTypeNewIRAccessory(device, accessory);
990
1058
  // create the accessory handler for the newly create accessory
991
1059
  // this is imported from `platformAccessory.ts`
992
1060
  new lights_1.Light(this, accessory, device);
@@ -1013,7 +1081,8 @@ class SwitchBotPlatform {
1013
1081
  existingAccessory.context.deviceID = device.deviceId;
1014
1082
  existingAccessory.displayName = device.deviceName;
1015
1083
  existingAccessory.context.firmwareRevision = this.version;
1016
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1084
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1085
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1017
1086
  this.api.updatePlatformAccessories([existingAccessory]);
1018
1087
  // create the accessory handler for the restored accessory
1019
1088
  // this is imported from `platformAccessory.ts`
@@ -1035,7 +1104,8 @@ class SwitchBotPlatform {
1035
1104
  accessory.context.model = device.remoteType;
1036
1105
  accessory.context.deviceID = device.deviceId;
1037
1106
  accessory.context.firmwareRevision = this.version;
1038
- await this.connectionTypeNewAccessory(device, accessory);
1107
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1108
+ await this.connectionTypeNewIRAccessory(device, accessory);
1039
1109
  // create the accessory handler for the newly create accessory
1040
1110
  // this is imported from `platformAccessory.ts`
1041
1111
  new airconditioners_1.AirConditioner(this, accessory, device);
@@ -1062,7 +1132,8 @@ class SwitchBotPlatform {
1062
1132
  existingAccessory.context.deviceID = device.deviceId;
1063
1133
  existingAccessory.displayName = device.deviceName;
1064
1134
  existingAccessory.context.firmwareRevision = this.version;
1065
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1135
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1136
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1066
1137
  this.api.updatePlatformAccessories([existingAccessory]);
1067
1138
  // create the accessory handler for the restored accessory
1068
1139
  // this is imported from `platformAccessory.ts`
@@ -1084,7 +1155,8 @@ class SwitchBotPlatform {
1084
1155
  accessory.context.model = device.remoteType;
1085
1156
  accessory.context.deviceID = device.deviceId;
1086
1157
  accessory.context.firmwareRevision = this.version;
1087
- await this.connectionTypeNewAccessory(device, accessory);
1158
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1159
+ await this.connectionTypeNewIRAccessory(device, accessory);
1088
1160
  // create the accessory handler for the newly create accessory
1089
1161
  // this is imported from `platformAccessory.ts`
1090
1162
  new airpurifiers_1.AirPurifier(this, accessory, device);
@@ -1111,7 +1183,8 @@ class SwitchBotPlatform {
1111
1183
  existingAccessory.context.deviceID = device.deviceId;
1112
1184
  existingAccessory.displayName = device.deviceName;
1113
1185
  existingAccessory.context.firmwareRevision = this.version;
1114
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1186
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1187
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1115
1188
  this.api.updatePlatformAccessories([existingAccessory]);
1116
1189
  // create the accessory handler for the restored accessory
1117
1190
  // this is imported from `platformAccessory.ts`
@@ -1133,7 +1206,8 @@ class SwitchBotPlatform {
1133
1206
  accessory.context.model = device.remoteType;
1134
1207
  accessory.context.deviceID = device.deviceId;
1135
1208
  accessory.context.firmwareRevision = this.version;
1136
- await this.connectionTypeNewAccessory(device, accessory);
1209
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1210
+ await this.connectionTypeNewIRAccessory(device, accessory);
1137
1211
  // create the accessory handler for the newly create accessory
1138
1212
  // this is imported from `platformAccessory.ts`
1139
1213
  new waterheaters_1.WaterHeater(this, accessory, device);
@@ -1160,7 +1234,8 @@ class SwitchBotPlatform {
1160
1234
  existingAccessory.context.deviceID = device.deviceId;
1161
1235
  existingAccessory.displayName = device.deviceName;
1162
1236
  existingAccessory.context.firmwareRevision = this.version;
1163
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1237
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1238
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1164
1239
  this.api.updatePlatformAccessories([existingAccessory]);
1165
1240
  // create the accessory handler for the restored accessory
1166
1241
  // this is imported from `platformAccessory.ts`
@@ -1182,7 +1257,8 @@ class SwitchBotPlatform {
1182
1257
  accessory.context.model = device.remoteType;
1183
1258
  accessory.context.deviceID = device.deviceId;
1184
1259
  accessory.context.firmwareRevision = this.version;
1185
- await this.connectionTypeNewAccessory(device, accessory);
1260
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1261
+ await this.connectionTypeNewIRAccessory(device, accessory);
1186
1262
  // create the accessory handler for the newly create accessory
1187
1263
  // this is imported from `platformAccessory.ts`
1188
1264
  new vacuumcleaners_1.VacuumCleaner(this, accessory, device);
@@ -1209,7 +1285,8 @@ class SwitchBotPlatform {
1209
1285
  existingAccessory.context.deviceID = device.deviceId;
1210
1286
  existingAccessory.displayName = device.deviceName;
1211
1287
  existingAccessory.context.firmwareRevision = this.version;
1212
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1288
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1289
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1213
1290
  this.api.updatePlatformAccessories([existingAccessory]);
1214
1291
  // create the accessory handler for the restored accessory
1215
1292
  // this is imported from `platformAccessory.ts`
@@ -1231,7 +1308,8 @@ class SwitchBotPlatform {
1231
1308
  accessory.context.model = device.remoteType;
1232
1309
  accessory.context.deviceID = device.deviceId;
1233
1310
  accessory.context.firmwareRevision = this.version;
1234
- await this.connectionTypeNewAccessory(device, accessory);
1311
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1312
+ await this.connectionTypeNewIRAccessory(device, accessory);
1235
1313
  // create the accessory handler for the newly create accessory
1236
1314
  // this is imported from `platformAccessory.ts`
1237
1315
  new cameras_1.Camera(this, accessory, device);
@@ -1258,7 +1336,8 @@ class SwitchBotPlatform {
1258
1336
  existingAccessory.context.deviceID = device.deviceId;
1259
1337
  existingAccessory.displayName = device.deviceName;
1260
1338
  existingAccessory.context.firmwareRevision = this.version;
1261
- await this.connectionTypeExistingAccessory(device, existingAccessory);
1339
+ existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1340
+ await this.connectionTypeExistingIRAccessory(device, existingAccessory);
1262
1341
  this.api.updatePlatformAccessories([existingAccessory]);
1263
1342
  // create the accessory handler for the restored accessory
1264
1343
  // this is imported from `platformAccessory.ts`
@@ -1280,7 +1359,8 @@ class SwitchBotPlatform {
1280
1359
  accessory.context.model = device.remoteType;
1281
1360
  accessory.context.deviceID = device.deviceId;
1282
1361
  accessory.context.firmwareRevision = this.version;
1283
- await this.connectionTypeNewAccessory(device, accessory);
1362
+ accessory.context.deviceType = `IR: ${device.remoteType}`;
1363
+ await this.connectionTypeNewIRAccessory(device, accessory);
1284
1364
  // create the accessory handler for the newly create accessory
1285
1365
  // this is imported from `platformAccessory.ts`
1286
1366
  new others_1.Others(this, accessory, device);
@@ -1309,6 +1389,12 @@ class SwitchBotPlatform {
1309
1389
  existingAccessory.context.connectionType = 'OpenAPI';
1310
1390
  }
1311
1391
  }
1392
+ async connectionTypeNewIRAccessory(device, accessory) {
1393
+ accessory.context.connectionType = 'IR wirth OpenAPI';
1394
+ }
1395
+ async connectionTypeExistingIRAccessory(device, existingAccessory) {
1396
+ existingAccessory.context.connectionType = 'IR with OpenAPI';
1397
+ }
1312
1398
  unregisterPlatformAccessories(existingAccessory) {
1313
1399
  // remove platform accessories when no longer present
1314
1400
  this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [existingAccessory]);