@switchbot/homebridge-switchbot 1.10.2-beta.8 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/CHANGELOG.md +27 -3
  2. package/config.schema.json +58 -0
  3. package/dist/device/bot.d.ts +51 -40
  4. package/dist/device/bot.d.ts.map +1 -1
  5. package/dist/device/bot.js +58 -32
  6. package/dist/device/bot.js.map +1 -1
  7. package/dist/device/colorbulb.d.ts +25 -21
  8. package/dist/device/colorbulb.d.ts.map +1 -1
  9. package/dist/device/colorbulb.js +176 -140
  10. package/dist/device/colorbulb.js.map +1 -1
  11. package/dist/device/contact.d.ts +15 -15
  12. package/dist/device/contact.d.ts.map +1 -1
  13. package/dist/device/contact.js +14 -13
  14. package/dist/device/contact.js.map +1 -1
  15. package/dist/device/curtain.d.ts +25 -22
  16. package/dist/device/curtain.d.ts.map +1 -1
  17. package/dist/device/curtain.js +50 -37
  18. package/dist/device/curtain.js.map +1 -1
  19. package/dist/device/humidifier.d.ts +23 -20
  20. package/dist/device/humidifier.d.ts.map +1 -1
  21. package/dist/device/humidifier.js +38 -38
  22. package/dist/device/humidifier.js.map +1 -1
  23. package/dist/device/lock.d.ts +16 -13
  24. package/dist/device/lock.d.ts.map +1 -1
  25. package/dist/device/lock.js +14 -14
  26. package/dist/device/lock.js.map +1 -1
  27. package/dist/device/meter.d.ts +15 -15
  28. package/dist/device/meter.d.ts.map +1 -1
  29. package/dist/device/meter.js +11 -11
  30. package/dist/device/meter.js.map +1 -1
  31. package/dist/device/motion.d.ts +14 -14
  32. package/dist/device/motion.d.ts.map +1 -1
  33. package/dist/device/motion.js +13 -13
  34. package/dist/device/motion.js.map +1 -1
  35. package/dist/device/plug.d.ts +10 -7
  36. package/dist/device/plug.d.ts.map +1 -1
  37. package/dist/device/plug.js +17 -17
  38. package/dist/device/plug.js.map +1 -1
  39. package/dist/irdevice/airconditioner.d.ts +22 -22
  40. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  41. package/dist/irdevice/airconditioner.js +44 -44
  42. package/dist/irdevice/airconditioner.js.map +1 -1
  43. package/dist/irdevice/airpurifier.d.ts +12 -9
  44. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  45. package/dist/irdevice/airpurifier.js +20 -20
  46. package/dist/irdevice/airpurifier.js.map +1 -1
  47. package/dist/irdevice/camera.d.ts +10 -7
  48. package/dist/irdevice/camera.d.ts.map +1 -1
  49. package/dist/irdevice/camera.js +11 -11
  50. package/dist/irdevice/camera.js.map +1 -1
  51. package/dist/irdevice/fan.d.ts +12 -9
  52. package/dist/irdevice/fan.d.ts.map +1 -1
  53. package/dist/irdevice/fan.js +29 -29
  54. package/dist/irdevice/fan.js.map +1 -1
  55. package/dist/irdevice/light.d.ts +10 -7
  56. package/dist/irdevice/light.d.ts.map +1 -1
  57. package/dist/irdevice/light.js +13 -13
  58. package/dist/irdevice/light.js.map +1 -1
  59. package/dist/irdevice/other.d.ts +12 -9
  60. package/dist/irdevice/other.d.ts.map +1 -1
  61. package/dist/irdevice/other.js +17 -17
  62. package/dist/irdevice/other.js.map +1 -1
  63. package/dist/irdevice/tv.d.ts +13 -10
  64. package/dist/irdevice/tv.d.ts.map +1 -1
  65. package/dist/irdevice/tv.js +25 -25
  66. package/dist/irdevice/tv.js.map +1 -1
  67. package/dist/irdevice/vacuumcleaner.d.ts +10 -7
  68. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  69. package/dist/irdevice/vacuumcleaner.js +13 -13
  70. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  71. package/dist/irdevice/waterheater.d.ts +10 -7
  72. package/dist/irdevice/waterheater.d.ts.map +1 -1
  73. package/dist/irdevice/waterheater.js +16 -16
  74. package/dist/irdevice/waterheater.js.map +1 -1
  75. package/dist/platform.d.ts.map +1 -1
  76. package/dist/settings.d.ts +5 -1
  77. package/dist/settings.d.ts.map +1 -1
  78. package/dist/settings.js.map +1 -1
  79. package/package.json +76 -76
  80. package/src/device/bot.ts +82 -55
  81. package/src/device/colorbulb.ts +206 -157
  82. package/src/device/contact.ts +31 -30
  83. package/src/device/curtain.ts +68 -57
  84. package/src/device/humidifier.ts +65 -53
  85. package/src/device/lock.ts +22 -22
  86. package/src/device/meter.ts +25 -25
  87. package/src/device/motion.ts +27 -27
  88. package/src/device/plug.ts +20 -20
  89. package/src/irdevice/airconditioner.ts +54 -54
  90. package/src/irdevice/airpurifier.ts +30 -30
  91. package/src/irdevice/camera.ts +19 -19
  92. package/src/irdevice/fan.ts +40 -40
  93. package/src/irdevice/light.ts +23 -23
  94. package/src/irdevice/other.ts +25 -25
  95. package/src/irdevice/tv.ts +42 -42
  96. package/src/irdevice/vacuumcleaner.ts +21 -21
  97. package/src/irdevice/waterheater.ts +24 -24
  98. package/src/platform.ts +4 -4
  99. package/src/settings.ts +6 -1
package/package.json CHANGED
@@ -1,80 +1,80 @@
1
1
  {
2
- "displayName": "Homebridge SwitchBot",
3
- "name": "@switchbot/homebridge-switchbot",
4
- "version": "1.10.2-beta.8",
5
- "description": "The [Homebridge](https://homebridge.io) SwitchBot plugin allows you to access your [SwitchBot](https://www.switch-bot.com) device(s) from HomeKit.",
6
- "author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
7
- "license": "ISC",
8
- "repository": {
9
- "type": "git",
10
- "url": "git://github.com/OpenWonderLabs/homebridge-switchbot.git"
2
+ "displayName": "Homebridge SwitchBot",
3
+ "name": "@switchbot/homebridge-switchbot",
4
+ "version": "1.12.0",
5
+ "description": "The [Homebridge](https://homebridge.io) SwitchBot plugin allows you to access your [SwitchBot](https://www.switch-bot.com) device(s) from HomeKit.",
6
+ "author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
7
+ "license": "ISC",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git://github.com/OpenWonderLabs/homebridge-switchbot.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/OpenWonderLabs/homebridge-switchbot/issues"
14
+ },
15
+ "engines": {
16
+ "homebridge": "^1.4.0",
17
+ "node": "^14.18.3 || ^16.13.2"
18
+ },
19
+ "main": "dist/index.js",
20
+ "scripts": {
21
+ "check": "npm install && npm outdated",
22
+ "update": "ncu -u && npm update && npm install",
23
+ "lint": "eslint src/**.ts",
24
+ "watch": "npm run build && npm link && nodemon",
25
+ "build": "rimraf ./dist && tsc",
26
+ "prepublishOnly": "npm run lint && npm run build",
27
+ "postpublish": "npm run clean",
28
+ "clean": "rimraf ./dist",
29
+ "test": "eslint src/**.ts"
30
+ },
31
+ "funding": [
32
+ {
33
+ "type": "Paypal",
34
+ "url": "https://paypal.me/donavanbecker"
11
35
  },
12
- "bugs": {
13
- "url": "https://github.com/OpenWonderLabs/homebridge-switchbot/issues"
14
- },
15
- "engines": {
16
- "homebridge": "^1.4.0",
17
- "node": "^14.18.3 || ^16.13.2"
18
- },
19
- "main": "dist/index.js",
20
- "scripts": {
21
- "check": "npm install && npm outdated",
22
- "update": "ncu -u && npm update && npm install",
23
- "lint": "eslint src/**.ts",
24
- "watch": "npm run build && npm link && nodemon",
25
- "build": "rimraf ./dist && tsc",
26
- "prepublishOnly": "npm run lint && npm run build",
27
- "postpublish": "npm run clean",
28
- "clean": "rimraf ./dist",
29
- "test": "eslint src/**.ts"
30
- },
31
- "funding": [
32
- {
33
- "type": "Paypal",
34
- "url": "https://paypal.me/donavanbecker"
35
- },
36
- {
37
- "type": "GitHub",
38
- "url": "https://github.com/sponsors/donavanbecker"
39
- }
40
- ],
41
- "publishConfig": {
42
- "access": "public"
43
- },
44
- "keywords": [
45
- "homebridge-plugin",
46
- "switchbot",
47
- "humidifier",
48
- "humidity",
49
- "temperature",
50
- "bot",
51
- "curtains",
52
- "windows",
53
- "ble",
54
- "ir"
55
- ],
56
- "dependencies": {
57
- "@homebridge/plugin-ui-utils": "^0.0.19",
58
- "axios": "^0.25.0",
59
- "rxjs": "^7.5.2"
60
- },
61
- "devDependencies": {
62
- "@types/node": "^17.0.12",
63
- "@typescript-eslint/eslint-plugin": "^5.10.1",
64
- "@typescript-eslint/parser": "^5.10.1",
65
- "eslint": "^8.7.0",
66
- "eslint-config-prettier": "8.3.0",
67
- "eslint-plugin-prettier": "4.0.0",
68
- "homebridge": "^1.4.0",
69
- "nodemon": "^2.0.15",
70
- "npm-check-updates": "^12.2.1",
71
- "prettier": "2.5.1",
72
- "rimraf": "^3.0.2",
73
- "ts-node": "^10.4.0",
74
- "typescript": "^4.5.5",
75
- "typescript-axios-wb": "^1.0.3"
76
- },
77
- "optionalDependencies": {
78
- "node-switchbot": "^1.1.2"
36
+ {
37
+ "type": "GitHub",
38
+ "url": "https://github.com/sponsors/donavanbecker"
79
39
  }
40
+ ],
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "keywords": [
45
+ "homebridge-plugin",
46
+ "switchbot",
47
+ "humidifier",
48
+ "humidity",
49
+ "temperature",
50
+ "bot",
51
+ "curtains",
52
+ "windows",
53
+ "ble",
54
+ "ir"
55
+ ],
56
+ "dependencies": {
57
+ "@homebridge/plugin-ui-utils": "^0.0.19",
58
+ "axios": "^0.25.0",
59
+ "rxjs": "^7.5.2"
60
+ },
61
+ "devDependencies": {
62
+ "@types/node": "^17.0.13",
63
+ "@typescript-eslint/eslint-plugin": "^5.10.1",
64
+ "@typescript-eslint/parser": "^5.10.1",
65
+ "eslint": "^8.8.0",
66
+ "eslint-config-prettier": "8.3.0",
67
+ "eslint-plugin-prettier": "4.0.0",
68
+ "homebridge": "^1.4.0",
69
+ "nodemon": "^2.0.15",
70
+ "npm-check-updates": "^12.2.1",
71
+ "prettier": "2.5.1",
72
+ "rimraf": "^3.0.2",
73
+ "ts-node": "^10.4.0",
74
+ "typescript": "^4.5.5",
75
+ "typescript-axios-wb": "^1.0.3"
76
+ },
77
+ "optionalDependencies": {
78
+ "node-switchbot": "^1.1.2"
79
+ }
80
80
  }
package/src/device/bot.ts CHANGED
@@ -12,17 +12,17 @@ import { DeviceURL, device, devicesConfig, serviceData, ad, switchbot, deviceSta
12
12
  */
13
13
  export class Bot {
14
14
  // Services
15
- private fanService?: Service;
16
- private doorService?: Service;
17
- private lockService?: Service;
18
- private faucetService?: Service;
19
- private windowService?: Service;
20
- private switchService?: Service;
21
- private outletService?: Service;
22
- private batteryService?: Service;
23
- private garageDoorService?: Service;
24
- private windowCoveringService?: Service;
25
- private statefulProgrammableSwitchService?: Service;
15
+ fanService?: Service;
16
+ doorService?: Service;
17
+ lockService?: Service;
18
+ faucetService?: Service;
19
+ windowService?: Service;
20
+ switchService?: Service;
21
+ outletService?: Service;
22
+ batteryService?: Service;
23
+ garageDoorService?: Service;
24
+ windowCoveringService?: Service;
25
+ statefulProgrammableSwitchService?: Service;
26
26
 
27
27
  // Characteristic Values
28
28
  On!: CharacteristicValue;
@@ -333,8 +333,8 @@ export class Bot {
333
333
  // Start an update interval
334
334
  interval(this.deviceRefreshRate * 1000)
335
335
  .pipe(skipWhile(() => this.botUpdateInProgress))
336
- .subscribe(() => {
337
- this.refreshStatus();
336
+ .subscribe(async () => {
337
+ await this.refreshStatus();
338
338
  });
339
339
 
340
340
  // Watch for Bot change events
@@ -369,7 +369,7 @@ export class Bot {
369
369
  /**
370
370
  * Parse the device status from the SwitchBot api
371
371
  */
372
- async parseStatus() {
372
+ async parseStatus(): Promise<void> {
373
373
  if (this.SwitchToOpenAPI || !this.device.ble) {
374
374
  await this.openAPIparseStatus();
375
375
  } else {
@@ -377,7 +377,7 @@ export class Bot {
377
377
  }
378
378
  }
379
379
 
380
- private async BLEparseStatus() {
380
+ async BLEparseStatus(): Promise<void> {
381
381
  this.debugLog(`Bot: ${this.accessory.displayName} BLE parseStatus`);
382
382
  // BLEmode (true if Switch Mode) | (false if Press Mode)
383
383
  if (this.mode) {
@@ -406,7 +406,7 @@ export class Bot {
406
406
  this.debugLog(`Bot: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
407
407
  }
408
408
 
409
- private async openAPIparseStatus() {
409
+ async openAPIparseStatus(): Promise<void> {
410
410
  if (this.device.ble) {
411
411
  this.SwitchToOpenAPI = false;
412
412
  }
@@ -439,7 +439,7 @@ export class Bot {
439
439
  /**
440
440
  * Asks the SwitchBot API for the latest device information
441
441
  */
442
- async refreshStatus() {
442
+ async refreshStatus(): Promise<void> {
443
443
  if (this.device.ble) {
444
444
  await this.BLERefreshStatus();
445
445
  } else {
@@ -447,7 +447,7 @@ export class Bot {
447
447
  }
448
448
  }
449
449
 
450
- private async BLERefreshStatus() {
450
+ async BLERefreshStatus(): Promise<void> {
451
451
  this.debugLog(`Bot: ${this.accessory.displayName} BLE refreshStatus`);
452
452
  const switchbot = await this.platform.connectBLE();
453
453
  // Convert to BLE Address
@@ -523,7 +523,7 @@ export class Bot {
523
523
  });
524
524
  }
525
525
 
526
- private async openAPIRefreshStatus() {
526
+ async openAPIRefreshStatus(): Promise<void> {
527
527
  if (this.platform.config.credentials?.openToken) {
528
528
  this.debugLog(`Bot: ${this.accessory.displayName} OpenAPI refreshStatus`);
529
529
  try {
@@ -554,7 +554,7 @@ export class Bot {
554
554
  * Bot - "command" "turnOn" "default" = set to ON state
555
555
  * Bot - "command" "press" "default" = trigger press
556
556
  */
557
- async pushChanges() {
557
+ async pushChanges(): Promise<void> {
558
558
  if (this.device.ble) {
559
559
  await this.BLEpushChanges();
560
560
  } else {
@@ -563,12 +563,12 @@ export class Bot {
563
563
  interval(5000)
564
564
  .pipe(skipWhile(() => this.botUpdateInProgress))
565
565
  .pipe(take(1))
566
- .subscribe(() => {
567
- this.refreshStatus();
566
+ .subscribe(async () => {
567
+ await this.refreshStatus();
568
568
  });
569
569
  }
570
570
 
571
- private async BLEpushChanges() {
571
+ async BLEpushChanges(): Promise<void> {
572
572
  this.debugLog(`Bot: ${this.accessory.displayName} BLE pushChanges On: ${this.On} OnCached: ${this.OnCached}`);
573
573
  if (this.On !== this.OnCached || this.allowPush) {
574
574
  this.debugLog(`Bot: ${this.accessory.displayName} BLE pushChanges`);
@@ -662,15 +662,20 @@ export class Bot {
662
662
  this.accessory.context.On = this.OnCached;
663
663
  }
664
664
 
665
- private turnOnOff(device_list: any) {
666
- if (this.On) {
667
- return device_list[0].turnOn({ id: this.device.bleMac });
668
- } else {
669
- return device_list[0].turnOff({ id: this.device.bleMac });
670
- }
665
+ async turnOnOff(device_list: any): Promise<any> {
666
+ return await this.retry({
667
+ max: await this.maxRetry(),
668
+ fn: () => {
669
+ if (this.On) {
670
+ return device_list[0].turnOn({ id: this.device.bleMac });
671
+ } else {
672
+ return device_list[0].turnOff({ id: this.device.bleMac });
673
+ }
674
+ },
675
+ });
671
676
  }
672
677
 
673
- private async openAPIpushChanges() {
678
+ async openAPIpushChanges(): Promise<void> {
674
679
  if (this.platform.config.credentials?.openToken) {
675
680
  try {
676
681
  if (this.On !== this.OnCached || this.allowPush) {
@@ -726,7 +731,7 @@ export class Bot {
726
731
  /**
727
732
  * Updates the status for each of the HomeKit Characteristics
728
733
  */
729
- updateHomeKitCharacteristics() {
734
+ async updateHomeKitCharacteristics(): Promise<void> {
730
735
  if (this.device.bot?.deviceType === 'garagedoor') {
731
736
  if (this.On === undefined) {
732
737
  this.debugLog(`Bot: ${this.accessory.displayName} On: ${this.On}`);
@@ -913,7 +918,7 @@ export class Bot {
913
918
  }
914
919
  }
915
920
 
916
- public apiError(e: any) {
921
+ async apiError(e: any): Promise<void> {
917
922
  if (this.device.bot?.deviceType === 'garagedoor') {
918
923
  this.garageDoorService?.updateCharacteristic(this.platform.Characteristic.TargetDoorState, e);
919
924
  this.garageDoorService?.updateCharacteristic(this.platform.Characteristic.CurrentDoorState, e);
@@ -952,7 +957,7 @@ export class Bot {
952
957
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
953
958
  }
954
959
 
955
- private statusCode(push: AxiosResponse<{ statusCode: number }>) {
960
+ async statusCode(push: AxiosResponse<{ statusCode: number }>): Promise<void> {
956
961
  switch (push.data.statusCode) {
957
962
  case 151:
958
963
  this.errorLog(`Bot: ${this.accessory.displayName} Command not supported by this device type.`);
@@ -985,7 +990,7 @@ export class Bot {
985
990
  }
986
991
  }
987
992
 
988
- offlineOff() {
993
+ async offlineOff(): Promise<void> {
989
994
  if (this.device.offline) {
990
995
  this.On = false;
991
996
  if (this.device.bot?.deviceType === 'switch') {
@@ -999,7 +1004,7 @@ export class Bot {
999
1004
  /**
1000
1005
  * Handle requests to set the "On" characteristic
1001
1006
  */
1002
- handleOnSet(value: CharacteristicValue) {
1007
+ async handleOnSet(value: CharacteristicValue): Promise<void> {
1003
1008
  if (this.device.bot?.deviceType === 'garagedoor') {
1004
1009
  this.debugLog(`Bot: ${this.accessory.displayName} TargetDoorState: ${value}`);
1005
1010
  if (value === this.platform.Characteristic.TargetDoorState.CLOSED) {
@@ -1046,7 +1051,29 @@ export class Bot {
1046
1051
  this.doBotUpdate.next();
1047
1052
  }
1048
1053
 
1049
- config(device: device & devicesConfig) {
1054
+ async retry({ max, fn }: { max: number; fn: { (): any; (): Promise<any> } }): Promise<null> {
1055
+ return fn().catch(async (err: any) => {
1056
+ if (max === 0) {
1057
+ throw err;
1058
+ }
1059
+ this.infoLog(err);
1060
+ this.infoLog('Retrying');
1061
+ await this.switchbot.wait(1000);
1062
+ return this.retry({ max: max - 1, fn });
1063
+ });
1064
+ }
1065
+
1066
+ async maxRetry(): Promise<number> {
1067
+ let maxRetry: number;
1068
+ if (this.device.bot?.maxRetry) {
1069
+ maxRetry = this.device.bot?.maxRetry;
1070
+ } else {
1071
+ maxRetry = 5;
1072
+ }
1073
+ return maxRetry;
1074
+ }
1075
+
1076
+ async config(device: device & devicesConfig): Promise<void> {
1050
1077
  let config = {};
1051
1078
  if (device.bot) {
1052
1079
  config = device.bot;
@@ -1071,7 +1098,7 @@ export class Bot {
1071
1098
  }
1072
1099
  }
1073
1100
 
1074
- refreshRate(device: device & devicesConfig) {
1101
+ async refreshRate(device: device & devicesConfig): Promise<void> {
1075
1102
  if (device.refreshRate) {
1076
1103
  this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
1077
1104
  this.debugLog(`Bot: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
@@ -1081,7 +1108,7 @@ export class Bot {
1081
1108
  }
1082
1109
  }
1083
1110
 
1084
- scan(device: device & devicesConfig) {
1111
+ async scan(device: device & devicesConfig): Promise<void> {
1085
1112
  if (device.scanDuration) {
1086
1113
  this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
1087
1114
  if (device.ble) {
@@ -1095,7 +1122,7 @@ export class Bot {
1095
1122
  }
1096
1123
  }
1097
1124
 
1098
- logs(device: device & devicesConfig) {
1125
+ async logs(device: device & devicesConfig): Promise<void> {
1099
1126
  if (this.platform.debugMode) {
1100
1127
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
1101
1128
  this.debugLog(`Bot: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
@@ -1111,7 +1138,7 @@ export class Bot {
1111
1138
  }
1112
1139
  }
1113
1140
 
1114
- PressOrSwitch(device: device & devicesConfig) {
1141
+ async PressOrSwitch(device: device & devicesConfig): Promise<void> {
1115
1142
  if (!device.bot?.mode) {
1116
1143
  this.botMode = 'switch';
1117
1144
  this.warnLog(`Bot: ${this.accessory.displayName} does not have bot mode set in the Plugin's SwitchBot Device Settings,`);
@@ -1127,7 +1154,7 @@ export class Bot {
1127
1154
  }
1128
1155
  }
1129
1156
 
1130
- allowPushChanges(device: device & devicesConfig) {
1157
+ async allowPushChanges(device: device & devicesConfig): Promise<void> {
1131
1158
  if (device.bot?.allowPush) {
1132
1159
  this.allowPush = true;
1133
1160
  } else {
@@ -1136,7 +1163,7 @@ export class Bot {
1136
1163
  this.debugLog(`Bot: ${this.accessory.displayName} Allowing Push Changes: ${this.allowPush}`);
1137
1164
  }
1138
1165
 
1139
- public removeOutletService(accessory: PlatformAccessory) {
1166
+ async removeOutletService(accessory: PlatformAccessory): Promise<void> {
1140
1167
  // If outletService still pressent, then remove first
1141
1168
  this.outletService = this.accessory.getService(this.platform.Service.Outlet);
1142
1169
  if (this.outletService) {
@@ -1145,7 +1172,7 @@ export class Bot {
1145
1172
  accessory.removeService(this.outletService!);
1146
1173
  }
1147
1174
 
1148
- public removeGarageDoorService(accessory: PlatformAccessory) {
1175
+ async removeGarageDoorService(accessory: PlatformAccessory): Promise<void> {
1149
1176
  // If garageDoorService still pressent, then remove first
1150
1177
  this.garageDoorService = this.accessory.getService(this.platform.Service.GarageDoorOpener);
1151
1178
  if (this.garageDoorService) {
@@ -1154,7 +1181,7 @@ export class Bot {
1154
1181
  accessory.removeService(this.garageDoorService!);
1155
1182
  }
1156
1183
 
1157
- public removeDoorService(accessory: PlatformAccessory) {
1184
+ async removeDoorService(accessory: PlatformAccessory): Promise<void> {
1158
1185
  // If doorService still pressent, then remove first
1159
1186
  this.doorService = this.accessory.getService(this.platform.Service.Door);
1160
1187
  if (this.doorService) {
@@ -1163,7 +1190,7 @@ export class Bot {
1163
1190
  accessory.removeService(this.doorService!);
1164
1191
  }
1165
1192
 
1166
- public removeLockService(accessory: PlatformAccessory) {
1193
+ async removeLockService(accessory: PlatformAccessory): Promise<void> {
1167
1194
  // If lockService still pressent, then remove first
1168
1195
  this.lockService = this.accessory.getService(this.platform.Service.LockMechanism);
1169
1196
  if (this.lockService) {
@@ -1172,7 +1199,7 @@ export class Bot {
1172
1199
  accessory.removeService(this.lockService!);
1173
1200
  }
1174
1201
 
1175
- public removeFaucetService(accessory: PlatformAccessory) {
1202
+ async removeFaucetService(accessory: PlatformAccessory): Promise<void> {
1176
1203
  // If faucetService still pressent, then remove first
1177
1204
  this.faucetService = this.accessory.getService(this.platform.Service.Faucet);
1178
1205
  if (this.faucetService) {
@@ -1181,7 +1208,7 @@ export class Bot {
1181
1208
  accessory.removeService(this.faucetService!);
1182
1209
  }
1183
1210
 
1184
- public removeFanService(accessory: PlatformAccessory) {
1211
+ async removeFanService(accessory: PlatformAccessory): Promise<void> {
1185
1212
  // If fanService still pressent, then remove first
1186
1213
  this.fanService = this.accessory.getService(this.platform.Service.Fan);
1187
1214
  if (this.fanService) {
@@ -1190,7 +1217,7 @@ export class Bot {
1190
1217
  accessory.removeService(this.fanService!);
1191
1218
  }
1192
1219
 
1193
- public removeWindowService(accessory: PlatformAccessory) {
1220
+ async removeWindowService(accessory: PlatformAccessory): Promise<void> {
1194
1221
  // If windowService still pressent, then remove first
1195
1222
  this.windowService = this.accessory.getService(this.platform.Service.Window);
1196
1223
  if (this.windowService) {
@@ -1199,7 +1226,7 @@ export class Bot {
1199
1226
  accessory.removeService(this.windowService!);
1200
1227
  }
1201
1228
 
1202
- public removeWindowCoveringService(accessory: PlatformAccessory) {
1229
+ async removeWindowCoveringService(accessory: PlatformAccessory): Promise<void> {
1203
1230
  // If windowCoveringService still pressent, then remove first
1204
1231
  this.windowCoveringService = this.accessory.getService(this.platform.Service.WindowCovering);
1205
1232
  if (this.windowCoveringService) {
@@ -1208,7 +1235,7 @@ export class Bot {
1208
1235
  accessory.removeService(this.windowCoveringService!);
1209
1236
  }
1210
1237
 
1211
- public removeStatefulProgrammableSwitchService(accessory: PlatformAccessory) {
1238
+ async removeStatefulProgrammableSwitchService(accessory: PlatformAccessory): Promise<void> {
1212
1239
  // If statefulProgrammableSwitchService still pressent, then remove first
1213
1240
  this.statefulProgrammableSwitchService = this.accessory.getService(this.platform.Service.StatefulProgrammableSwitch);
1214
1241
  if (this.statefulProgrammableSwitchService) {
@@ -1217,7 +1244,7 @@ export class Bot {
1217
1244
  accessory.removeService(this.statefulProgrammableSwitchService!);
1218
1245
  }
1219
1246
 
1220
- public removeSwitchService(accessory: PlatformAccessory) {
1247
+ async removeSwitchService(accessory: PlatformAccessory): Promise<void> {
1221
1248
  // If switchService still pressent, then remove first
1222
1249
  this.switchService = this.accessory.getService(this.platform.Service.Switch);
1223
1250
  if (this.switchService) {
@@ -1229,25 +1256,25 @@ export class Bot {
1229
1256
  /**
1230
1257
  * Logging for Device
1231
1258
  */
1232
- infoLog(...log: any[]) {
1259
+ infoLog(...log: any[]): void {
1233
1260
  if (this.enablingDeviceLogging()) {
1234
1261
  this.platform.log.info(String(...log));
1235
1262
  }
1236
1263
  }
1237
1264
 
1238
- warnLog(...log: any[]) {
1265
+ warnLog(...log: any[]): void {
1239
1266
  if (this.enablingDeviceLogging()) {
1240
1267
  this.platform.log.warn(String(...log));
1241
1268
  }
1242
1269
  }
1243
1270
 
1244
- errorLog(...log: any[]) {
1271
+ errorLog(...log: any[]): void {
1245
1272
  if (this.enablingDeviceLogging()) {
1246
1273
  this.platform.log.error(String(...log));
1247
1274
  }
1248
1275
  }
1249
1276
 
1250
- debugLog(...log: any[]) {
1277
+ debugLog(...log: any[]): void {
1251
1278
  if (this.enablingDeviceLogging()) {
1252
1279
  if (this.deviceLogging === 'debug') {
1253
1280
  this.platform.log.info('[DEBUG]', String(...log));