@switchbot/homebridge-switchbot 1.11.2 → 1.12.2-beta.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 (83) hide show
  1. package/CHANGELOG.md +14 -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 +8 -26
  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 +21 -37
  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.map +1 -1
  32. package/dist/irdevice/airconditioner.js +3 -6
  33. package/dist/irdevice/airconditioner.js.map +1 -1
  34. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  35. package/dist/irdevice/airpurifier.js +3 -6
  36. package/dist/irdevice/airpurifier.js.map +1 -1
  37. package/dist/irdevice/camera.d.ts.map +1 -1
  38. package/dist/irdevice/camera.js +3 -6
  39. package/dist/irdevice/camera.js.map +1 -1
  40. package/dist/irdevice/fan.d.ts.map +1 -1
  41. package/dist/irdevice/fan.js +3 -6
  42. package/dist/irdevice/fan.js.map +1 -1
  43. package/dist/irdevice/light.d.ts.map +1 -1
  44. package/dist/irdevice/light.js +3 -6
  45. package/dist/irdevice/light.js.map +1 -1
  46. package/dist/irdevice/other.d.ts.map +1 -1
  47. package/dist/irdevice/other.js +4 -7
  48. package/dist/irdevice/other.js.map +1 -1
  49. package/dist/irdevice/tv.d.ts.map +1 -1
  50. package/dist/irdevice/tv.js +3 -6
  51. package/dist/irdevice/tv.js.map +1 -1
  52. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  53. package/dist/irdevice/vacuumcleaner.js +3 -6
  54. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  55. package/dist/irdevice/waterheater.d.ts.map +1 -1
  56. package/dist/irdevice/waterheater.js +3 -6
  57. package/dist/irdevice/waterheater.js.map +1 -1
  58. package/dist/platform.js +6 -6
  59. package/dist/platform.js.map +1 -1
  60. package/dist/settings.d.ts +1 -0
  61. package/dist/settings.d.ts.map +1 -1
  62. package/dist/settings.js.map +1 -1
  63. package/package.json +76 -76
  64. package/src/device/bot.ts +40 -20
  65. package/src/device/colorbulb.ts +8 -36
  66. package/src/device/contact.ts +4 -12
  67. package/src/device/curtain.ts +9 -24
  68. package/src/device/humidifier.ts +9 -30
  69. package/src/device/lock.ts +4 -10
  70. package/src/device/meter.ts +4 -10
  71. package/src/device/motion.ts +4 -12
  72. package/src/device/plug.ts +4 -10
  73. package/src/irdevice/airconditioner.ts +3 -6
  74. package/src/irdevice/airpurifier.ts +3 -6
  75. package/src/irdevice/camera.ts +3 -6
  76. package/src/irdevice/fan.ts +3 -6
  77. package/src/irdevice/light.ts +3 -6
  78. package/src/irdevice/other.ts +4 -7
  79. package/src/irdevice/tv.ts +3 -8
  80. package/src/irdevice/vacuumcleaner.ts +3 -6
  81. package/src/irdevice/waterheater.ts +3 -6
  82. package/src/platform.ts +6 -6
  83. package/src/settings.ts +1 -0
@@ -261,15 +261,12 @@ export class Motion {
261
261
  })
262
262
  .catch(async (e: any) => {
263
263
  this.errorLog(`Motion Sensor: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
264
- if (this.deviceLogging === 'debug') {
264
+ if (this.deviceLogging.includes('debug')) {
265
265
  this.errorLog(
266
266
  `Motion Sensor: ${this.accessory.displayName} failed refreshStatus with BLE Connection,` +
267
267
  ` Error Message: ${JSON.stringify(e.message)}`,
268
268
  );
269
269
  }
270
- if (this.platform.debugMode) {
271
- this.errorLog(`Motion Sensor: ${this.accessory.displayName} failed refreshStatus with BLE Connection,` + ` Error: ${JSON.stringify(e)}`);
272
- }
273
270
  if (this.platform.config.credentials?.openToken) {
274
271
  this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using OpenAPI Connection`);
275
272
  this.SwitchToOpenAPI = true;
@@ -306,17 +303,12 @@ export class Motion {
306
303
  this.updateHomeKitCharacteristics();
307
304
  } catch (e: any) {
308
305
  this.errorLog(`Motion Sensor: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
309
- if (this.deviceLogging === 'debug') {
306
+ if (this.deviceLogging.includes('debug')) {
310
307
  this.errorLog(
311
308
  `Motion Sensor: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` +
312
309
  ` Error Message: ${JSON.stringify(e.message)}`,
313
310
  );
314
311
  }
315
- if (this.platform.debugMode) {
316
- this.errorLog(
317
- `Motion Sensor: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`,
318
- );
319
- }
320
312
  this.apiError(e);
321
313
  }
322
314
  }
@@ -387,7 +379,7 @@ export class Motion {
387
379
  config['offline'] = device.offline;
388
380
  }
389
381
  if (Object.entries(config).length !== 0) {
390
- this.warnLog(`Motion Sensor: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
382
+ this.infoLog(`Motion Sensor: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
391
383
  }
392
384
  }
393
385
 
@@ -481,6 +473,6 @@ export class Motion {
481
473
  }
482
474
 
483
475
  enablingDeviceLogging(): boolean {
484
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
476
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
485
477
  }
486
478
  }
@@ -95,12 +95,9 @@ export class Plug {
95
95
  await this.pushChanges();
96
96
  } catch (e: any) {
97
97
  this.errorLog(`Plug: ${this.accessory.displayName} failed pushChanges`);
98
- if (this.deviceLogging === 'debug') {
98
+ if (this.deviceLogging.includes('debug')) {
99
99
  this.errorLog(`Plug: ${this.accessory.displayName} failed pushChanges,` + ` Error Message: ${JSON.stringify(e.message)}`);
100
100
  }
101
- if (this.platform.debugMode) {
102
- this.errorLog(`Plug: ${this.accessory.displayName} failed pushChanges,` + ` Error: ${JSON.stringify(e)}`);
103
- }
104
101
  this.apiError(e);
105
102
  }
106
103
  this.plugUpdateInProgress = false;
@@ -127,14 +124,11 @@ export class Plug {
127
124
  this.updateHomeKitCharacteristics();
128
125
  } catch (e: any) {
129
126
  this.errorLog(`Plug: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
130
- if (this.deviceLogging === 'debug') {
127
+ if (this.deviceLogging.includes('debug')) {
131
128
  this.errorLog(
132
129
  `Plug: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
133
130
  );
134
131
  }
135
- if (this.platform.debugMode) {
136
- this.errorLog(`Plug: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
137
- }
138
132
  this.apiError(e);
139
133
  }
140
134
  }
@@ -278,7 +272,7 @@ export class Plug {
278
272
  config['offline'] = device.offline;
279
273
  }
280
274
  if (Object.entries(config).length !== 0) {
281
- this.warnLog(`Plug: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
275
+ this.infoLog(`Plug: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
282
276
  }
283
277
  }
284
278
 
@@ -354,6 +348,6 @@ export class Plug {
354
348
  }
355
349
 
356
350
  enablingDeviceLogging(): boolean {
357
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
351
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
358
352
  }
359
353
  }
@@ -269,12 +269,9 @@ export class AirConditioner {
269
269
  this.updateHomeKitCharacteristics();
270
270
  } catch (e: any) {
271
271
  this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges`);
272
- if (this.deviceLogging === 'debug') {
272
+ if (this.deviceLogging.includes('debug')) {
273
273
  this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges,` + ` Error Message: ${JSON.stringify(e.message)}`);
274
274
  }
275
- if (this.platform.debugMode) {
276
- this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges,` + ` Error: ${JSON.stringify(e)}`);
277
- }
278
275
  this.apiError(e);
279
276
  }
280
277
  }
@@ -590,7 +587,7 @@ export class AirConditioner {
590
587
  config['logging'] = device.logging;
591
588
  }
592
589
  if (Object.entries(config).length !== 0) {
593
- this.warnLog(`Air Conditioner: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
590
+ this.infoLog(`Air Conditioner: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
594
591
  }
595
592
  }
596
593
 
@@ -651,6 +648,6 @@ export class AirConditioner {
651
648
  }
652
649
 
653
650
  enablingDeviceLogging(): boolean {
654
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
651
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
655
652
  }
656
653
  }
@@ -228,14 +228,11 @@ export class AirPurifier {
228
228
  this.accessory.context.CurrentTemperature = this.CurrentTemperatureCached;
229
229
  } catch (e: any) {
230
230
  this.errorLog(`Air Purifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
231
- if (this.deviceLogging === 'debug') {
231
+ if (this.deviceLogging.includes('debug')) {
232
232
  this.errorLog(
233
233
  `Air Purifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
234
234
  );
235
235
  }
236
- if (this.platform.debugMode) {
237
- this.errorLog(`Air Purifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
238
- }
239
236
  this.apiError(e);
240
237
  }
241
238
  }
@@ -288,7 +285,7 @@ export class AirPurifier {
288
285
  config['logging'] = device.logging;
289
286
  }
290
287
  if (Object.entries(config).length !== 0) {
291
- this.warnLog(`Air Purifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
288
+ this.infoLog(`Air Purifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
292
289
  }
293
290
  }
294
291
 
@@ -340,6 +337,6 @@ export class AirPurifier {
340
337
  }
341
338
 
342
339
  enablingDeviceLogging(): boolean {
343
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
340
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
344
341
  }
345
342
  }
@@ -120,14 +120,11 @@ export class Camera {
120
120
  this.accessory.context.On = this.OnCached;
121
121
  } catch (e: any) {
122
122
  this.errorLog(`Camera: ${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
  `Camera: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
126
126
  );
127
127
  }
128
- if (this.platform.debugMode) {
129
- this.errorLog(`Camera: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
130
- }
131
128
  this.apiError(e);
132
129
  }
133
130
  }
@@ -177,7 +174,7 @@ export class Camera {
177
174
  config['logging'] = device.logging;
178
175
  }
179
176
  if (Object.entries(config).length !== 0) {
180
- this.warnLog(`Camera: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
177
+ this.infoLog(`Camera: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
181
178
  }
182
179
  }
183
180
 
@@ -229,6 +226,6 @@ export class Camera {
229
226
  }
230
227
 
231
228
  enablingDeviceLogging(): boolean {
232
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
229
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
233
230
  }
234
231
  }
@@ -245,14 +245,11 @@ export class Fan {
245
245
  this.updateHomeKitCharacteristics();
246
246
  } catch (e: any) {
247
247
  this.errorLog(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
248
- if (this.deviceLogging === 'debug') {
248
+ if (this.deviceLogging.includes('debug')) {
249
249
  this.errorLog(
250
250
  `Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
251
251
  );
252
252
  }
253
- if (this.platform.debugMode) {
254
- this.errorLog(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
255
- }
256
253
  this.apiError(e);
257
254
  }
258
255
  }
@@ -304,7 +301,7 @@ export class Fan {
304
301
  config['logging'] = device.logging;
305
302
  }
306
303
  if (Object.entries(config).length !== 0) {
307
- this.warnLog(`Fan: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
304
+ this.infoLog(`Fan: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
308
305
  }
309
306
  }
310
307
 
@@ -356,6 +353,6 @@ export class Fan {
356
353
  }
357
354
 
358
355
  enablingDeviceLogging(): boolean {
359
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
356
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
360
357
  }
361
358
  }
@@ -153,14 +153,11 @@ export class Light {
153
153
  this.updateHomeKitCharacteristics();
154
154
  } catch (e: any) {
155
155
  this.errorLog(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
156
- if (this.deviceLogging === 'debug') {
156
+ if (this.deviceLogging.includes('debug')) {
157
157
  this.errorLog(
158
158
  `Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
159
159
  );
160
160
  }
161
- if (this.platform.debugMode) {
162
- this.errorLog(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
163
- }
164
161
  this.apiError(e);
165
162
  }
166
163
  }
@@ -210,7 +207,7 @@ export class Light {
210
207
  config['logging'] = device.logging;
211
208
  }
212
209
  if (Object.entries(config).length !== 0) {
213
- this.warnLog(`Light: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
210
+ this.infoLog(`Light: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
214
211
  }
215
212
  }
216
213
 
@@ -262,6 +259,6 @@ export class Light {
262
259
  }
263
260
 
264
261
  enablingDeviceLogging(): boolean {
265
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
262
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
266
263
  }
267
264
  }
@@ -152,14 +152,11 @@ export class Others {
152
152
  this.updateHomeKitCharacteristics();
153
153
  } catch (e: any) {
154
154
  this.errorLog(`Other: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
155
- if (this.deviceLogging === 'debug') {
155
+ if (this.deviceLogging.includes('debug')) {
156
156
  this.errorLog(
157
157
  `Other: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
158
158
  );
159
159
  }
160
- if (this.platform.debugMode) {
161
- this.errorLog(`Other: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`);
162
- }
163
160
  this.apiError(e);
164
161
  }
165
162
  }
@@ -203,7 +200,7 @@ export class Others {
203
200
  async deviceType(device: irdevice & irDevicesConfig): Promise<void> {
204
201
  if (device.other?.deviceType) {
205
202
  this.otherDeviceType = this.accessory.context.deviceType = device.other.deviceType;
206
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
203
+ if (this.deviceLogging.includes('debug') || this.deviceLogging === 'standard') {
207
204
  this.warnLog(`Other: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
208
205
  }
209
206
  } else {
@@ -220,7 +217,7 @@ export class Others {
220
217
  config['logging'] = device.logging;
221
218
  }
222
219
  if (Object.entries(config).length !== 0) {
223
- this.warnLog(`Other: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
220
+ this.infoLog(`Other: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
224
221
  }
225
222
  }
226
223
 
@@ -272,6 +269,6 @@ export class Others {
272
269
  }
273
270
 
274
271
  enablingDeviceLogging(): boolean {
275
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
272
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
276
273
  }
277
274
  }
@@ -348,17 +348,12 @@ export class TV {
348
348
  this.updateHomeKitCharacteristics();
349
349
  } catch (e: any) {
350
350
  this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
351
- if (this.deviceLogging === 'debug') {
351
+ if (this.deviceLogging.includes('debug')) {
352
352
  this.errorLog(
353
353
  `${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
354
354
  ` Error Message: ${JSON.stringify(e.message)}`,
355
355
  );
356
356
  }
357
- if (this.platform.debugMode) {
358
- this.errorLog(
359
- `${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error: ${JSON.stringify(e)}`,
360
- );
361
- }
362
357
  this.apiError(e);
363
358
  }
364
359
  }
@@ -410,7 +405,7 @@ export class TV {
410
405
  config['logging'] = device.logging;
411
406
  }
412
407
  if (Object.entries(config).length !== 0) {
413
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
408
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
414
409
  }
415
410
  }
416
411
 
@@ -462,6 +457,6 @@ export class TV {
462
457
  }
463
458
 
464
459
  enablingDeviceLogging(): boolean {
465
- return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
460
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
466
461
  }
467
462
  }
@@ -120,15 +120,12 @@ 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
  }
@@ -178,7 +175,7 @@ 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
 
@@ -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
  }
@@ -125,14 +125,11 @@ 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
  }
@@ -182,7 +179,7 @@ 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
 
@@ -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
  }
@@ -117,7 +117,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
117
117
  * It should be used to setup event handlers for characteristics and update respective values.
118
118
  */
119
119
  configureAccessory(accessory: PlatformAccessory) {
120
- this.infoLog(`Loading accessory from cache: ${accessory.displayName}`);
120
+ this.debugLog(`Loading accessory from cache: ${accessory.displayName}`);
121
121
 
122
122
  // add the restored accessory to the accessories cache so we can track if it has already been registered
123
123
  this.accessories.push(accessory);
@@ -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') {
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 = {