@switchbot/homebridge-switchbot 2.8.1-beta.17 → 2.8.1-beta.19

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 (104) hide show
  1. package/dist/device/blindtilt.d.ts.map +1 -1
  2. package/dist/device/blindtilt.js +37 -16
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.js +10 -10
  5. package/dist/device/bot.js.map +1 -1
  6. package/dist/device/ceilinglight.d.ts.map +1 -1
  7. package/dist/device/ceilinglight.js +78 -24
  8. package/dist/device/ceilinglight.js.map +1 -1
  9. package/dist/device/colorbulb.d.ts.map +1 -1
  10. package/dist/device/colorbulb.js +36 -5
  11. package/dist/device/colorbulb.js.map +1 -1
  12. package/dist/device/contact.d.ts.map +1 -1
  13. package/dist/device/contact.js +22 -12
  14. package/dist/device/contact.js.map +1 -1
  15. package/dist/device/curtain.d.ts.map +1 -1
  16. package/dist/device/curtain.js +36 -15
  17. package/dist/device/curtain.js.map +1 -1
  18. package/dist/device/hub.d.ts.map +1 -1
  19. package/dist/device/hub.js +21 -11
  20. package/dist/device/hub.js.map +1 -1
  21. package/dist/device/humidifier.d.ts.map +1 -1
  22. package/dist/device/humidifier.js +66 -23
  23. package/dist/device/humidifier.js.map +1 -1
  24. package/dist/device/iosensor.d.ts.map +1 -1
  25. package/dist/device/iosensor.js +21 -11
  26. package/dist/device/iosensor.js.map +1 -1
  27. package/dist/device/lightstrip.d.ts.map +1 -1
  28. package/dist/device/lightstrip.js +63 -20
  29. package/dist/device/lightstrip.js.map +1 -1
  30. package/dist/device/lock.d.ts.map +1 -1
  31. package/dist/device/lock.js +35 -14
  32. package/dist/device/lock.js.map +1 -1
  33. package/dist/device/meter.d.ts.map +1 -1
  34. package/dist/device/meter.js +21 -11
  35. package/dist/device/meter.js.map +1 -1
  36. package/dist/device/meterplus.d.ts.map +1 -1
  37. package/dist/device/meterplus.js +21 -11
  38. package/dist/device/meterplus.js.map +1 -1
  39. package/dist/device/motion.d.ts.map +1 -1
  40. package/dist/device/motion.js +21 -11
  41. package/dist/device/motion.js.map +1 -1
  42. package/dist/device/plug.d.ts.map +1 -1
  43. package/dist/device/plug.js +32 -11
  44. package/dist/device/plug.js.map +1 -1
  45. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  46. package/dist/device/robotvacuumcleaner.js +48 -16
  47. package/dist/device/robotvacuumcleaner.js.map +1 -1
  48. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  49. package/dist/irdevice/airconditioner.js +15 -4
  50. package/dist/irdevice/airconditioner.js.map +1 -1
  51. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  52. package/dist/irdevice/airpurifier.js +15 -4
  53. package/dist/irdevice/airpurifier.js.map +1 -1
  54. package/dist/irdevice/camera.d.ts.map +1 -1
  55. package/dist/irdevice/camera.js +15 -4
  56. package/dist/irdevice/camera.js.map +1 -1
  57. package/dist/irdevice/fan.d.ts.map +1 -1
  58. package/dist/irdevice/fan.js +15 -4
  59. package/dist/irdevice/fan.js.map +1 -1
  60. package/dist/irdevice/light.d.ts.map +1 -1
  61. package/dist/irdevice/light.js +16 -5
  62. package/dist/irdevice/light.js.map +1 -1
  63. package/dist/irdevice/other.d.ts.map +1 -1
  64. package/dist/irdevice/other.js +15 -4
  65. package/dist/irdevice/other.js.map +1 -1
  66. package/dist/irdevice/tv.d.ts.map +1 -1
  67. package/dist/irdevice/tv.js +15 -4
  68. package/dist/irdevice/tv.js.map +1 -1
  69. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  70. package/dist/irdevice/vacuumcleaner.js +15 -4
  71. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  72. package/dist/irdevice/waterheater.d.ts.map +1 -1
  73. package/dist/irdevice/waterheater.js +15 -4
  74. package/dist/irdevice/waterheater.js.map +1 -1
  75. package/dist/platform.d.ts.map +1 -1
  76. package/dist/platform.js +18 -3
  77. package/dist/platform.js.map +1 -1
  78. package/package.json +1 -1
  79. package/src/device/blindtilt.ts +35 -16
  80. package/src/device/bot.ts +11 -11
  81. package/src/device/ceilinglight.ts +73 -24
  82. package/src/device/colorbulb.ts +32 -5
  83. package/src/device/contact.ts +21 -12
  84. package/src/device/curtain.ts +34 -15
  85. package/src/device/hub.ts +20 -11
  86. package/src/device/humidifier.ts +62 -23
  87. package/src/device/iosensor.ts +20 -11
  88. package/src/device/lightstrip.ts +59 -20
  89. package/src/device/lock.ts +33 -14
  90. package/src/device/meter.ts +20 -11
  91. package/src/device/meterplus.ts +20 -11
  92. package/src/device/motion.ts +20 -11
  93. package/src/device/plug.ts +30 -11
  94. package/src/device/robotvacuumcleaner.ts +45 -16
  95. package/src/irdevice/airconditioner.ts +14 -4
  96. package/src/irdevice/airpurifier.ts +14 -4
  97. package/src/irdevice/camera.ts +14 -4
  98. package/src/irdevice/fan.ts +14 -4
  99. package/src/irdevice/light.ts +15 -5
  100. package/src/irdevice/other.ts +14 -4
  101. package/src/irdevice/tv.ts +14 -4
  102. package/src/irdevice/vacuumcleaner.ts +14 -4
  103. package/src/irdevice/waterheater.ts +14 -4
  104. package/src/platform.ts +15 -3
@@ -526,19 +526,28 @@ export class BlindTilt {
526
526
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
527
527
  headers: this.platform.generateHeaders(),
528
528
  });
529
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
530
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
531
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
529
532
  const deviceStatus: any = await body.json();
530
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
531
- this.statusCode(statusCode);
532
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
533
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
534
- this.OpenAPI_CurrentPosition = deviceStatus.body.slidePosition;
535
- this.OpenAPI_Direction = deviceStatus.body.direction;
536
- this.OpenAPI_InMotion = deviceStatus.body.moving;
537
- this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
538
- this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
539
- this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
540
- this.openAPIparseStatus();
541
- this.updateHomeKitCharacteristics();
533
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
534
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
535
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
536
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
537
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
538
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
539
+ this.OpenAPI_CurrentPosition = deviceStatus.body.slidePosition;
540
+ this.OpenAPI_Direction = deviceStatus.body.direction;
541
+ this.OpenAPI_InMotion = deviceStatus.body.moving;
542
+ this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
543
+ this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
544
+ this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
545
+ this.openAPIparseStatus();
546
+ this.updateHomeKitCharacteristics();
547
+ } else {
548
+ this.statusCode(statusCode);
549
+ this.statusCode(deviceStatus.statusCode);
550
+ }
542
551
  } catch (e: any) {
543
552
  this.apiError(e);
544
553
  this.errorLog(
@@ -674,10 +683,20 @@ export class BlindTilt {
674
683
  method: 'POST',
675
684
  headers: this.platform.generateHeaders(),
676
685
  });
686
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
687
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
688
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
677
689
  const deviceStatus: any = await body.json();
678
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
679
- this.statusCode(statusCode);
680
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
690
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
691
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
692
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
693
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
694
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
695
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
696
+ } else {
697
+ this.statusCode(statusCode);
698
+ this.statusCode(deviceStatus.statusCode);
699
+ }
681
700
  } catch (e: any) {
682
701
  this.apiError(e);
683
702
  this.errorLog(
@@ -863,7 +882,7 @@ export class BlindTilt {
863
882
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
864
883
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
865
884
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
866
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
885
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
867
886
  }
868
887
  }
869
888
 
package/src/device/bot.ts CHANGED
@@ -725,7 +725,7 @@ export class Bot {
725
725
  headers: this.platform.generateHeaders(),
726
726
  });
727
727
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
728
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${JSON.stringify(statusCode)}`);
728
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
729
729
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
730
730
  const deviceStatus: any = await body.json();
731
731
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
@@ -733,19 +733,19 @@ export class Bot {
733
733
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
734
734
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
735
735
  this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
736
- + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
737
- if (this.device.bot?.mode === 'multipress') {
738
- this.multiPressCount--;
739
- if (this.multiPressCount > 0) {
740
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Multi Press Count: ${this.multiPressCount}`);
741
- this.On = true;
742
- this.openAPIpushChanges();
743
- }
744
- }
736
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
745
737
  } else {
746
738
  this.statusCode(statusCode);
747
739
  this.statusCode(deviceStatus.statusCode);
748
740
  }
741
+ if (this.device.bot?.mode === 'multipress') {
742
+ this.multiPressCount--;
743
+ if (this.multiPressCount > 0) {
744
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Multi Press Count: ${this.multiPressCount}`);
745
+ this.On = true;
746
+ this.openAPIpushChanges();
747
+ }
748
+ }
749
749
  } catch (e: any) {
750
750
  this.apiError(e);
751
751
  this.errorLog(
@@ -1031,7 +1031,7 @@ export class Bot {
1031
1031
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
1032
1032
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
1033
1033
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
1034
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
1034
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
1035
1035
  }
1036
1036
  }
1037
1037
 
@@ -402,18 +402,27 @@ export class CeilingLight {
402
402
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
403
403
  headers: this.platform.generateHeaders(),
404
404
  });
405
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
406
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
407
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
405
408
  const deviceStatus: any = await body.json();
406
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
407
- this.statusCode(statusCode);
408
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
409
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
410
- this.OpenAPI_On = deviceStatus.body.power;
411
- this.OpenAPI_RGB = deviceStatus.body.color;
412
- this.OpenAPI_Brightness = deviceStatus.body.brightness;
413
- this.OpenAPI_ColorTemperature = deviceStatus.body.colorTemperature;
414
- this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
415
- this.openAPIparseStatus();
416
- this.updateHomeKitCharacteristics();
409
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
410
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
411
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
412
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
413
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
414
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
415
+ this.OpenAPI_On = deviceStatus.body.power;
416
+ this.OpenAPI_RGB = deviceStatus.body.color;
417
+ this.OpenAPI_Brightness = deviceStatus.body.brightness;
418
+ this.OpenAPI_ColorTemperature = deviceStatus.body.colorTemperature;
419
+ this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
420
+ this.openAPIparseStatus();
421
+ this.updateHomeKitCharacteristics();
422
+ } else {
423
+ this.statusCode(statusCode);
424
+ this.statusCode(deviceStatus.statusCode);
425
+ }
417
426
  } catch (e: any) {
418
427
  this.apiError(e);
419
428
  this.errorLog(
@@ -525,10 +534,20 @@ export class CeilingLight {
525
534
  method: 'POST',
526
535
  headers: this.platform.generateHeaders(),
527
536
  });
537
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
538
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
539
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
528
540
  const deviceStatus: any = await body.json();
529
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
530
- this.statusCode(statusCode);
531
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
541
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
542
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
543
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
544
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
545
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
546
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
547
+ } else {
548
+ this.statusCode(statusCode);
549
+ this.statusCode(deviceStatus.statusCode);
550
+ }
532
551
  } catch (e: any) {
533
552
  this.apiError(e);
534
553
  this.errorLog(
@@ -576,10 +595,20 @@ export class CeilingLight {
576
595
  method: 'POST',
577
596
  headers: this.platform.generateHeaders(),
578
597
  });
598
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
599
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
600
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
579
601
  const deviceStatus: any = await body.json();
580
- this.debugLog(`Devices: ${JSON.stringify(deviceStatus.body)}`);
581
- this.statusCode(statusCode);
582
- this.debugLog(`Headers: ${JSON.stringify(headers)}`);
602
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
603
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
604
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
605
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
606
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
607
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
608
+ } else {
609
+ this.statusCode(statusCode);
610
+ this.statusCode(deviceStatus.statusCode);
611
+ }
583
612
  } catch (e: any) {
584
613
  this.apiError(e);
585
614
  this.errorLog(
@@ -612,10 +641,20 @@ export class CeilingLight {
612
641
  method: 'POST',
613
642
  headers: this.platform.generateHeaders(),
614
643
  });
644
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
645
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
646
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
615
647
  const deviceStatus: any = await body.json();
616
- this.debugLog(`Devices: ${JSON.stringify(deviceStatus.body)}`);
617
- this.statusCode(statusCode);
618
- this.debugLog(`Headers: ${JSON.stringify(headers)}`);
648
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
649
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
650
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
651
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
652
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
653
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
654
+ } else {
655
+ this.statusCode(statusCode);
656
+ this.statusCode(deviceStatus.statusCode);
657
+ }
619
658
  } catch (e: any) {
620
659
  this.apiError(e);
621
660
  this.errorLog(
@@ -646,10 +685,20 @@ export class CeilingLight {
646
685
  method: 'POST',
647
686
  headers: this.platform.generateHeaders(),
648
687
  });
688
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
689
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
690
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
649
691
  const deviceStatus: any = await body.json();
650
- this.debugLog(`Devices: ${JSON.stringify(deviceStatus.body)}`);
651
- this.statusCode(statusCode);
652
- this.debugLog(`Headers: ${JSON.stringify(headers)}`);
692
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
693
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
694
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
695
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
696
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
697
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
698
+ } else {
699
+ this.statusCode(statusCode);
700
+ this.statusCode(deviceStatus.statusCode);
701
+ }
653
702
  } catch (e: any) {
654
703
  this.apiError(e);
655
704
  this.errorLog(
@@ -807,7 +856,7 @@ export class CeilingLight {
807
856
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
808
857
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
809
858
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
810
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
859
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
811
860
  }
812
861
  }
813
862
 
@@ -437,6 +437,8 @@ export class ColorBulb {
437
437
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
438
438
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
439
439
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
440
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
441
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
440
442
  this.OpenAPI_On = deviceStatus.body.power;
441
443
  this.OpenAPI_RGB = deviceStatus.body.color;
442
444
  this.OpenAPI_Brightness = deviceStatus.body.brightness;
@@ -445,6 +447,7 @@ export class ColorBulb {
445
447
  this.openAPIparseStatus();
446
448
  this.updateHomeKitCharacteristics();
447
449
  } else {
450
+ this.statusCode(statusCode);
448
451
  this.statusCode(deviceStatus.statusCode);
449
452
  }
450
453
  } catch (e: any) {
@@ -701,7 +704,13 @@ export class ColorBulb {
701
704
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
702
705
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
703
706
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
704
- this.statusCode(deviceStatus.statusCode);
707
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
708
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
709
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
710
+ } else {
711
+ this.statusCode(statusCode);
712
+ this.statusCode(deviceStatus.statusCode);
713
+ }
705
714
  } catch (e: any) {
706
715
  this.apiError(e);
707
716
  this.errorLog(
@@ -756,7 +765,13 @@ export class ColorBulb {
756
765
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
757
766
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
758
767
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
759
- this.statusCode(deviceStatus.statusCode);
768
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
769
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
770
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
771
+ } else {
772
+ this.statusCode(statusCode);
773
+ this.statusCode(deviceStatus.statusCode);
774
+ }
760
775
  } catch (e: any) {
761
776
  this.apiError(e);
762
777
  this.errorLog(
@@ -796,7 +811,13 @@ export class ColorBulb {
796
811
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
797
812
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
798
813
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
799
- this.statusCode(deviceStatus.statusCode);
814
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
815
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
816
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
817
+ } else {
818
+ this.statusCode(statusCode);
819
+ this.statusCode(deviceStatus.statusCode);
820
+ }
800
821
  } catch (e: any) {
801
822
  this.apiError(e);
802
823
  this.errorLog(
@@ -834,7 +855,13 @@ export class ColorBulb {
834
855
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
835
856
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
836
857
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
837
- this.statusCode(deviceStatus.statusCode);
858
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
859
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
860
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
861
+ } else {
862
+ this.statusCode(statusCode);
863
+ this.statusCode(deviceStatus.statusCode);
864
+ }
838
865
  } catch (e: any) {
839
866
  this.apiError(e);
840
867
  this.errorLog(
@@ -992,7 +1019,7 @@ export class ColorBulb {
992
1019
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
993
1020
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
994
1021
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
995
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
1022
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
996
1023
  }
997
1024
  }
998
1025
 
@@ -382,18 +382,27 @@ export class Contact {
382
382
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
383
383
  headers: this.platform.generateHeaders(),
384
384
  });
385
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
386
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
387
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
385
388
  const deviceStatus: any = await body.json();
386
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
387
- this.statusCode(statusCode);
388
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
389
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
390
- this.OpenAPI_ContactSensorState = deviceStatus.body.openState;
391
- this.OpenAPI_MotionDetected = deviceStatus.body.moveDetected;
392
- this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
393
- this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
394
- this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
395
- this.openAPIparseStatus();
396
- this.updateHomeKitCharacteristics();
389
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
390
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
391
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
392
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
393
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
394
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
395
+ this.OpenAPI_ContactSensorState = deviceStatus.body.openState;
396
+ this.OpenAPI_MotionDetected = deviceStatus.body.moveDetected;
397
+ this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
398
+ this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
399
+ this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
400
+ this.openAPIparseStatus();
401
+ this.updateHomeKitCharacteristics();
402
+ } else {
403
+ this.statusCode(statusCode);
404
+ this.statusCode(deviceStatus.statusCode);
405
+ }
397
406
  } catch (e: any) {
398
407
  this.apiError(e);
399
408
  this.errorLog(
@@ -457,7 +466,7 @@ export class Contact {
457
466
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
458
467
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
459
468
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
460
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
469
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
461
470
  }
462
471
  }
463
472
 
@@ -550,18 +550,27 @@ export class Curtain {
550
550
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
551
551
  headers: this.platform.generateHeaders(),
552
552
  });
553
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
554
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
555
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
553
556
  const deviceStatus: any = await body.json();
554
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
555
- this.statusCode(statusCode);
556
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
557
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
558
- this.OpenAPI_CurrentPosition = deviceStatus.body.slidePosition;
559
- this.OpenAPI_InMotion = deviceStatus.body.moving;
560
- this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
561
- this.OpenAPI_BatterLevel = deviceStatus.body.battery;
562
- this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
563
- this.openAPIparseStatus();
564
- this.updateHomeKitCharacteristics();
557
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
558
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
559
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
560
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
561
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
562
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
563
+ this.OpenAPI_CurrentPosition = deviceStatus.body.slidePosition;
564
+ this.OpenAPI_InMotion = deviceStatus.body.moving;
565
+ this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
566
+ this.OpenAPI_BatterLevel = deviceStatus.body.battery;
567
+ this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
568
+ this.openAPIparseStatus();
569
+ this.updateHomeKitCharacteristics();
570
+ } else {
571
+ this.statusCode(statusCode);
572
+ this.statusCode(deviceStatus.statusCode);
573
+ }
565
574
  } catch (e: any) {
566
575
  this.apiError(e);
567
576
  this.errorLog(
@@ -696,10 +705,20 @@ export class Curtain {
696
705
  method: 'POST',
697
706
  headers: this.platform.generateHeaders(),
698
707
  });
708
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
709
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
710
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
699
711
  const deviceStatus: any = await body.json();
700
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
701
- this.statusCode(statusCode);
702
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
712
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
713
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
714
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
715
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
716
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
717
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
718
+ } else {
719
+ this.statusCode(statusCode);
720
+ this.statusCode(deviceStatus.statusCode);
721
+ }
703
722
  } catch (e: any) {
704
723
  this.apiError(e);
705
724
  this.errorLog(
@@ -843,7 +862,7 @@ export class Curtain {
843
862
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
844
863
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
845
864
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
846
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
865
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
847
866
  }
848
867
  }
849
868
 
package/src/device/hub.ts CHANGED
@@ -290,17 +290,26 @@ export class Hub {
290
290
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
291
291
  headers: this.platform.generateHeaders(),
292
292
  });
293
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
294
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
295
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
293
296
  const deviceStatus: any = await body.json();
294
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
295
- this.statusCode(statusCode);
296
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
297
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
298
- this.OpenAPI_CurrentTemperature = deviceStatus.body.temperature;
299
- this.OpenAPI_CurrentRelativeHumidity = deviceStatus.body.humidity;
300
- this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.lightLevel;
301
- this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
302
- this.openAPIparseStatus();
303
- this.updateHomeKitCharacteristics();
297
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
298
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
299
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
300
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
301
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
302
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
303
+ this.OpenAPI_CurrentTemperature = deviceStatus.body.temperature;
304
+ this.OpenAPI_CurrentRelativeHumidity = deviceStatus.body.humidity;
305
+ this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.lightLevel;
306
+ this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
307
+ this.openAPIparseStatus();
308
+ this.updateHomeKitCharacteristics();
309
+ } else {
310
+ this.statusCode(statusCode);
311
+ this.statusCode(deviceStatus.statusCode);
312
+ }
304
313
  } catch (e: any) {
305
314
  this.apiError(e);
306
315
  this.errorLog(
@@ -369,7 +378,7 @@ export class Hub {
369
378
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
370
379
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
371
380
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
372
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
381
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
373
382
  }
374
383
  }
375
384