@switchbot/homebridge-switchbot 3.5.0-beta.28 → 3.5.0-beta.29

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 (132) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/config.schema.json +67 -1
  3. package/dist/device/blindtilt.d.ts.map +1 -1
  4. package/dist/device/blindtilt.js +8 -3
  5. package/dist/device/blindtilt.js.map +1 -1
  6. package/dist/device/bot.d.ts.map +1 -1
  7. package/dist/device/bot.js +8 -3
  8. package/dist/device/bot.js.map +1 -1
  9. package/dist/device/ceilinglight.d.ts.map +1 -1
  10. package/dist/device/ceilinglight.js +31 -5
  11. package/dist/device/ceilinglight.js.map +1 -1
  12. package/dist/device/colorbulb.d.ts.map +1 -1
  13. package/dist/device/colorbulb.js +23 -4
  14. package/dist/device/colorbulb.js.map +1 -1
  15. package/dist/device/contact.d.ts.map +1 -1
  16. package/dist/device/contact.js +7 -2
  17. package/dist/device/contact.js.map +1 -1
  18. package/dist/device/curtain.d.ts.map +1 -1
  19. package/dist/device/curtain.js +7 -2
  20. package/dist/device/curtain.js.map +1 -1
  21. package/dist/device/device.d.ts.map +1 -1
  22. package/dist/device/device.js +13 -3
  23. package/dist/device/device.js.map +1 -1
  24. package/dist/device/fan.d.ts +51 -0
  25. package/dist/device/fan.d.ts.map +1 -0
  26. package/dist/device/fan.js +499 -0
  27. package/dist/device/fan.js.map +1 -0
  28. package/dist/device/hub.d.ts.map +1 -1
  29. package/dist/device/hub.js +32 -24
  30. package/dist/device/hub.js.map +1 -1
  31. package/dist/device/humidifier.d.ts.map +1 -1
  32. package/dist/device/humidifier.js +7 -2
  33. package/dist/device/humidifier.js.map +1 -1
  34. package/dist/device/iosensor.d.ts.map +1 -1
  35. package/dist/device/iosensor.js +25 -17
  36. package/dist/device/iosensor.js.map +1 -1
  37. package/dist/device/lightstrip.d.ts.map +1 -1
  38. package/dist/device/lightstrip.js +41 -4
  39. package/dist/device/lightstrip.js.map +1 -1
  40. package/dist/device/lock.d.ts.map +1 -1
  41. package/dist/device/lock.js +7 -2
  42. package/dist/device/lock.js.map +1 -1
  43. package/dist/device/meter.d.ts.map +1 -1
  44. package/dist/device/meter.js +25 -17
  45. package/dist/device/meter.js.map +1 -1
  46. package/dist/device/meterplus.d.ts.map +1 -1
  47. package/dist/device/meterplus.js +7 -2
  48. package/dist/device/meterplus.js.map +1 -1
  49. package/dist/device/motion.d.ts.map +1 -1
  50. package/dist/device/motion.js +7 -2
  51. package/dist/device/motion.js.map +1 -1
  52. package/dist/device/plug.d.ts.map +1 -1
  53. package/dist/device/plug.js +7 -2
  54. package/dist/device/plug.js.map +1 -1
  55. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  56. package/dist/device/robotvacuumcleaner.js +8 -3
  57. package/dist/device/robotvacuumcleaner.js.map +1 -1
  58. package/dist/device/waterdetector.d.ts.map +1 -1
  59. package/dist/device/waterdetector.js +14 -7
  60. package/dist/device/waterdetector.js.map +1 -1
  61. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  62. package/dist/irdevice/airconditioner.js +2 -1
  63. package/dist/irdevice/airconditioner.js.map +1 -1
  64. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  65. package/dist/irdevice/airpurifier.js +2 -1
  66. package/dist/irdevice/airpurifier.js.map +1 -1
  67. package/dist/irdevice/camera.d.ts.map +1 -1
  68. package/dist/irdevice/camera.js +2 -1
  69. package/dist/irdevice/camera.js.map +1 -1
  70. package/dist/irdevice/fan.d.ts +1 -1
  71. package/dist/irdevice/fan.d.ts.map +1 -1
  72. package/dist/irdevice/fan.js +3 -2
  73. package/dist/irdevice/fan.js.map +1 -1
  74. package/dist/irdevice/irdevice.js.map +1 -1
  75. package/dist/irdevice/light.d.ts.map +1 -1
  76. package/dist/irdevice/light.js +2 -1
  77. package/dist/irdevice/light.js.map +1 -1
  78. package/dist/irdevice/other.d.ts.map +1 -1
  79. package/dist/irdevice/other.js +2 -1
  80. package/dist/irdevice/other.js.map +1 -1
  81. package/dist/irdevice/tv.d.ts.map +1 -1
  82. package/dist/irdevice/tv.js +2 -1
  83. package/dist/irdevice/tv.js.map +1 -1
  84. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  85. package/dist/irdevice/vacuumcleaner.js +2 -1
  86. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  87. package/dist/irdevice/waterheater.d.ts.map +1 -1
  88. package/dist/irdevice/waterheater.js +2 -1
  89. package/dist/irdevice/waterheater.js.map +1 -1
  90. package/dist/platform.d.ts +2 -1
  91. package/dist/platform.d.ts.map +1 -1
  92. package/dist/platform.js +68 -5
  93. package/dist/platform.js.map +1 -1
  94. package/dist/settings.d.ts +22 -4
  95. package/dist/settings.d.ts.map +1 -1
  96. package/dist/utils.d.ts +10 -5
  97. package/dist/utils.d.ts.map +1 -1
  98. package/dist/utils.js +23 -9
  99. package/dist/utils.js.map +1 -1
  100. package/package.json +3 -3
  101. package/src/device/blindtilt.ts +8 -3
  102. package/src/device/bot.ts +8 -3
  103. package/src/device/ceilinglight.ts +31 -5
  104. package/src/device/colorbulb.ts +25 -6
  105. package/src/device/contact.ts +9 -4
  106. package/src/device/curtain.ts +21 -16
  107. package/src/device/device.ts +13 -3
  108. package/src/device/fan.ts +548 -0
  109. package/src/device/hub.ts +30 -22
  110. package/src/device/humidifier.ts +8 -3
  111. package/src/device/iosensor.ts +27 -19
  112. package/src/device/lightstrip.ts +40 -6
  113. package/src/device/lock.ts +12 -7
  114. package/src/device/meter.ts +29 -21
  115. package/src/device/meterplus.ts +11 -6
  116. package/src/device/motion.ts +8 -3
  117. package/src/device/plug.ts +8 -3
  118. package/src/device/robotvacuumcleaner.ts +13 -8
  119. package/src/device/waterdetector.ts +14 -7
  120. package/src/irdevice/airconditioner.ts +4 -3
  121. package/src/irdevice/airpurifier.ts +4 -3
  122. package/src/irdevice/camera.ts +3 -2
  123. package/src/irdevice/fan.ts +3 -2
  124. package/src/irdevice/irdevice.ts +1 -1
  125. package/src/irdevice/light.ts +2 -1
  126. package/src/irdevice/other.ts +46 -45
  127. package/src/irdevice/tv.ts +2 -1
  128. package/src/irdevice/vacuumcleaner.ts +2 -1
  129. package/src/irdevice/waterheater.ts +2 -1
  130. package/src/platform.ts +71 -5
  131. package/src/settings.ts +34 -9
  132. package/src/utils.ts +24 -9
@@ -154,8 +154,8 @@ export class Curtain extends deviceBase {
154
154
  });
155
155
 
156
156
  //regisiter webhook event handler
157
- if (this.device.webhook) {
158
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} is listening webhook.`);
157
+ if (device.webhook) {
158
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} is listening webhook.`);
159
159
  this.platform.webhookEventHandler[this.device.deviceId] = async (context) => {
160
160
  try {
161
161
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} received Webhook: ${JSON.stringify(context)}`);
@@ -408,20 +408,20 @@ export class Curtain extends deviceBase {
408
408
  this.WindowCovering.PositionState = this.hap.Characteristic.PositionState.INCREASING;
409
409
  this.WindowCovering.Service.getCharacteristic(this.hap.Characteristic.PositionState).updateValue(this.WindowCovering.PositionState);
410
410
  this.debugLog(`${this.device.deviceType}: ${this.WindowCovering.CurrentPosition} INCREASING`
411
- + ` PositionState: ${this.WindowCovering.PositionState}`);
411
+ + ` PositionState: ${this.WindowCovering.PositionState}`);
412
412
  } else if (Number(this.WindowCovering.TargetPosition) < this.WindowCovering.CurrentPosition) {
413
413
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Opening, CurrentPosition: ${this.WindowCovering.CurrentPosition} `);
414
414
  this.WindowCovering.PositionState = this.hap.Characteristic.PositionState.DECREASING;
415
415
  this.WindowCovering.Service.getCharacteristic(this.hap.Characteristic.PositionState).updateValue(this.WindowCovering.PositionState);
416
416
  this.debugLog(`${this.device.deviceType}: ${this.WindowCovering.CurrentPosition} DECREASING`
417
- + ` PositionState: ${this.WindowCovering.PositionState}`);
417
+ + ` PositionState: ${this.WindowCovering.PositionState}`);
418
418
  } else {
419
419
  this.debugLog(`${this.device.deviceType}: ${this.WindowCovering.CurrentPosition} Standby,`
420
- + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
420
+ + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
421
421
  this.WindowCovering.PositionState = this.hap.Characteristic.PositionState.STOPPED;
422
422
  this.WindowCovering.Service.getCharacteristic(this.hap.Characteristic.PositionState).updateValue(this.WindowCovering.PositionState);
423
423
  this.debugLog(`${this.device.deviceType}: ${this.WindowCovering.CurrentPosition} STOPPED`
424
- + ` PositionState: ${this.WindowCovering.PositionState}`);
424
+ + ` PositionState: ${this.WindowCovering.PositionState}`);
425
425
  }
426
426
  } else {
427
427
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Standby, CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
@@ -447,7 +447,7 @@ export class Curtain extends deviceBase {
447
447
  this.LightSensor!.CurrentAmbientLightLevel = set_maxLux;
448
448
  }
449
449
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
450
- + ` CurrentAmbientLightLevel: ${this.LightSensor!.CurrentAmbientLightLevel}`);
450
+ + ` CurrentAmbientLightLevel: ${this.LightSensor!.CurrentAmbientLightLevel}`);
451
451
  }
452
452
 
453
453
  // BatteryLevel
@@ -465,6 +465,11 @@ export class Curtain extends deviceBase {
465
465
 
466
466
  // FirmwareRevision
467
467
  this.accessory.context.FirmwareRevision = deviceStatus.body.version;
468
+ this.accessory
469
+ .getService(this.hap.Service.AccessoryInformation)!
470
+ .setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.accessory.context.FirmwareRevision)
471
+ .getCharacteristic(this.hap.Characteristic.FirmwareRevision)
472
+ .updateValue(this.accessory.context.FirmwareRevision);
468
473
  }
469
474
 
470
475
  async refreshStatus(): Promise<void> {
@@ -704,17 +709,17 @@ export class Curtain extends deviceBase {
704
709
  this.WindowCovering.PositionState = this.hap.Characteristic.PositionState.INCREASING;
705
710
  this.setNewTarget = true;
706
711
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${value},`
707
- + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
712
+ + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
708
713
  } else if (value < this.WindowCovering.CurrentPosition) {
709
714
  this.WindowCovering.PositionState = this.hap.Characteristic.PositionState.DECREASING;
710
715
  this.setNewTarget = true;
711
716
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${value},`
712
- + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
717
+ + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
713
718
  } else {
714
719
  this.WindowCovering.PositionState = this.hap.Characteristic.PositionState.STOPPED;
715
720
  this.setNewTarget = false;
716
721
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} value: ${value},`
717
- + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
722
+ + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
718
723
  }
719
724
  this.WindowCovering.Service.setCharacteristic(this.hap.Characteristic.PositionState, this.WindowCovering.PositionState);
720
725
  this.WindowCovering.Service.getCharacteristic(this.hap.Characteristic.PositionState).updateValue(this.WindowCovering.PositionState);
@@ -751,7 +756,7 @@ export class Curtain extends deviceBase {
751
756
  this.accessory.context.CurrentPosition = this.WindowCovering.CurrentPosition;
752
757
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, Number(this.WindowCovering.CurrentPosition));
753
758
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic`
754
- + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
759
+ + ` CurrentPosition: ${this.WindowCovering.CurrentPosition}`);
755
760
  if (this.device.mqttURL) {
756
761
  this.mqttPublish('CurrentPosition', this.WindowCovering.CurrentPosition.toString()); // Convert to string
757
762
  }
@@ -765,7 +770,7 @@ export class Curtain extends deviceBase {
765
770
  this.accessory.context.PositionState = this.WindowCovering.PositionState;
766
771
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, Number(this.WindowCovering.PositionState));
767
772
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic`
768
- + ` PositionState: ${this.WindowCovering.PositionState}`);
773
+ + ` PositionState: ${this.WindowCovering.PositionState}`);
769
774
  }
770
775
  if (this.WindowCovering.TargetPosition === undefined || Number.isNaN(this.WindowCovering.TargetPosition)) {
771
776
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} TargetPosition: ${this.WindowCovering.TargetPosition}`);
@@ -776,7 +781,7 @@ export class Curtain extends deviceBase {
776
781
  this.accessory.context.TargetPosition = this.WindowCovering.TargetPosition;
777
782
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, Number(this.WindowCovering.TargetPosition));
778
783
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic`
779
- + ` TargetPosition: ${this.WindowCovering.TargetPosition}`);
784
+ + ` TargetPosition: ${this.WindowCovering.TargetPosition}`);
780
785
  }
781
786
  if (this.WindowCovering.HoldPosition === undefined) {
782
787
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} HoldPosition: ${this.WindowCovering.HoldPosition}`);
@@ -787,12 +792,12 @@ export class Curtain extends deviceBase {
787
792
  this.accessory.context.HoldPosition = this.WindowCovering.HoldPosition;
788
793
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.HoldPosition, this.WindowCovering.HoldPosition);
789
794
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic`
790
- + ` HoldPosition: ${this.WindowCovering.HoldPosition}`);
795
+ + ` HoldPosition: ${this.WindowCovering.HoldPosition}`);
791
796
  }
792
797
  if (!this.device.curtain?.hide_lightsensor) {
793
798
  if (this.LightSensor!.CurrentAmbientLightLevel === undefined || Number.isNaN(this.LightSensor!.CurrentAmbientLightLevel)) {
794
799
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}`
795
- + ` CurrentAmbientLightLevel: ${this.LightSensor!.CurrentAmbientLightLevel}`);
800
+ + ` CurrentAmbientLightLevel: ${this.LightSensor!.CurrentAmbientLightLevel}`);
796
801
  } else {
797
802
  if (this.device.mqttURL) {
798
803
  this.mqttPublish('CurrentAmbientLightLevel', this.LightSensor!.CurrentAmbientLightLevel.toString());
@@ -830,7 +835,7 @@ export class Curtain extends deviceBase {
830
835
  this.accessory.context.StatusLowBattery = this.Battery.StatusLowBattery;
831
836
  this.Battery.Service.updateCharacteristic(this.hap.Characteristic.StatusLowBattery, this.Battery.StatusLowBattery);
832
837
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic`
833
- + ` StatusLowBattery: ${this.Battery.StatusLowBattery}`);
838
+ + ` StatusLowBattery: ${this.Battery.StatusLowBattery}`);
834
839
  }
835
840
  }
836
841
 
@@ -195,13 +195,13 @@ export abstract class deviceBase {
195
195
  if (device.offline !== undefined) {
196
196
  config['offline'] = device.offline;
197
197
  }
198
- if (device.maxRetry !== undefined) {
198
+ if (device.maxRetry !== 0 ) {
199
199
  config['maxRetry'] = device.maxRetry;
200
200
  }
201
- if (device.webhook !== undefined) {
201
+ if (device.webhook === true) {
202
202
  config['webhook'] = device.webhook;
203
203
  }
204
- if (device.connectionType !== undefined) {
204
+ if (device.connectionType) {
205
205
  config['connectionType'] = device.connectionType;
206
206
  }
207
207
  if (device.external !== undefined) {
@@ -479,6 +479,11 @@ export abstract class deviceBase {
479
479
  device.bleModel = SwitchBotBLEModel.Unknown;
480
480
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Model: ${device.model}, BLE Model: ${device.bleModel}`);
481
481
  break;
482
+ case 'Robot Vacuum Cleaner S10':
483
+ device.model = SwitchBotModel.RobotVacuumCleanerS10;
484
+ device.bleModel = SwitchBotBLEModel.Unknown;
485
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Model: ${device.model}, BLE Model: ${device.bleModel}`);
486
+ break;
482
487
  case 'Ceiling Light':
483
488
  device.model = SwitchBotModel.CeilingLight;
484
489
  device.bleModel = SwitchBotBLEModel.CeilingLight;
@@ -509,6 +514,11 @@ export abstract class deviceBase {
509
514
  device.bleModel = SwitchBotBLEModel.Unknown;
510
515
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Model: ${device.model}, BLE Model: ${device.bleModel}`);
511
516
  break;
517
+ case 'Battery Circulator Fan':
518
+ device.model = SwitchBotModel.BatteryCirculatorFan;
519
+ device.bleModel = SwitchBotBLEModel.Unknown;
520
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Model: ${device.model}, BLE Model: ${device.bleModel}`);
521
+ break;
512
522
  default:
513
523
  device.model = SwitchBotModel.Unknown;
514
524
  device.bleModel = SwitchBotBLEModel.Unknown;