@switchbot/homebridge-switchbot 2.0.0-beta.27 → 2.0.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 (112) hide show
  1. package/CHANGELOG.md +0 -2
  2. package/config.schema.json +2 -29
  3. package/dist/device/bot.d.ts +2 -0
  4. package/dist/device/bot.d.ts.map +1 -1
  5. package/dist/device/bot.js +19 -9
  6. package/dist/device/bot.js.map +1 -1
  7. package/dist/device/colorbulb.d.ts +2 -0
  8. package/dist/device/colorbulb.d.ts.map +1 -1
  9. package/dist/device/colorbulb.js +19 -9
  10. package/dist/device/colorbulb.js.map +1 -1
  11. package/dist/device/contact.d.ts +2 -0
  12. package/dist/device/contact.d.ts.map +1 -1
  13. package/dist/device/contact.js +18 -8
  14. package/dist/device/contact.js.map +1 -1
  15. package/dist/device/curtain.d.ts +2 -0
  16. package/dist/device/curtain.d.ts.map +1 -1
  17. package/dist/device/curtain.js +19 -9
  18. package/dist/device/curtain.js.map +1 -1
  19. package/dist/device/humidifier.d.ts +2 -0
  20. package/dist/device/humidifier.d.ts.map +1 -1
  21. package/dist/device/humidifier.js +19 -9
  22. package/dist/device/humidifier.js.map +1 -1
  23. package/dist/device/lock.d.ts +2 -0
  24. package/dist/device/lock.d.ts.map +1 -1
  25. package/dist/device/lock.js +17 -3
  26. package/dist/device/lock.js.map +1 -1
  27. package/dist/device/meter.d.ts +2 -0
  28. package/dist/device/meter.d.ts.map +1 -1
  29. package/dist/device/meter.js +18 -8
  30. package/dist/device/meter.js.map +1 -1
  31. package/dist/device/meterplus.d.ts +2 -0
  32. package/dist/device/meterplus.d.ts.map +1 -1
  33. package/dist/device/meterplus.js +18 -8
  34. package/dist/device/meterplus.js.map +1 -1
  35. package/dist/device/motion.d.ts +2 -0
  36. package/dist/device/motion.d.ts.map +1 -1
  37. package/dist/device/motion.js +18 -8
  38. package/dist/device/motion.js.map +1 -1
  39. package/dist/device/plug.d.ts +2 -0
  40. package/dist/device/plug.d.ts.map +1 -1
  41. package/dist/device/plug.js +19 -9
  42. package/dist/device/plug.js.map +1 -1
  43. package/dist/device/striplight.d.ts +2 -0
  44. package/dist/device/striplight.d.ts.map +1 -1
  45. package/dist/device/striplight.js +19 -9
  46. package/dist/device/striplight.js.map +1 -1
  47. package/dist/irdevice/airconditioner.d.ts +2 -0
  48. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  49. package/dist/irdevice/airconditioner.js +14 -0
  50. package/dist/irdevice/airconditioner.js.map +1 -1
  51. package/dist/irdevice/airpurifier.d.ts +2 -0
  52. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  53. package/dist/irdevice/airpurifier.js +14 -0
  54. package/dist/irdevice/airpurifier.js.map +1 -1
  55. package/dist/irdevice/camera.d.ts +2 -0
  56. package/dist/irdevice/camera.d.ts.map +1 -1
  57. package/dist/irdevice/camera.js +14 -0
  58. package/dist/irdevice/camera.js.map +1 -1
  59. package/dist/irdevice/fan.d.ts +2 -0
  60. package/dist/irdevice/fan.d.ts.map +1 -1
  61. package/dist/irdevice/fan.js +14 -0
  62. package/dist/irdevice/fan.js.map +1 -1
  63. package/dist/irdevice/light.d.ts +2 -0
  64. package/dist/irdevice/light.d.ts.map +1 -1
  65. package/dist/irdevice/light.js +14 -0
  66. package/dist/irdevice/light.js.map +1 -1
  67. package/dist/irdevice/other.d.ts +2 -0
  68. package/dist/irdevice/other.d.ts.map +1 -1
  69. package/dist/irdevice/other.js +14 -0
  70. package/dist/irdevice/other.js.map +1 -1
  71. package/dist/irdevice/tv.d.ts +2 -0
  72. package/dist/irdevice/tv.d.ts.map +1 -1
  73. package/dist/irdevice/tv.js +14 -0
  74. package/dist/irdevice/tv.js.map +1 -1
  75. package/dist/irdevice/vacuumcleaner.d.ts +2 -0
  76. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  77. package/dist/irdevice/vacuumcleaner.js +14 -0
  78. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  79. package/dist/irdevice/waterheater.d.ts +2 -0
  80. package/dist/irdevice/waterheater.d.ts.map +1 -1
  81. package/dist/irdevice/waterheater.js +14 -0
  82. package/dist/irdevice/waterheater.js.map +1 -1
  83. package/dist/platform.d.ts +4 -5
  84. package/dist/platform.d.ts.map +1 -1
  85. package/dist/platform.js +155 -180
  86. package/dist/platform.js.map +1 -1
  87. package/dist/settings.d.ts +1 -0
  88. package/dist/settings.d.ts.map +1 -1
  89. package/dist/settings.js.map +1 -1
  90. package/package.json +1 -1
  91. package/src/device/bot.ts +21 -9
  92. package/src/device/colorbulb.ts +21 -9
  93. package/src/device/contact.ts +20 -8
  94. package/src/device/curtain.ts +21 -9
  95. package/src/device/humidifier.ts +21 -9
  96. package/src/device/lock.ts +19 -3
  97. package/src/device/meter.ts +20 -8
  98. package/src/device/meterplus.ts +20 -8
  99. package/src/device/motion.ts +20 -8
  100. package/src/device/plug.ts +21 -9
  101. package/src/device/striplight.ts +21 -9
  102. package/src/irdevice/airconditioner.ts +16 -0
  103. package/src/irdevice/airpurifier.ts +16 -0
  104. package/src/irdevice/camera.ts +16 -0
  105. package/src/irdevice/fan.ts +16 -0
  106. package/src/irdevice/light.ts +16 -0
  107. package/src/irdevice/other.ts +16 -0
  108. package/src/irdevice/tv.ts +16 -0
  109. package/src/irdevice/vacuumcleaner.ts +16 -0
  110. package/src/irdevice/waterheater.ts +16 -0
  111. package/src/platform.ts +151 -181
  112. package/src/settings.ts +1 -0
@@ -225,7 +225,7 @@ export class ColorBulb {
225
225
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
226
226
  await this.openAPIparseStatus();
227
227
  } else {
228
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
228
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
229
229
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
230
230
  }
231
231
  }
@@ -300,7 +300,7 @@ export class ColorBulb {
300
300
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
301
301
  await this.openAPIRefreshStatus();
302
302
  } else {
303
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
303
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
304
304
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
305
305
  }
306
306
  }
@@ -326,12 +326,8 @@ export class ColorBulb {
326
326
  // Set an event hander
327
327
  switchbot.onadvertisement = (ad: any) => {
328
328
  this.address = ad.address;
329
- if (this.deviceLogging.includes('debug')) {
330
- this.infoLog(this.address);
331
- this.infoLog(this.device.bleMac);
332
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
333
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
334
- }
329
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
330
+ + ` BLE Address Found: ${this.address}`);
335
331
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${superStringify(ad.serviceData)}`);
336
332
  this.serviceData = ad.serviceData;
337
333
  //this.state = ad.serviceData.state;
@@ -453,7 +449,7 @@ export class ColorBulb {
453
449
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
454
450
  await this.openAPIpushChanges();
455
451
  } else {
456
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
452
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
457
453
  + ` ${this.device.connectionType}, pushChanges will not happen.`);
458
454
  }
459
455
  interval(5000)
@@ -1159,12 +1155,28 @@ export class ColorBulb {
1159
1155
  }
1160
1156
  }
1161
1157
 
1158
+ debugWarnLog(...log: any[]): void {
1159
+ if (this.enablingDeviceLogging()) {
1160
+ if (this.deviceLogging?.includes('debug')) {
1161
+ this.platform.log.warn('[DEBUG]', String(...log));
1162
+ }
1163
+ }
1164
+ }
1165
+
1162
1166
  errorLog(...log: any[]): void {
1163
1167
  if (this.enablingDeviceLogging()) {
1164
1168
  this.platform.log.error(String(...log));
1165
1169
  }
1166
1170
  }
1167
1171
 
1172
+ debugErrorLog(...log: any[]): void {
1173
+ if (this.enablingDeviceLogging()) {
1174
+ if (this.deviceLogging?.includes('debug')) {
1175
+ this.platform.log.error('[DEBUG]', String(...log));
1176
+ }
1177
+ }
1178
+ }
1179
+
1168
1180
  debugLog(...log: any[]): void {
1169
1181
  if (this.enablingDeviceLogging()) {
1170
1182
  if (this.deviceLogging === 'debug') {
@@ -168,7 +168,7 @@ export class Contact {
168
168
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
169
169
  await this.openAPIparseStatus();
170
170
  } else {
171
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
171
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
172
172
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
173
173
  }
174
174
  }
@@ -266,7 +266,7 @@ export class Contact {
266
266
  } else if (this.OpenAPI) {
267
267
  await this.openAPIRefreshStatus();
268
268
  } else {
269
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
269
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
270
270
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
271
271
  }
272
272
  }
@@ -294,12 +294,8 @@ export class Contact {
294
294
  // Set an event hander
295
295
  switchbot.onadvertisement = (ad: any) => {
296
296
  this.address = ad.address;
297
- if (this.deviceLogging.includes('debug')) {
298
- this.infoLog(this.address);
299
- this.infoLog(this.device.bleMac);
300
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
301
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
302
- }
297
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
298
+ + ` BLE Address Found: ${this.address}`);
303
299
  this.serviceData = ad.serviceData;
304
300
  this.movement = ad.serviceData.movement;
305
301
  this.doorState = ad.serviceData.doorState;
@@ -655,12 +651,28 @@ export class Contact {
655
651
  }
656
652
  }
657
653
 
654
+ debugWarnLog(...log: any[]): void {
655
+ if (this.enablingDeviceLogging()) {
656
+ if (this.deviceLogging?.includes('debug')) {
657
+ this.platform.log.warn('[DEBUG]', String(...log));
658
+ }
659
+ }
660
+ }
661
+
658
662
  errorLog(...log: any[]): void {
659
663
  if (this.enablingDeviceLogging()) {
660
664
  this.platform.log.error(String(...log));
661
665
  }
662
666
  }
663
667
 
668
+ debugErrorLog(...log: any[]): void {
669
+ if (this.enablingDeviceLogging()) {
670
+ if (this.deviceLogging?.includes('debug')) {
671
+ this.platform.log.error('[DEBUG]', String(...log));
672
+ }
673
+ }
674
+ }
675
+
664
676
  debugLog(...log: any[]): void {
665
677
  if (this.enablingDeviceLogging()) {
666
678
  if (this.deviceLogging === 'debug') {
@@ -219,7 +219,7 @@ export class Curtain {
219
219
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
220
220
  await this.openAPIparseStatus();
221
221
  } else {
222
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
222
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
223
223
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
224
224
  }
225
225
  }
@@ -391,7 +391,7 @@ export class Curtain {
391
391
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
392
392
  await this.openAPIRefreshStatus();
393
393
  } else {
394
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
394
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
395
395
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
396
396
  }
397
397
  }
@@ -417,12 +417,8 @@ export class Curtain {
417
417
  // Set an event hander
418
418
  switchbot.onadvertisement = (ad: any) => {
419
419
  this.address = ad.address;
420
- if (this.deviceLogging.includes('debug')) {
421
- this.infoLog(this.address);
422
- this.infoLog(this.device.bleMac);
423
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
424
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
425
- }
420
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
421
+ + ` BLE Address Found: ${this.address}`);
426
422
  this.serviceData = ad.serviceData;
427
423
  this.calibration = ad.serviceData.calibration;
428
424
  this.battery = ad.serviceData.battery;
@@ -526,7 +522,7 @@ export class Curtain {
526
522
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
527
523
  await this.openAPIpushChanges();
528
524
  } else {
529
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
525
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
530
526
  + ` ${this.device.connectionType}, pushChanges will not happen.`);
531
527
  }
532
528
  interval(this.updateRate * 1000)
@@ -1070,12 +1066,28 @@ export class Curtain {
1070
1066
  }
1071
1067
  }
1072
1068
 
1069
+ debugWarnLog(...log: any[]): void {
1070
+ if (this.enablingDeviceLogging()) {
1071
+ if (this.deviceLogging?.includes('debug')) {
1072
+ this.platform.log.warn('[DEBUG]', String(...log));
1073
+ }
1074
+ }
1075
+ }
1076
+
1073
1077
  errorLog(...log: any[]): void {
1074
1078
  if (this.enablingDeviceLogging()) {
1075
1079
  this.platform.log.error(String(...log));
1076
1080
  }
1077
1081
  }
1078
1082
 
1083
+ debugErrorLog(...log: any[]): void {
1084
+ if (this.enablingDeviceLogging()) {
1085
+ if (this.deviceLogging?.includes('debug')) {
1086
+ this.platform.log.error('[DEBUG]', String(...log));
1087
+ }
1088
+ }
1089
+ }
1090
+
1079
1091
  debugLog(...log: any[]): void {
1080
1092
  if (this.enablingDeviceLogging()) {
1081
1093
  if (this.deviceLogging === 'debug') {
@@ -197,7 +197,7 @@ export class Humidifier {
197
197
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
198
198
  await this.openAPIparseStatus();
199
199
  } else {
200
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
200
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
201
201
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
202
202
  }
203
203
  }
@@ -284,7 +284,7 @@ export class Humidifier {
284
284
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
285
285
  await this.openAPIRefreshStatus();
286
286
  } else {
287
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
287
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
288
288
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
289
289
  }
290
290
  }
@@ -310,12 +310,8 @@ export class Humidifier {
310
310
  // Set an event hander
311
311
  switchbot.onadvertisement = (ad: ad) => {
312
312
  this.address = ad.address;
313
- if (this.deviceLogging.includes('debug')) {
314
- this.infoLog(this.address);
315
- this.infoLog(this.device.bleMac);
316
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
317
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
318
- }
313
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
314
+ + ` BLE Address Found: ${this.address}`);
319
315
  this.serviceData = ad.serviceData;
320
316
  this.autoMode = ad.serviceData.autoMode;
321
317
  this.onState = ad.serviceData.onState;
@@ -424,7 +420,7 @@ export class Humidifier {
424
420
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
425
421
  await this.openAPIpushChanges();
426
422
  } else {
427
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
423
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
428
424
  + ` ${this.device.connectionType}, pushChanges will not happen.`);
429
425
  }
430
426
  interval(5000)
@@ -997,12 +993,28 @@ export class Humidifier {
997
993
  }
998
994
  }
999
995
 
996
+ debugWarnLog(...log: any[]): void {
997
+ if (this.enablingDeviceLogging()) {
998
+ if (this.deviceLogging?.includes('debug')) {
999
+ this.platform.log.warn('[DEBUG]', String(...log));
1000
+ }
1001
+ }
1002
+ }
1003
+
1000
1004
  errorLog(...log: any[]): void {
1001
1005
  if (this.enablingDeviceLogging()) {
1002
1006
  this.platform.log.error(String(...log));
1003
1007
  }
1004
1008
  }
1005
1009
 
1010
+ debugErrorLog(...log: any[]): void {
1011
+ if (this.enablingDeviceLogging()) {
1012
+ if (this.deviceLogging?.includes('debug')) {
1013
+ this.platform.log.error('[DEBUG]', String(...log));
1014
+ }
1015
+ }
1016
+ }
1017
+
1006
1018
  debugLog(...log: any[]): void {
1007
1019
  if (this.enablingDeviceLogging()) {
1008
1020
  if (this.deviceLogging === 'debug') {
@@ -137,7 +137,7 @@ export class Lock {
137
137
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
138
138
  await this.openAPIparseStatus();
139
139
  } else {
140
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
140
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
141
141
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
142
142
  }
143
143
  }
@@ -195,7 +195,7 @@ export class Lock {
195
195
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
196
196
  await this.openAPIRefreshStatus();
197
197
  } else {
198
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
198
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
199
199
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
200
200
  }
201
201
  }
@@ -265,7 +265,7 @@ export class Lock {
265
265
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
266
266
  await this.openAPIpushChanges();
267
267
  } else {
268
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
268
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
269
269
  + ` ${this.device.connectionType}, pushChanges will not happen.`);
270
270
  }
271
271
  interval(5000)
@@ -581,12 +581,28 @@ export class Lock {
581
581
  }
582
582
  }
583
583
 
584
+ debugWarnLog(...log: any[]): void {
585
+ if (this.enablingDeviceLogging()) {
586
+ if (this.deviceLogging?.includes('debug')) {
587
+ this.platform.log.warn('[DEBUG]', String(...log));
588
+ }
589
+ }
590
+ }
591
+
584
592
  errorLog(...log: any[]): void {
585
593
  if (this.enablingDeviceLogging()) {
586
594
  this.platform.log.error(String(...log));
587
595
  }
588
596
  }
589
597
 
598
+ debugErrorLog(...log: any[]): void {
599
+ if (this.enablingDeviceLogging()) {
600
+ if (this.deviceLogging?.includes('debug')) {
601
+ this.platform.log.error('[DEBUG]', String(...log));
602
+ }
603
+ }
604
+ }
605
+
590
606
  debugLog(...log: any[]): void {
591
607
  if (this.enablingDeviceLogging()) {
592
608
  if (this.deviceLogging === 'debug') {
@@ -181,7 +181,7 @@ export class Meter {
181
181
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
182
182
  await this.openAPIparseStatus();
183
183
  } else {
184
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
184
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
185
185
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
186
186
  }
187
187
  }
@@ -236,7 +236,7 @@ export class Meter {
236
236
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
237
237
  await this.openAPIRefreshStatus();
238
238
  } else {
239
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
239
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
240
240
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
241
241
  }
242
242
  }
@@ -262,12 +262,8 @@ export class Meter {
262
262
  // Set an event hander
263
263
  switchbot.onadvertisement = (ad: ad) => {
264
264
  this.address = ad.address;
265
- if (this.deviceLogging.includes('debug')) {
266
- this.infoLog(this.address);
267
- this.infoLog(this.device.bleMac);
268
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
269
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
270
- }
265
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
266
+ + ` BLE Address Found: ${this.address}`);
271
267
  if (ad.serviceData.humidity! > 0) {
272
268
  // reject unreliable data
273
269
  this.humidity = ad.serviceData.humidity;
@@ -683,12 +679,28 @@ export class Meter {
683
679
  }
684
680
  }
685
681
 
682
+ debugWarnLog(...log: any[]): void {
683
+ if (this.enablingDeviceLogging()) {
684
+ if (this.deviceLogging?.includes('debug')) {
685
+ this.platform.log.warn('[DEBUG]', String(...log));
686
+ }
687
+ }
688
+ }
689
+
686
690
  errorLog(...log: any[]): void {
687
691
  if (this.enablingDeviceLogging()) {
688
692
  this.platform.log.error(String(...log));
689
693
  }
690
694
  }
691
695
 
696
+ debugErrorLog(...log: any[]): void {
697
+ if (this.enablingDeviceLogging()) {
698
+ if (this.deviceLogging?.includes('debug')) {
699
+ this.platform.log.error('[DEBUG]', String(...log));
700
+ }
701
+ }
702
+ }
703
+
692
704
  debugLog(...log: any[]): void {
693
705
  if (this.enablingDeviceLogging()) {
694
706
  if (this.deviceLogging === 'debug') {
@@ -181,7 +181,7 @@ export class MeterPlus {
181
181
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
182
182
  await this.openAPIparseStatus();
183
183
  } else {
184
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
184
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
185
185
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
186
186
  }
187
187
  }
@@ -236,7 +236,7 @@ export class MeterPlus {
236
236
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
237
237
  await this.openAPIRefreshStatus();
238
238
  } else {
239
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
239
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
240
240
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
241
241
  }
242
242
  }
@@ -262,12 +262,8 @@ export class MeterPlus {
262
262
  // Set an event hander
263
263
  switchbot.onadvertisement = (ad: ad) => {
264
264
  this.address = ad.address;
265
- if (this.deviceLogging.includes('debug')) {
266
- this.infoLog(this.address);
267
- this.infoLog(this.device.bleMac);
268
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
269
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
270
- }
265
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
266
+ + ` BLE Address Found: ${this.address}`);
271
267
  if (ad.serviceData.humidity! > 0) {
272
268
  // reject unreliable data
273
269
  this.humidity = ad.serviceData.humidity;
@@ -692,12 +688,28 @@ export class MeterPlus {
692
688
  }
693
689
  }
694
690
 
691
+ debugWarnLog(...log: any[]): void {
692
+ if (this.enablingDeviceLogging()) {
693
+ if (this.deviceLogging?.includes('debug')) {
694
+ this.platform.log.warn('[DEBUG]', String(...log));
695
+ }
696
+ }
697
+ }
698
+
695
699
  errorLog(...log: any[]): void {
696
700
  if (this.enablingDeviceLogging()) {
697
701
  this.platform.log.error(String(...log));
698
702
  }
699
703
  }
700
704
 
705
+ debugErrorLog(...log: any[]): void {
706
+ if (this.enablingDeviceLogging()) {
707
+ if (this.deviceLogging?.includes('debug')) {
708
+ this.platform.log.error('[DEBUG]', String(...log));
709
+ }
710
+ }
711
+ }
712
+
701
713
  debugLog(...log: any[]): void {
702
714
  if (this.enablingDeviceLogging()) {
703
715
  if (this.deviceLogging === 'debug') {
@@ -147,7 +147,7 @@ export class Motion {
147
147
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
148
148
  await this.openAPIparseStatus();
149
149
  } else {
150
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
150
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
151
151
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
152
152
  }
153
153
  }
@@ -218,7 +218,7 @@ export class Motion {
218
218
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
219
219
  await this.openAPIRefreshStatus();
220
220
  } else {
221
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
221
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
222
222
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
223
223
  }
224
224
  }
@@ -246,12 +246,8 @@ export class Motion {
246
246
  // Set an event hander
247
247
  switchbot.onadvertisement = (ad: any) => {
248
248
  this.address = ad.address;
249
- if (this.deviceLogging.includes('debug')) {
250
- this.infoLog(this.address);
251
- this.infoLog(this.device.bleMac);
252
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
253
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
254
- }
249
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
250
+ + ` BLE Address Found: ${this.address}`);
255
251
  this.serviceData = ad.serviceData;
256
252
  this.movement = ad.serviceData.movement;
257
253
  this.battery = ad.serviceData.battery;
@@ -589,12 +585,28 @@ export class Motion {
589
585
  }
590
586
  }
591
587
 
588
+ debugWarnLog(...log: any[]): void {
589
+ if (this.enablingDeviceLogging()) {
590
+ if (this.deviceLogging?.includes('debug')) {
591
+ this.platform.log.warn('[DEBUG]', String(...log));
592
+ }
593
+ }
594
+ }
595
+
592
596
  errorLog(...log: any[]): void {
593
597
  if (this.enablingDeviceLogging()) {
594
598
  this.platform.log.error(String(...log));
595
599
  }
596
600
  }
597
601
 
602
+ debugErrorLog(...log: any[]): void {
603
+ if (this.enablingDeviceLogging()) {
604
+ if (this.deviceLogging?.includes('debug')) {
605
+ this.platform.log.error('[DEBUG]', String(...log));
606
+ }
607
+ }
608
+ }
609
+
598
610
  debugLog(...log: any[]): void {
599
611
  if (this.enablingDeviceLogging()) {
600
612
  if (this.deviceLogging === 'debug') {
@@ -130,7 +130,7 @@ export class Plug {
130
130
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
131
131
  await this.openAPIparseStatus();
132
132
  } else {
133
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
133
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
134
134
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
135
135
  }
136
136
  }
@@ -169,7 +169,7 @@ export class Plug {
169
169
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
170
170
  await this.openAPIRefreshStatus();
171
171
  } else {
172
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
172
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
173
173
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
174
174
  }
175
175
  }
@@ -195,12 +195,8 @@ export class Plug {
195
195
  // Set an event hander
196
196
  switchbot.onadvertisement = (ad: any) => {
197
197
  this.address = ad.address;
198
- if (this.deviceLogging.includes('debug')) {
199
- this.infoLog(this.address);
200
- this.infoLog(this.device.bleMac);
201
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
202
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
203
- }
198
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
199
+ + ` BLE Address Found: ${this.address}`);
204
200
  this.serviceData = ad.serviceData;
205
201
  this.state = ad.serviceData.state;
206
202
  this.delay = ad.serviceData.delay;
@@ -317,7 +313,7 @@ export class Plug {
317
313
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
318
314
  await this.openAPIpushChanges();
319
315
  } else {
320
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
316
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
321
317
  + ` ${this.device.connectionType}, pushChanges will not happen.`);
322
318
  }
323
319
  interval(5000)
@@ -693,12 +689,28 @@ export class Plug {
693
689
  }
694
690
  }
695
691
 
692
+ debugWarnLog(...log: any[]): void {
693
+ if (this.enablingDeviceLogging()) {
694
+ if (this.deviceLogging?.includes('debug')) {
695
+ this.platform.log.warn('[DEBUG]', String(...log));
696
+ }
697
+ }
698
+ }
699
+
696
700
  errorLog(...log: any[]): void {
697
701
  if (this.enablingDeviceLogging()) {
698
702
  this.platform.log.error(String(...log));
699
703
  }
700
704
  }
701
705
 
706
+ debugErrorLog(...log: any[]): void {
707
+ if (this.enablingDeviceLogging()) {
708
+ if (this.deviceLogging?.includes('debug')) {
709
+ this.platform.log.error('[DEBUG]', String(...log));
710
+ }
711
+ }
712
+ }
713
+
702
714
  debugLog(...log: any[]): void {
703
715
  if (this.enablingDeviceLogging()) {
704
716
  if (this.deviceLogging === 'debug') {
@@ -224,7 +224,7 @@ export class StripLight {
224
224
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
225
225
  await this.openAPIparseStatus();
226
226
  } else {
227
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
227
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
228
228
  + ` ${this.device.connectionType}, parseStatus will not happen.`);
229
229
  }
230
230
  }
@@ -288,7 +288,7 @@ export class StripLight {
288
288
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
289
289
  await this.openAPIRefreshStatus();
290
290
  } else {
291
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
291
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
292
292
  + ` ${this.device.connectionType}, refreshStatus will not happen.`);
293
293
  }
294
294
  }
@@ -314,12 +314,8 @@ export class StripLight {
314
314
  // Set an event hander
315
315
  switchbot.onadvertisement = (ad: any) => {
316
316
  this.address = ad.address;
317
- if (this.deviceLogging.includes('debug')) {
318
- this.infoLog(this.address);
319
- this.infoLog(this.device.bleMac);
320
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} BLE Address Found: ${this.address}`);
321
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac}`);
322
- }
317
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},`
318
+ + ` BLE Address Found: ${this.address}`);
323
319
  this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${superStringify(ad.serviceData)}`);
324
320
  this.serviceData = ad.serviceData;
325
321
  //this.state = ad.serviceData.state;
@@ -439,7 +435,7 @@ export class StripLight {
439
435
  } else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
440
436
  await this.openAPIpushChanges();
441
437
  } else {
442
- this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
438
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:`
443
439
  + ` ${this.device.connectionType}, pushChanges will not happen.`);
444
440
  }
445
441
  interval(5000)
@@ -1080,12 +1076,28 @@ export class StripLight {
1080
1076
  }
1081
1077
  }
1082
1078
 
1079
+ debugWarnLog(...log: any[]): void {
1080
+ if (this.enablingDeviceLogging()) {
1081
+ if (this.deviceLogging?.includes('debug')) {
1082
+ this.platform.log.warn('[DEBUG]', String(...log));
1083
+ }
1084
+ }
1085
+ }
1086
+
1083
1087
  errorLog(...log: any[]): void {
1084
1088
  if (this.enablingDeviceLogging()) {
1085
1089
  this.platform.log.error(String(...log));
1086
1090
  }
1087
1091
  }
1088
1092
 
1093
+ debugErrorLog(...log: any[]): void {
1094
+ if (this.enablingDeviceLogging()) {
1095
+ if (this.deviceLogging?.includes('debug')) {
1096
+ this.platform.log.error('[DEBUG]', String(...log));
1097
+ }
1098
+ }
1099
+ }
1100
+
1089
1101
  debugLog(...log: any[]): void {
1090
1102
  if (this.enablingDeviceLogging()) {
1091
1103
  if (this.deviceLogging === 'debug') {