@switchbot/homebridge-switchbot 1.11.0 → 1.12.1

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 (93) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/config.schema.json +18 -3
  3. package/dist/device/bot.d.ts +8 -0
  4. package/dist/device/bot.d.ts.map +1 -1
  5. package/dist/device/bot.js +40 -21
  6. package/dist/device/bot.js.map +1 -1
  7. package/dist/device/colorbulb.d.ts.map +1 -1
  8. package/dist/device/colorbulb.js +22 -32
  9. package/dist/device/colorbulb.js.map +1 -1
  10. package/dist/device/contact.d.ts.map +1 -1
  11. package/dist/device/contact.js +4 -10
  12. package/dist/device/contact.js.map +1 -1
  13. package/dist/device/curtain.d.ts.map +1 -1
  14. package/dist/device/curtain.js +13 -28
  15. package/dist/device/curtain.js.map +1 -1
  16. package/dist/device/humidifier.d.ts.map +1 -1
  17. package/dist/device/humidifier.js +9 -30
  18. package/dist/device/humidifier.js.map +1 -1
  19. package/dist/device/lock.d.ts.map +1 -1
  20. package/dist/device/lock.js +4 -10
  21. package/dist/device/lock.js.map +1 -1
  22. package/dist/device/meter.d.ts.map +1 -1
  23. package/dist/device/meter.js +4 -10
  24. package/dist/device/meter.js.map +1 -1
  25. package/dist/device/motion.d.ts.map +1 -1
  26. package/dist/device/motion.js +4 -10
  27. package/dist/device/motion.js.map +1 -1
  28. package/dist/device/plug.d.ts.map +1 -1
  29. package/dist/device/plug.js +4 -10
  30. package/dist/device/plug.js.map +1 -1
  31. package/dist/irdevice/airconditioner.d.ts +22 -22
  32. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  33. package/dist/irdevice/airconditioner.js +47 -50
  34. package/dist/irdevice/airconditioner.js.map +1 -1
  35. package/dist/irdevice/airpurifier.d.ts +12 -9
  36. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  37. package/dist/irdevice/airpurifier.js +23 -26
  38. package/dist/irdevice/airpurifier.js.map +1 -1
  39. package/dist/irdevice/camera.d.ts +10 -7
  40. package/dist/irdevice/camera.d.ts.map +1 -1
  41. package/dist/irdevice/camera.js +14 -17
  42. package/dist/irdevice/camera.js.map +1 -1
  43. package/dist/irdevice/fan.d.ts +12 -9
  44. package/dist/irdevice/fan.d.ts.map +1 -1
  45. package/dist/irdevice/fan.js +32 -35
  46. package/dist/irdevice/fan.js.map +1 -1
  47. package/dist/irdevice/light.d.ts +10 -7
  48. package/dist/irdevice/light.d.ts.map +1 -1
  49. package/dist/irdevice/light.js +16 -19
  50. package/dist/irdevice/light.js.map +1 -1
  51. package/dist/irdevice/other.d.ts +12 -9
  52. package/dist/irdevice/other.d.ts.map +1 -1
  53. package/dist/irdevice/other.js +21 -24
  54. package/dist/irdevice/other.js.map +1 -1
  55. package/dist/irdevice/tv.d.ts +13 -10
  56. package/dist/irdevice/tv.d.ts.map +1 -1
  57. package/dist/irdevice/tv.js +28 -31
  58. package/dist/irdevice/tv.js.map +1 -1
  59. package/dist/irdevice/vacuumcleaner.d.ts +10 -7
  60. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  61. package/dist/irdevice/vacuumcleaner.js +16 -19
  62. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  63. package/dist/irdevice/waterheater.d.ts +10 -7
  64. package/dist/irdevice/waterheater.d.ts.map +1 -1
  65. package/dist/irdevice/waterheater.js +19 -22
  66. package/dist/irdevice/waterheater.js.map +1 -1
  67. package/dist/platform.d.ts.map +1 -1
  68. package/dist/platform.js +5 -5
  69. package/dist/platform.js.map +1 -1
  70. package/dist/settings.d.ts +1 -0
  71. package/dist/settings.d.ts.map +1 -1
  72. package/dist/settings.js.map +1 -1
  73. package/package.json +4 -4
  74. package/src/device/bot.ts +40 -20
  75. package/src/device/colorbulb.ts +22 -44
  76. package/src/device/contact.ts +4 -12
  77. package/src/device/curtain.ts +13 -28
  78. package/src/device/humidifier.ts +9 -30
  79. package/src/device/lock.ts +4 -10
  80. package/src/device/meter.ts +4 -10
  81. package/src/device/motion.ts +4 -12
  82. package/src/device/plug.ts +4 -10
  83. package/src/irdevice/airconditioner.ts +57 -60
  84. package/src/irdevice/airpurifier.ts +33 -36
  85. package/src/irdevice/camera.ts +22 -25
  86. package/src/irdevice/fan.ts +43 -46
  87. package/src/irdevice/light.ts +26 -29
  88. package/src/irdevice/other.ts +29 -32
  89. package/src/irdevice/tv.ts +45 -50
  90. package/src/irdevice/vacuumcleaner.ts +24 -27
  91. package/src/irdevice/waterheater.ts +27 -30
  92. package/src/platform.ts +9 -9
  93. package/src/settings.ts +1 -0
@@ -10,7 +10,7 @@ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
10
10
  */
11
11
  export class VacuumCleaner {
12
12
  // Services
13
- service!: Service;
13
+ switchService!: Service;
14
14
 
15
15
  // Characteristic Values
16
16
  On!: CharacteristicValue;
@@ -38,7 +38,7 @@ export class VacuumCleaner {
38
38
 
39
39
  // get the Television service if it exists, otherwise create a new Television service
40
40
  // you can create multiple services for each accessory
41
- (this.service = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)),
41
+ (this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)),
42
42
  `${accessory.displayName} Vacuum`;
43
43
 
44
44
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
@@ -47,27 +47,27 @@ export class VacuumCleaner {
47
47
 
48
48
  // set the service name, this is what is displayed as the default name on the Home app
49
49
  // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
50
- this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
50
+ this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
51
51
 
52
52
  // handle on / off events using the On characteristic
53
- this.service.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
53
+ this.switchService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
54
54
  }
55
55
 
56
- private OnSet(value: CharacteristicValue) {
56
+ async OnSet(value: CharacteristicValue): Promise<void> {
57
57
  this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} On: ${value}`);
58
58
  this.On = value;
59
59
  if (this.On) {
60
- this.pushOnChanges();
60
+ await this.pushOnChanges();
61
61
  } else {
62
- this.pushOffChanges();
62
+ await this.pushOffChanges();
63
63
  }
64
64
  }
65
65
 
66
- private updateHomeKitCharacteristics() {
66
+ async updateHomeKitCharacteristics(): Promise<void> {
67
67
  if (this.On === undefined) {
68
68
  this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} On: ${this.On}`);
69
69
  } else {
70
- this.service?.updateCharacteristic(this.platform.Characteristic.On, this.On);
70
+ this.switchService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
71
71
  this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
72
72
  }
73
73
  }
@@ -82,7 +82,7 @@ export class VacuumCleaner {
82
82
  * Light: "command" "channelAdd" "default" = next channel
83
83
  * Light: "command" "channelSub" "default" = previous channel
84
84
  */
85
- async pushOnChanges() {
85
+ async pushOnChanges(): Promise<void> {
86
86
  if (this.On) {
87
87
  const payload = {
88
88
  commandType: 'command',
@@ -93,7 +93,7 @@ export class VacuumCleaner {
93
93
  }
94
94
  }
95
95
 
96
- async pushOffChanges() {
96
+ async pushOffChanges(): Promise<void> {
97
97
  if (!this.On) {
98
98
  const payload = {
99
99
  commandType: 'command',
@@ -104,7 +104,7 @@ export class VacuumCleaner {
104
104
  }
105
105
  }
106
106
 
107
- public async pushChanges(payload: payload) {
107
+ async pushChanges(payload: payload): Promise<void> {
108
108
  try {
109
109
  this.infoLog(
110
110
  `Vacuum Cleaner: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
@@ -120,20 +120,17 @@ export class VacuumCleaner {
120
120
  this.updateHomeKitCharacteristics();
121
121
  } catch (e: any) {
122
122
  this.errorLog(`Vacuum Cleaner: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
123
- if (this.deviceLogging === 'debug') {
123
+ if (this.deviceLogging.includes('debug')) {
124
124
  this.errorLog(
125
125
  `Vacuum Cleaner: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
126
126
  ` Error Message: ${JSON.stringify(e.message)}`,
127
127
  );
128
128
  }
129
- if (this.platform.debugMode) {
130
- this.errorLog(`Vacuum Cleaner: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
131
- }
132
129
  this.apiError(e);
133
130
  }
134
131
  }
135
132
 
136
- private statusCode(push: AxiosResponse<{ statusCode: number }>) {
133
+ async statusCode(push: AxiosResponse<{ statusCode: number }>): Promise<void>{
137
134
  switch (push.data.statusCode) {
138
135
  case 151:
139
136
  this.errorLog(`Vacuum Cleaner: ${this.accessory.displayName} Command not supported by this device type.`);
@@ -164,12 +161,12 @@ export class VacuumCleaner {
164
161
  }
165
162
  }
166
163
 
167
- public apiError(e: any) {
168
- this.service.updateCharacteristic(this.platform.Characteristic.On, e);
164
+ async apiError(e: any): Promise<void> {
165
+ this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
169
166
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
170
167
  }
171
168
 
172
- config(device: irdevice & irDevicesConfig) {
169
+ async config(device: irdevice & irDevicesConfig): Promise<void> {
173
170
  let config = {};
174
171
  if (device.irvc) {
175
172
  config = device.irvc;
@@ -178,11 +175,11 @@ export class VacuumCleaner {
178
175
  config['logging'] = device.logging;
179
176
  }
180
177
  if (Object.entries(config).length !== 0) {
181
- this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
178
+ this.infoLog(`Vacuum Cleaner: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
182
179
  }
183
180
  }
184
181
 
185
- logs(device: irdevice & irDevicesConfig) {
182
+ async logs(device: irdevice & irDevicesConfig): Promise<void> {
186
183
  if (this.platform.debugMode) {
187
184
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
188
185
  this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
@@ -201,25 +198,25 @@ export class VacuumCleaner {
201
198
  /**
202
199
  * Logging for Device
203
200
  */
204
- infoLog(...log: any[]) {
201
+ infoLog(...log: any[]): void {
205
202
  if (this.enablingDeviceLogging()) {
206
203
  this.platform.log.info(String(...log));
207
204
  }
208
205
  }
209
206
 
210
- warnLog(...log: any[]) {
207
+ warnLog(...log: any[]): void {
211
208
  if (this.enablingDeviceLogging()) {
212
209
  this.platform.log.warn(String(...log));
213
210
  }
214
211
  }
215
212
 
216
- errorLog(...log: any[]) {
213
+ errorLog(...log: any[]): void {
217
214
  if (this.enablingDeviceLogging()) {
218
215
  this.platform.log.error(String(...log));
219
216
  }
220
217
  }
221
218
 
222
- debugLog(...log: any[]) {
219
+ debugLog(...log: any[]): void {
223
220
  if (this.enablingDeviceLogging()) {
224
221
  if (this.deviceLogging === 'debug') {
225
222
  this.platform.log.info('[DEBUG]', String(...log));
@@ -230,6 +227,6 @@ export class VacuumCleaner {
230
227
  }
231
228
 
232
229
  enablingDeviceLogging(): boolean {
233
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
230
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
234
231
  }
235
232
  }
@@ -10,7 +10,7 @@ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
10
10
  */
11
11
  export class WaterHeater {
12
12
  // Services
13
- service!: Service;
13
+ valveService!: Service;
14
14
 
15
15
  // Characteristic Values
16
16
  Active!: CharacteristicValue;
@@ -38,7 +38,7 @@ export class WaterHeater {
38
38
 
39
39
  // get the Television service if it exists, otherwise create a new Television service
40
40
  // you can create multiple services for each accessory
41
- (this.service = accessory.getService(this.platform.Service.Valve) || accessory.addService(this.platform.Service.Valve)),
41
+ (this.valveService = accessory.getService(this.platform.Service.Valve) || accessory.addService(this.platform.Service.Valve)),
42
42
  `${accessory.displayName} Water Heater`;
43
43
 
44
44
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
@@ -47,34 +47,34 @@ export class WaterHeater {
47
47
 
48
48
  // set the service name, this is what is displayed as the default name on the Home app
49
49
  // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
50
- this.service.setCharacteristic(this.platform.Characteristic.Name, `${device.deviceName} ${device.remoteType}`);
50
+ this.valveService.setCharacteristic(this.platform.Characteristic.Name, `${device.deviceName} ${device.remoteType}`);
51
51
 
52
52
  // set sleep discovery characteristic
53
- this.service.setCharacteristic(this.platform.Characteristic.ValveType, this.platform.Characteristic.ValveType.GENERIC_VALVE);
53
+ this.valveService.setCharacteristic(this.platform.Characteristic.ValveType, this.platform.Characteristic.ValveType.GENERIC_VALVE);
54
54
 
55
55
  // handle on / off events using the Active characteristic
56
- this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
56
+ this.valveService.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
57
57
  }
58
58
 
59
- private ActiveSet(value: CharacteristicValue) {
59
+ async ActiveSet(value: CharacteristicValue): Promise<void> {
60
60
  this.debugLog(`Water Heater: ${this.accessory.displayName} Active: ${value}`);
61
61
  if (value === this.platform.Characteristic.Active.INACTIVE) {
62
- this.pushWaterHeaterOffChanges();
63
- this.service.setCharacteristic(this.platform.Characteristic.InUse, this.platform.Characteristic.InUse.NOT_IN_USE);
62
+ await this.pushWaterHeaterOffChanges();
63
+ this.valveService.setCharacteristic(this.platform.Characteristic.InUse, this.platform.Characteristic.InUse.NOT_IN_USE);
64
64
  } else {
65
- this.pushWaterHeaterOnChanges();
66
- this.service.setCharacteristic(this.platform.Characteristic.InUse, this.platform.Characteristic.InUse.IN_USE);
65
+ await this.pushWaterHeaterOnChanges();
66
+ this.valveService.setCharacteristic(this.platform.Characteristic.InUse, this.platform.Characteristic.InUse.IN_USE);
67
67
  }
68
68
  this.Active = value;
69
69
  this.ActiveCached = this.Active;
70
70
  this.accessory.context.Active = this.ActiveCached;
71
71
  }
72
72
 
73
- private updateHomeKitCharacteristics() {
73
+ async updateHomeKitCharacteristics(): Promise<void> {
74
74
  if (this.Active === undefined) {
75
75
  this.debugLog(`Water Heater: ${this.accessory.displayName} Active: ${this.Active}`);
76
76
  } else {
77
- this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
77
+ this.valveService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
78
78
  this.debugLog(`Water Heater: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
79
79
  }
80
80
  }
@@ -89,7 +89,7 @@ export class WaterHeater {
89
89
  * WaterHeater: "command" "channelAdd" "default" = next channel
90
90
  * WaterHeater: "command" "channelSub" "default" = previous channel
91
91
  */
92
- async pushWaterHeaterOnChanges() {
92
+ async pushWaterHeaterOnChanges(): Promise<void> {
93
93
  if (this.Active !== 1) {
94
94
  const payload = {
95
95
  commandType: 'command',
@@ -100,7 +100,7 @@ export class WaterHeater {
100
100
  }
101
101
  }
102
102
 
103
- async pushWaterHeaterOffChanges() {
103
+ async pushWaterHeaterOffChanges(): Promise<void> {
104
104
  if (this.Active !== 0) {
105
105
  const payload = {
106
106
  commandType: 'command',
@@ -111,7 +111,7 @@ export class WaterHeater {
111
111
  }
112
112
  }
113
113
 
114
- public async pushChanges(payload: payload) {
114
+ async pushChanges(payload: payload): Promise<void> {
115
115
  try {
116
116
  this.infoLog(
117
117
  `Water Heater: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
@@ -125,19 +125,16 @@ export class WaterHeater {
125
125
  this.updateHomeKitCharacteristics();
126
126
  } catch (e: any) {
127
127
  this.errorLog(`Water Heater: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
128
- if (this.deviceLogging === 'debug') {
128
+ if (this.deviceLogging.includes('debug')) {
129
129
  this.errorLog(
130
130
  `Water Heater: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
131
131
  );
132
132
  }
133
- if (this.platform.debugMode) {
134
- this.errorLog(`Water Heater: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
135
- }
136
133
  this.apiError(e);
137
134
  }
138
135
  }
139
136
 
140
- private statusCode(push: AxiosResponse<{ statusCode: number }>) {
137
+ async statusCode(push: AxiosResponse<{ statusCode: number }>): Promise<void>{
141
138
  switch (push.data.statusCode) {
142
139
  case 151:
143
140
  this.errorLog(`Water Heater: ${this.accessory.displayName} Command not supported by this device type.`);
@@ -168,12 +165,12 @@ export class WaterHeater {
168
165
  }
169
166
  }
170
167
 
171
- public apiError(e: any) {
172
- this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
168
+ async apiError(e: any): Promise<void> {
169
+ this.valveService.updateCharacteristic(this.platform.Characteristic.Active, e);
173
170
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
174
171
  }
175
172
 
176
- config(device: irdevice & irDevicesConfig) {
173
+ async config(device: irdevice & irDevicesConfig): Promise<void> {
177
174
  let config = {};
178
175
  if (device.irwh) {
179
176
  config = device.irwh;
@@ -182,11 +179,11 @@ export class WaterHeater {
182
179
  config['logging'] = device.logging;
183
180
  }
184
181
  if (Object.entries(config).length !== 0) {
185
- this.warnLog(`Water Heater: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
182
+ this.infoLog(`Water Heater: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
186
183
  }
187
184
  }
188
185
 
189
- logs(device: irdevice & irDevicesConfig) {
186
+ async logs(device: irdevice & irDevicesConfig): Promise<void> {
190
187
  if (this.platform.debugMode) {
191
188
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
192
189
  this.debugLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
@@ -205,25 +202,25 @@ export class WaterHeater {
205
202
  /**
206
203
  * Logging for Device
207
204
  */
208
- infoLog(...log: any[]) {
205
+ infoLog(...log: any[]): void {
209
206
  if (this.enablingDeviceLogging()) {
210
207
  this.platform.log.info(String(...log));
211
208
  }
212
209
  }
213
210
 
214
- warnLog(...log: any[]) {
211
+ warnLog(...log: any[]): void {
215
212
  if (this.enablingDeviceLogging()) {
216
213
  this.platform.log.warn(String(...log));
217
214
  }
218
215
  }
219
216
 
220
- errorLog(...log: any[]) {
217
+ errorLog(...log: any[]): void {
221
218
  if (this.enablingDeviceLogging()) {
222
219
  this.platform.log.error(String(...log));
223
220
  }
224
221
  }
225
222
 
226
- debugLog(...log: any[]) {
223
+ debugLog(...log: any[]): void {
227
224
  if (this.enablingDeviceLogging()) {
228
225
  if (this.deviceLogging === 'debug') {
229
226
  this.platform.log.info('[DEBUG]', String(...log));
@@ -234,6 +231,6 @@ export class WaterHeater {
234
231
  }
235
232
 
236
233
  enablingDeviceLogging(): boolean {
237
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
234
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
238
235
  }
239
236
  }
package/src/platform.ts CHANGED
@@ -61,7 +61,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
61
61
  this.debugLog('Config OK');
62
62
  } catch (e: any) {
63
63
  this.errorLog(JSON.stringify(e.message));
64
- if (this.platformLogging === 'debugMode') {
64
+ if (this.platformLogging?.includes('debug')) {
65
65
  this.errorLog(JSON.stringify(e));
66
66
  }
67
67
  return;
@@ -85,7 +85,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
85
85
  this.discoverDevices();
86
86
  } catch (e: any) {
87
87
  this.errorLog('Failed to Discover Devices.', JSON.stringify(e.message));
88
- if (this.platformLogging === 'debugMode') {
88
+ if (this.platformLogging?.includes('debug')) {
89
89
  this.errorLog(JSON.stringify(e));
90
90
  }
91
91
  }
@@ -140,7 +140,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
140
140
  platformConfig['pushRate'] = this.config.options.pushRate;
141
141
  }
142
142
  if (Object.entries(platformConfig).length !== 0) {
143
- this.warnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
143
+ this.infoLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
144
144
  }
145
145
 
146
146
  if (this.config.options) {
@@ -1546,13 +1546,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1546
1546
  }
1547
1547
 
1548
1548
  public deviceListInfo(devices: deviceResponses) {
1549
- if (this.platformLogging === 'debug') {
1549
+ if (this.platformLogging?.includes('debug')) {
1550
1550
  this.warnLog(`deviceListInfoStatus: ${JSON.stringify(devices)}`);
1551
1551
  }
1552
1552
  }
1553
1553
 
1554
1554
  public async deviceInfo(device: (irdevice & devicesConfig) | (device & devicesConfig)) {
1555
- if (this.platformLogging === 'debug') {
1555
+ if (this.platformLogging?.includes('debug')) {
1556
1556
  this.warnLog(JSON.stringify(device));
1557
1557
  this.deviceStatus = (await this.axios.get(`${DeviceURL}/${device.deviceId}/status`)).data;
1558
1558
  if (this.deviceStatus.message === 'success') {
@@ -1582,25 +1582,25 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1582
1582
  * If device level logging is turned on, log to log.warn
1583
1583
  * Otherwise send debug logs to log.debug
1584
1584
  */
1585
- infoLog(...log: any[]) {
1585
+ infoLog(...log: any[]): void {
1586
1586
  if (this.enablingPlatfromLogging()) {
1587
1587
  this.log.info(String(...log));
1588
1588
  }
1589
1589
  }
1590
1590
 
1591
- warnLog(...log: any[]) {
1591
+ warnLog(...log: any[]): void {
1592
1592
  if (this.enablingPlatfromLogging()) {
1593
1593
  this.log.warn(String(...log));
1594
1594
  }
1595
1595
  }
1596
1596
 
1597
- errorLog(...log: any[]) {
1597
+ errorLog(...log: any[]): void {
1598
1598
  if (this.enablingPlatfromLogging()) {
1599
1599
  this.log.error(String(...log));
1600
1600
  }
1601
1601
  }
1602
1602
 
1603
- debugLog(...log: any[]) {
1603
+ debugLog(...log: any[]): void {
1604
1604
  if (this.enablingPlatfromLogging()) {
1605
1605
  if (this.platformLogging === 'debugMode') {
1606
1606
  this.log.debug(String(...log));
package/src/settings.ts CHANGED
@@ -68,6 +68,7 @@ export type bot = {
68
68
  deviceType?: string;
69
69
  doublePress?: number;
70
70
  allowPush?: boolean;
71
+ maxRetry?: number;
71
72
  };
72
73
 
73
74
  export type humidifier = {