@switchbot/homebridge-switchbot 2.0.0-beta.3 → 2.0.0-beta.30

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 (113) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +1 -2
  3. package/config.schema.json +102 -20
  4. package/dist/device/bot.d.ts +34 -28
  5. package/dist/device/bot.d.ts.map +1 -1
  6. package/dist/device/bot.js +655 -649
  7. package/dist/device/bot.js.map +1 -1
  8. package/dist/device/colorbulb.d.ts +36 -19
  9. package/dist/device/colorbulb.d.ts.map +1 -1
  10. package/dist/device/colorbulb.js +483 -309
  11. package/dist/device/colorbulb.js.map +1 -1
  12. package/dist/device/contact.d.ts +18 -8
  13. package/dist/device/contact.d.ts.map +1 -1
  14. package/dist/device/contact.js +303 -237
  15. package/dist/device/contact.js.map +1 -1
  16. package/dist/device/curtain.d.ts +23 -16
  17. package/dist/device/curtain.d.ts.map +1 -1
  18. package/dist/device/curtain.js +541 -498
  19. package/dist/device/curtain.js.map +1 -1
  20. package/dist/device/humidifier.d.ts +24 -18
  21. package/dist/device/humidifier.d.ts.map +1 -1
  22. package/dist/device/humidifier.js +450 -369
  23. package/dist/device/humidifier.js.map +1 -1
  24. package/dist/device/lock.d.ts +27 -8
  25. package/dist/device/lock.d.ts.map +1 -1
  26. package/dist/device/lock.js +302 -148
  27. package/dist/device/lock.js.map +1 -1
  28. package/dist/device/meter.d.ts +22 -16
  29. package/dist/device/meter.d.ts.map +1 -1
  30. package/dist/device/meter.js +340 -262
  31. package/dist/device/meter.js.map +1 -1
  32. package/dist/device/meterplus.d.ts +24 -12
  33. package/dist/device/meterplus.d.ts.map +1 -1
  34. package/dist/device/meterplus.js +359 -213
  35. package/dist/device/meterplus.js.map +1 -1
  36. package/dist/device/motion.d.ts +18 -8
  37. package/dist/device/motion.d.ts.map +1 -1
  38. package/dist/device/motion.js +276 -216
  39. package/dist/device/motion.js.map +1 -1
  40. package/dist/device/plug.d.ts +27 -17
  41. package/dist/device/plug.d.ts.map +1 -1
  42. package/dist/device/plug.js +292 -251
  43. package/dist/device/plug.js.map +1 -1
  44. package/dist/device/striplight.d.ts +43 -19
  45. package/dist/device/striplight.d.ts.map +1 -1
  46. package/dist/device/striplight.js +503 -262
  47. package/dist/device/striplight.js.map +1 -1
  48. package/dist/irdevice/airconditioner.d.ts +9 -12
  49. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  50. package/dist/irdevice/airconditioner.js +275 -230
  51. package/dist/irdevice/airconditioner.js.map +1 -1
  52. package/dist/irdevice/airpurifier.d.ts +5 -3
  53. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  54. package/dist/irdevice/airpurifier.js +151 -104
  55. package/dist/irdevice/airpurifier.js.map +1 -1
  56. package/dist/irdevice/camera.d.ts +11 -8
  57. package/dist/irdevice/camera.d.ts.map +1 -1
  58. package/dist/irdevice/camera.js +130 -86
  59. package/dist/irdevice/camera.js.map +1 -1
  60. package/dist/irdevice/fan.d.ts +10 -7
  61. package/dist/irdevice/fan.d.ts.map +1 -1
  62. package/dist/irdevice/fan.js +157 -109
  63. package/dist/irdevice/fan.js.map +1 -1
  64. package/dist/irdevice/light.d.ts +11 -8
  65. package/dist/irdevice/light.d.ts.map +1 -1
  66. package/dist/irdevice/light.js +134 -103
  67. package/dist/irdevice/light.js.map +1 -1
  68. package/dist/irdevice/other.d.ts +11 -8
  69. package/dist/irdevice/other.d.ts.map +1 -1
  70. package/dist/irdevice/other.js +142 -98
  71. package/dist/irdevice/other.js.map +1 -1
  72. package/dist/irdevice/tv.d.ts +12 -9
  73. package/dist/irdevice/tv.d.ts.map +1 -1
  74. package/dist/irdevice/tv.js +140 -93
  75. package/dist/irdevice/tv.js.map +1 -1
  76. package/dist/irdevice/vacuumcleaner.d.ts +9 -10
  77. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  78. package/dist/irdevice/vacuumcleaner.js +129 -89
  79. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  80. package/dist/irdevice/waterheater.d.ts +8 -9
  81. package/dist/irdevice/waterheater.d.ts.map +1 -1
  82. package/dist/irdevice/waterheater.js +129 -89
  83. package/dist/irdevice/waterheater.js.map +1 -1
  84. package/dist/platform.d.ts +14 -12
  85. package/dist/platform.d.ts.map +1 -1
  86. package/dist/platform.js +479 -434
  87. package/dist/platform.js.map +1 -1
  88. package/dist/settings.d.ts +18 -11
  89. package/dist/settings.d.ts.map +1 -1
  90. package/dist/settings.js.map +1 -1
  91. package/package.json +12 -10
  92. package/src/device/bot.ts +654 -660
  93. package/src/device/colorbulb.ts +487 -344
  94. package/src/device/contact.ts +306 -241
  95. package/src/device/curtain.ts +546 -512
  96. package/src/device/humidifier.ts +453 -403
  97. package/src/device/lock.ts +311 -149
  98. package/src/device/meter.ts +351 -275
  99. package/src/device/meterplus.ts +369 -219
  100. package/src/device/motion.ts +282 -222
  101. package/src/device/plug.ts +296 -260
  102. package/src/device/striplight.ts +519 -289
  103. package/src/irdevice/airconditioner.ts +279 -241
  104. package/src/irdevice/airpurifier.ts +148 -103
  105. package/src/irdevice/camera.ts +128 -85
  106. package/src/irdevice/fan.ts +154 -106
  107. package/src/irdevice/light.ts +132 -103
  108. package/src/irdevice/other.ts +140 -97
  109. package/src/irdevice/tv.ts +139 -93
  110. package/src/irdevice/vacuumcleaner.ts +128 -89
  111. package/src/irdevice/waterheater.ts +127 -89
  112. package/src/platform.ts +469 -456
  113. package/src/settings.ts +18 -11
@@ -1,6 +1,7 @@
1
1
  import https from 'https';
2
2
  import crypto from 'crypto';
3
3
  import { IncomingMessage } from 'http';
4
+ import superStringify from 'super-stringify';
4
5
  import { SwitchBotPlatform } from '../platform';
5
6
  import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
6
7
  import { irdevice, irDevicesConfig, HostDomain, DevicePath } from '../settings';
@@ -17,7 +18,6 @@ export class TV {
17
18
 
18
19
  // Characteristic Values
19
20
  Active!: CharacteristicValue;
20
- ActiveCached!: CharacteristicValue;
21
21
  ActiveIdentifier!: CharacteristicValue;
22
22
 
23
23
  // Others
@@ -30,11 +30,7 @@ export class TV {
30
30
  // default placeholders
31
31
  this.logs(device);
32
32
  this.config(device);
33
- if (this.Active === undefined) {
34
- this.Active = this.platform.Characteristic.Active.INACTIVE;
35
- } else {
36
- this.Active = this.accessory.context.Active;
37
- }
33
+ this.context();
38
34
 
39
35
  // set accessory information
40
36
  accessory
@@ -42,7 +38,10 @@ export class TV {
42
38
  .setCharacteristic(this.platform.Characteristic.Name, `${device.deviceName} ${device.remoteType}`)
43
39
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
44
40
  .setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
45
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
41
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
42
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
43
+ .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
44
+ .updateValue(this.FirmwareRevision(accessory, device));
46
45
 
47
46
  // set the accessory category
48
47
  switch (device.remoteType) {
@@ -194,50 +193,35 @@ export class TV {
194
193
  async ActiveIdentifierSet(value: CharacteristicValue): Promise<void> {
195
194
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${value}`);
196
195
  this.ActiveIdentifier = value;
196
+ this.accessory.context.ActiveIdentifier = this.ActiveIdentifier;
197
197
  }
198
198
 
199
199
  async ActiveSet(value: CharacteristicValue): Promise<void> {
200
200
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${value}`);
201
+ this.Active = value;
202
+ this.accessory.context.Active = this.Active;
201
203
  if (!this.device.irtv?.disable_power) {
202
204
  if (value === this.platform.Characteristic.Active.INACTIVE) {
203
205
  await this.pushTvOffChanges();
204
206
  } else {
205
207
  await this.pushTvOnChanges();
206
208
  }
207
- this.Active = value;
208
- this.ActiveCached = this.Active;
209
- this.accessory.context.Active = this.ActiveCached;
210
- }
211
- }
212
-
213
- async updateHomeKitCharacteristics(): Promise<void> {
214
- if (this.Active === undefined) {
215
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
216
- } else {
217
- this.tvService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
218
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
219
- }
220
- if (this.ActiveIdentifier === undefined) {
221
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${this.ActiveIdentifier}`);
222
- } else {
223
- this.tvService?.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
224
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ActiveIdentifier: ${this.ActiveIdentifier}`);
225
209
  }
226
210
  }
227
211
 
228
212
  /**
229
213
  * Pushes the requested changes to the SwitchBot API
230
- * deviceType commandType Command command parameter Description
231
- * TV: "command" "turnOff" "default" = set to OFF state
232
- * TV: "command" "turnOn" "default" = set to ON state
233
- * TV: "command" "volumeAdd" "default" = volume up
234
- * TV: "command" "volumeSub" "default" = volume down
235
- * TV: "command" "channelAdd" "default" = next channel
236
- * TV: "command" "channelSub" "default" = previous channel
214
+ * deviceType commandType Command Parameter Description
215
+ * TV "command" "turnOff" "default" set to OFF state
216
+ * TV "command" "turnOn" "default" set to ON state
217
+ * TV "command" "volumeAdd" "default" volume up
218
+ * TV "command" "volumeSub" "default" volume down
219
+ * TV "command" "channelAdd" "default" next channel
220
+ * TV "command" "channelSub" "default" previous channel
237
221
  */
238
222
  async pushTvOnChanges(): Promise<void> {
239
223
  if (this.Active !== 1) {
240
- const body = JSON.stringify({
224
+ const body = superStringify({
241
225
  'command': 'turnOn',
242
226
  'parameter': 'default',
243
227
  'commandType': 'command',
@@ -247,7 +231,7 @@ export class TV {
247
231
  }
248
232
 
249
233
  async pushTvOffChanges(): Promise<void> {
250
- const body = JSON.stringify({
234
+ const body = superStringify({
251
235
  'command': 'turnOff',
252
236
  'parameter': 'default',
253
237
  'commandType': 'command',
@@ -256,7 +240,7 @@ export class TV {
256
240
  }
257
241
 
258
242
  async pushOkChanges(): Promise<void> {
259
- const body = JSON.stringify({
243
+ const body = superStringify({
260
244
  'command': 'Ok',
261
245
  'parameter': 'default',
262
246
  'commandType': 'command',
@@ -265,7 +249,7 @@ export class TV {
265
249
  }
266
250
 
267
251
  async pushBackChanges(): Promise<void> {
268
- const body = JSON.stringify({
252
+ const body = superStringify({
269
253
  'command': 'Back',
270
254
  'parameter': 'default',
271
255
  'commandType': 'command',
@@ -274,7 +258,7 @@ export class TV {
274
258
  }
275
259
 
276
260
  async pushMenuChanges(): Promise<void> {
277
- const body = JSON.stringify({
261
+ const body = superStringify({
278
262
  'command': 'Menu',
279
263
  'parameter': 'default',
280
264
  'commandType': 'command',
@@ -283,7 +267,7 @@ export class TV {
283
267
  }
284
268
 
285
269
  async pushUpChanges(): Promise<void> {
286
- const body = JSON.stringify({
270
+ const body = superStringify({
287
271
  'command': 'Up',
288
272
  'parameter': 'default',
289
273
  'commandType': 'command',
@@ -292,7 +276,7 @@ export class TV {
292
276
  }
293
277
 
294
278
  async pushDownChanges(): Promise<void> {
295
- const body = JSON.stringify({
279
+ const body = superStringify({
296
280
  'command': 'Down',
297
281
  'parameter': 'default',
298
282
  'commandType': 'command',
@@ -301,7 +285,7 @@ export class TV {
301
285
  }
302
286
 
303
287
  async pushRightChanges(): Promise<void> {
304
- const body = JSON.stringify({
288
+ const body = superStringify({
305
289
  'command': 'Right',
306
290
  'parameter': 'default',
307
291
  'commandType': 'command',
@@ -310,7 +294,7 @@ export class TV {
310
294
  }
311
295
 
312
296
  async pushLeftChanges(): Promise<void> {
313
- const body = JSON.stringify({
297
+ const body = superStringify({
314
298
  'command': 'Left',
315
299
  'parameter': 'default',
316
300
  'commandType': 'command',
@@ -319,7 +303,7 @@ export class TV {
319
303
  }
320
304
 
321
305
  async pushVolumeUpChanges(): Promise<void> {
322
- const body = JSON.stringify({
306
+ const body = superStringify({
323
307
  'command': 'volumeAdd',
324
308
  'parameter': 'default',
325
309
  'commandType': 'command',
@@ -328,7 +312,7 @@ export class TV {
328
312
  }
329
313
 
330
314
  async pushVolumeDownChanges(): Promise<void> {
331
- const body = JSON.stringify({
315
+ const body = superStringify({
332
316
  'command': 'volumeSub',
333
317
  'parameter': 'default',
334
318
  'commandType': 'command',
@@ -337,54 +321,74 @@ export class TV {
337
321
  }
338
322
 
339
323
  async pushTVChanges(body): Promise<void> {
340
- try {
341
- // Make Push On request to the API
342
- const t = Date.now();
343
- const nonce = 'requestID';
344
- const data = this.platform.config.credentials?.token + t + nonce;
345
- const signTerm = crypto.createHmac('sha256', this.platform.config.credentials?.secret)
346
- .update(Buffer.from(data, 'utf-8'))
347
- .digest();
348
- const sign = signTerm.toString('base64');
349
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} sign: ${sign}`);
350
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
351
- const options = {
352
- hostname: HostDomain,
353
- port: 443,
354
- path: `${DevicePath}/${this.device.deviceId}/commands`,
355
- method: 'POST',
356
- headers: {
357
- 'Authorization': this.platform.config.credentials?.token,
358
- 'sign': sign,
359
- 'nonce': nonce,
360
- 't': t,
361
- 'Content-Type': 'application/json',
362
- 'Content-Length': body.length,
363
- },
364
- };
365
- const req = https.request(options, res => {
366
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
367
- this.statusCode({ res });
368
- res.on('data', d => {
369
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} d: ${d}`);
370
- });
371
- });
372
- req.on('error', (e: any) => {
373
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} error message: ${e.message}`);
374
- });
375
- req.write(body);
376
- req.end();
377
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${JSON.stringify(req)}`);
378
- this.updateHomeKitCharacteristics();
379
- } catch (e: any) {
380
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
381
- if (this.deviceLogging.includes('debug')) {
382
- this.errorLog(
383
- `${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
384
- ` Error Message: ${JSON.stringify(e.message)}`,
385
- );
324
+ if (this.device.connectionType === 'OpenAPI') {
325
+ {
326
+ try {
327
+ // Make Push On request to the API
328
+ const t = Date.now();
329
+ const nonce = 'requestID';
330
+ const data = this.platform.config.credentials?.token + t + nonce;
331
+ const signTerm = crypto.createHmac('sha256', this.platform.config.credentials?.secret)
332
+ .update(Buffer.from(data, 'utf-8'))
333
+ .digest();
334
+ const sign = signTerm.toString('base64');
335
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} sign: ${sign}`);
336
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
337
+ const options = {
338
+ hostname: HostDomain,
339
+ port: 443,
340
+ path: `${DevicePath}/${this.device.deviceId}/commands`,
341
+ method: 'POST',
342
+ headers: {
343
+ 'Authorization': this.platform.config.credentials?.token,
344
+ 'sign': sign,
345
+ 'nonce': nonce,
346
+ 't': t,
347
+ 'Content-Type': 'application/json',
348
+ 'Content-Length': body.length,
349
+ },
350
+ };
351
+ const req = https.request(options, res => {
352
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges statusCode: ${res.statusCode}`);
353
+ this.statusCode({ res });
354
+ res.on('data', d => {
355
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} d: ${d}`);
356
+ });
357
+ });
358
+ req.on('error', (e: any) => {
359
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} error message: ${e.message}`);
360
+ });
361
+ req.write(body);
362
+ req.end();
363
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${superStringify(req)}`);
364
+ this.updateHomeKitCharacteristics();
365
+ } catch (e: any) {
366
+ this.apiError(e);
367
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,`
368
+ + ` Error Message: ${superStringify(e.message)}`,
369
+ );
370
+ }
386
371
  }
387
- this.apiError(e);
372
+ } else {
373
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
374
+ + ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
375
+ }
376
+ }
377
+
378
+ async updateHomeKitCharacteristics(): Promise<void> {
379
+ if (this.Active === undefined) {
380
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
381
+ } else {
382
+ this.accessory.context.Active = this.Active;
383
+ this.tvService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
384
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
385
+ }
386
+ if (this.ActiveIdentifier === undefined) {
387
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${this.ActiveIdentifier}`);
388
+ } else {
389
+ this.accessory.context.ActiveIdentifier = this.ActiveIdentifier;
390
+ this.tvService?.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
391
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ActiveIdentifier: ${this.ActiveIdentifier}`);
388
392
  }
389
393
  }
390
394
 
@@ -409,7 +413,7 @@ export class TV {
409
413
  this.errorLog(
410
414
  `${this.device.remoteType}: ` +
411
415
  `${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
412
- ` Or command: ${JSON.stringify(res)} format is invalid`,
416
+ ` Or command: ${superStringify(res)} format is invalid`,
413
417
  );
414
418
  break;
415
419
  case 100:
@@ -423,7 +427,30 @@ export class TV {
423
427
  async apiError(e: any): Promise<void> {
424
428
  this.tvService.updateCharacteristic(this.platform.Characteristic.Active, e);
425
429
  this.tvService.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, e);
426
- //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
430
+ }
431
+
432
+ FirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
433
+ let FirmwareRevision: string;
434
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
435
+ + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
436
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
437
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
438
+ if (accessory.context.FirmwareRevision) {
439
+ FirmwareRevision = accessory.context.FirmwareRevision;
440
+ } else if (device.firmware) {
441
+ FirmwareRevision = device.firmware;
442
+ } else {
443
+ FirmwareRevision = this.platform.version;
444
+ }
445
+ return FirmwareRevision;
446
+ }
447
+
448
+ async context() {
449
+ if (this.Active === undefined) {
450
+ this.Active = this.platform.Characteristic.Active.INACTIVE;
451
+ } else {
452
+ this.Active = this.accessory.context.Active;
453
+ }
427
454
  }
428
455
 
429
456
  async config(device: irdevice & irDevicesConfig): Promise<void> {
@@ -434,8 +461,11 @@ export class TV {
434
461
  if (device.logging !== undefined) {
435
462
  config['logging'] = device.logging;
436
463
  }
464
+ if (device.connectionType !== undefined) {
465
+ config['connectionType'] = device.connectionType;
466
+ }
437
467
  if (Object.entries(config).length !== 0) {
438
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
468
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
439
469
  }
440
470
  }
441
471
 
@@ -470,12 +500,28 @@ export class TV {
470
500
  }
471
501
  }
472
502
 
503
+ debugWarnLog(...log: any[]): void {
504
+ if (this.enablingDeviceLogging()) {
505
+ if (this.deviceLogging?.includes('debug')) {
506
+ this.platform.log.warn('[DEBUG]', String(...log));
507
+ }
508
+ }
509
+ }
510
+
473
511
  errorLog(...log: any[]): void {
474
512
  if (this.enablingDeviceLogging()) {
475
513
  this.platform.log.error(String(...log));
476
514
  }
477
515
  }
478
516
 
517
+ debugErrorLog(...log: any[]): void {
518
+ if (this.enablingDeviceLogging()) {
519
+ if (this.deviceLogging?.includes('debug')) {
520
+ this.platform.log.error('[DEBUG]', String(...log));
521
+ }
522
+ }
523
+ }
524
+
479
525
  debugLog(...log: any[]): void {
480
526
  if (this.enablingDeviceLogging()) {
481
527
  if (this.deviceLogging === 'debug') {