@switchbot/homebridge-switchbot 3.5.1-beta.10 → 3.5.1-beta.11

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 (54) hide show
  1. package/dist/device/ceilinglight.d.ts.map +1 -1
  2. package/dist/device/ceilinglight.js +3 -4
  3. package/dist/device/ceilinglight.js.map +1 -1
  4. package/dist/device/colorbulb.js +1 -1
  5. package/dist/device/colorbulb.js.map +1 -1
  6. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  7. package/dist/irdevice/airconditioner.js +45 -51
  8. package/dist/irdevice/airconditioner.js.map +1 -1
  9. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  10. package/dist/irdevice/airpurifier.js +17 -17
  11. package/dist/irdevice/airpurifier.js.map +1 -1
  12. package/dist/irdevice/camera.d.ts.map +1 -1
  13. package/dist/irdevice/camera.js +9 -9
  14. package/dist/irdevice/camera.js.map +1 -1
  15. package/dist/irdevice/fan.d.ts.map +1 -1
  16. package/dist/irdevice/fan.js +19 -19
  17. package/dist/irdevice/fan.js.map +1 -1
  18. package/dist/irdevice/irdevice.d.ts +22 -10
  19. package/dist/irdevice/irdevice.d.ts.map +1 -1
  20. package/dist/irdevice/irdevice.js +89 -67
  21. package/dist/irdevice/irdevice.js.map +1 -1
  22. package/dist/irdevice/light.d.ts.map +1 -1
  23. package/dist/irdevice/light.js +15 -17
  24. package/dist/irdevice/light.js.map +1 -1
  25. package/dist/irdevice/other.d.ts.map +1 -1
  26. package/dist/irdevice/other.js +76 -76
  27. package/dist/irdevice/other.js.map +1 -1
  28. package/dist/irdevice/tv.d.ts.map +1 -1
  29. package/dist/irdevice/tv.js +35 -35
  30. package/dist/irdevice/tv.js.map +1 -1
  31. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  32. package/dist/irdevice/vacuumcleaner.js +9 -9
  33. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  34. package/dist/irdevice/waterheater.d.ts.map +1 -1
  35. package/dist/irdevice/waterheater.js +9 -9
  36. package/dist/irdevice/waterheater.js.map +1 -1
  37. package/dist/platform.d.ts +1 -1
  38. package/dist/platform.d.ts.map +1 -1
  39. package/dist/platform.js +202 -201
  40. package/dist/platform.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/device/ceilinglight.ts +3 -6
  43. package/src/device/colorbulb.ts +1 -1
  44. package/src/irdevice/airconditioner.ts +45 -51
  45. package/src/irdevice/airpurifier.ts +17 -17
  46. package/src/irdevice/camera.ts +9 -9
  47. package/src/irdevice/fan.ts +19 -19
  48. package/src/irdevice/irdevice.ts +92 -68
  49. package/src/irdevice/light.ts +15 -17
  50. package/src/irdevice/other.ts +76 -76
  51. package/src/irdevice/tv.ts +35 -35
  52. package/src/irdevice/vacuumcleaner.ts +9 -9
  53. package/src/irdevice/waterheater.ts +9 -9
  54. package/src/platform.ts +202 -201
@@ -38,7 +38,7 @@ export class Others extends irdeviceBase {
38
38
  On: accessory.context.On ?? false,
39
39
  };
40
40
  accessory.context.Switch = this.Switch;
41
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Switch`);
41
+ this.debugWarnLog('Displaying as Switch');
42
42
  this.Switch.Service
43
43
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
44
44
  .getCharacteristic(this.hap.Characteristic.On)
@@ -66,7 +66,7 @@ export class Others extends irdeviceBase {
66
66
  On: accessory.context.On ?? false,
67
67
  };
68
68
  accessory.context.GarageDoor = this.GarageDoor;
69
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Garage Door Opener`);
69
+ this.debugWarnLog('Displaying as Garage Door Opener');
70
70
  this.GarageDoor.Service
71
71
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
72
72
  .setCharacteristic(this.hap.Characteristic.ObstructionDetected, false)
@@ -95,7 +95,7 @@ export class Others extends irdeviceBase {
95
95
  On: accessory.context.On ?? false,
96
96
  };
97
97
  accessory.context.Door = this.Door;
98
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Door`);
98
+ this.debugWarnLog('Displaying as Door');
99
99
  this.Door.Service
100
100
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
101
101
  .setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
@@ -130,7 +130,7 @@ export class Others extends irdeviceBase {
130
130
  On: accessory.context.On ?? false,
131
131
  };
132
132
  accessory.context.Window = this.Window;
133
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window`);
133
+ this.debugWarnLog('Displaying as Window');
134
134
  this.Window.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
135
135
  .setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
136
136
  .getCharacteristic(this.hap.Characteristic.TargetPosition)
@@ -164,7 +164,7 @@ export class Others extends irdeviceBase {
164
164
  On: accessory.context.On ?? false,
165
165
  };
166
166
  accessory.context.WindowCovering = this.WindowCovering;
167
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window Covering`);
167
+ this.debugWarnLog('Displaying as Window Covering');
168
168
  this.WindowCovering.Service
169
169
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
170
170
  .setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
@@ -199,7 +199,7 @@ export class Others extends irdeviceBase {
199
199
  On: accessory.context.On ?? false,
200
200
  };
201
201
  accessory.context.LockMechanism = this.LockMechanism;
202
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Lock`);
202
+ this.debugWarnLog('Displaying as Lock');
203
203
  this.LockMechanism.Service
204
204
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
205
205
  .getCharacteristic(this.hap.Characteristic.LockTargetState)
@@ -227,7 +227,7 @@ export class Others extends irdeviceBase {
227
227
  On: accessory.context.On ?? false,
228
228
  };
229
229
  accessory.context.Faucet = this.Faucet;
230
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Faucet`);
230
+ this.debugWarnLog('Displaying as Faucet');
231
231
  this.Faucet.Service
232
232
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
233
233
  .getCharacteristic(this.hap.Characteristic.Active)
@@ -255,7 +255,7 @@ export class Others extends irdeviceBase {
255
255
  On: accessory.context.On ?? false,
256
256
  };
257
257
  accessory.context.Fan = this.Fan;
258
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Fan`);
258
+ this.debugWarnLog('Displaying as Fan');
259
259
  this.Fan.Service
260
260
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
261
261
  .getCharacteristic(this.hap.Characteristic.On)
@@ -284,7 +284,7 @@ export class Others extends irdeviceBase {
284
284
  On: accessory.context.On ?? false,
285
285
  };
286
286
  accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch;
287
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Stateful Programmable Switch`);
287
+ this.debugWarnLog('Displaying as Stateful Programmable Switch');
288
288
  this.StatefulProgrammableSwitch.Service
289
289
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
290
290
  .getCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState)
@@ -312,7 +312,7 @@ export class Others extends irdeviceBase {
312
312
  On: accessory.context.On ?? false,
313
313
  };
314
314
  accessory.context.Outlet = this.Outlet;
315
- this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Outlet`);
315
+ this.debugWarnLog('Displaying as Outlet');
316
316
  this.Outlet.Service
317
317
  .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
318
318
  .getCharacteristic(this.hap.Characteristic.On)
@@ -338,7 +338,7 @@ export class Others extends irdeviceBase {
338
338
  async OnSet(value) {
339
339
  let On;
340
340
  if (this.otherDeviceType === 'garagedoor') {
341
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetDoorState: ${value}`);
341
+ this.infoLog(`Set TargetDoorState: ${value}`);
342
342
  if (value === this.hap.Characteristic.TargetDoorState.CLOSED) {
343
343
  this.GarageDoor.On = false;
344
344
  }
@@ -348,7 +348,7 @@ export class Others extends irdeviceBase {
348
348
  On = this.GarageDoor.On;
349
349
  }
350
350
  else if (this.otherDeviceType === 'door') {
351
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
351
+ this.infoLog(`Set TargetPosition: ${value}`);
352
352
  if (value === 0) {
353
353
  this.Door.On = false;
354
354
  }
@@ -358,7 +358,7 @@ export class Others extends irdeviceBase {
358
358
  On = this.Door.On;
359
359
  }
360
360
  else if (this.otherDeviceType === 'window') {
361
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
361
+ this.infoLog(`Set TargetPosition: ${value}`);
362
362
  if (value === 0) {
363
363
  this.Window.On = false;
364
364
  }
@@ -368,7 +368,7 @@ export class Others extends irdeviceBase {
368
368
  On = this.Window.On;
369
369
  }
370
370
  else if (this.otherDeviceType === 'windowcovering') {
371
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetPosition: ${value}`);
371
+ this.infoLog(`Set TargetPosition: ${value}`);
372
372
  if (value === 0) {
373
373
  this.WindowCovering.On = false;
374
374
  }
@@ -378,7 +378,7 @@ export class Others extends irdeviceBase {
378
378
  On = this.WindowCovering.On;
379
379
  }
380
380
  else if (this.otherDeviceType === 'lock') {
381
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set LockTargetState: ${value}`);
381
+ this.infoLog(`Set LockTargetState: ${value}`);
382
382
  if (value === this.hap.Characteristic.LockTargetState.SECURED) {
383
383
  this.LockMechanism.On = false;
384
384
  }
@@ -388,7 +388,7 @@ export class Others extends irdeviceBase {
388
388
  On = this.LockMechanism.On;
389
389
  }
390
390
  else if (this.otherDeviceType === 'faucet') {
391
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set Active: ${value}`);
391
+ this.infoLog(`Set Active: ${value}`);
392
392
  if (value === this.hap.Characteristic.Active.INACTIVE) {
393
393
  this.Faucet.On = false;
394
394
  }
@@ -398,7 +398,7 @@ export class Others extends irdeviceBase {
398
398
  On = this.Faucet.On;
399
399
  }
400
400
  else if (this.otherDeviceType === 'stateful') {
401
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set ProgrammableSwitchOutputState: ${value}`);
401
+ this.infoLog(`Set ProgrammableSwitchOutputState: ${value}`);
402
402
  if (value === 0) {
403
403
  this.StatefulProgrammableSwitch.On = false;
404
404
  }
@@ -408,7 +408,7 @@ export class Others extends irdeviceBase {
408
408
  On = this.StatefulProgrammableSwitch.On;
409
409
  }
410
410
  else {
411
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set On: ${value}`);
411
+ this.infoLog(`Set On: ${value}`);
412
412
  this.Outlet.On = value;
413
413
  On = this.Outlet.On ? true : false;
414
414
  }
@@ -431,7 +431,7 @@ export class Others extends irdeviceBase {
431
431
  * Other - "command" "channelSub" "default" = previous channel
432
432
  */
433
433
  async pushOnChanges(On) {
434
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOnChanges On: ${On},`
434
+ await this.debugLog(`pushOnChanges On: ${On},`
435
435
  + ` disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`);
436
436
  if (this.device.customize) {
437
437
  if (On === true && !this.disablePushOn) {
@@ -446,11 +446,11 @@ export class Others extends irdeviceBase {
446
446
  }
447
447
  }
448
448
  else {
449
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} On Command not set`);
449
+ this.errorLog('On Command not set');
450
450
  }
451
451
  }
452
452
  async pushOffChanges(On) {
453
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOffChanges On: ${On},`
453
+ await this.debugLog(`pushOffChanges On: ${On},`
454
454
  + ` disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`);
455
455
  if (this.device.customize) {
456
456
  if (On === false && !this.disablePushOff) {
@@ -465,13 +465,13 @@ export class Others extends irdeviceBase {
465
465
  }
466
466
  }
467
467
  else {
468
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Off Command not set.`);
468
+ this.errorLog('Off Command not set.');
469
469
  }
470
470
  }
471
471
  async pushChanges(bodyChange) {
472
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
472
+ await this.debugLog('pushChanges');
473
473
  if (this.device.connectionType === 'OpenAPI') {
474
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
474
+ this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
475
475
  try {
476
476
  const { body, statusCode } = await this.pushChangeRequest(bodyChange);
477
477
  const deviceStatus = await body.json();
@@ -491,185 +491,185 @@ export class Others extends irdeviceBase {
491
491
  }
492
492
  }
493
493
  else {
494
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
495
- + ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
494
+ await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
496
495
  }
497
496
  }
498
497
  async updateHomeKitCharacteristics() {
498
+ await this.debugLog('updateHomeKitCharacteristics');
499
499
  if (this.otherDeviceType === 'garagedoor') {
500
500
  if (this.GarageDoor.On === undefined) {
501
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.GarageDoor.On}`);
501
+ await this.debugLog(`On: ${this.GarageDoor.On}`);
502
502
  }
503
503
  else {
504
504
  if (this.GarageDoor.On) {
505
505
  this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN);
506
506
  this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN);
507
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
507
+ await this.debugLog('updateCharacteristic'
508
508
  + ` TargetDoorState: Open, CurrentDoorState: Open (${this.GarageDoor.On})`);
509
509
  }
510
510
  else {
511
511
  this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED);
512
512
  this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED);
513
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
513
+ await this.debugLog('updateCharacteristic'
514
514
  + ` TargetDoorState: Closed, CurrentDoorState: Closed (${this.GarageDoor.On})`);
515
515
  }
516
516
  }
517
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Garage Door On: ${this.GarageDoor.On}`);
517
+ await this.debugLog(`Garage Door On: ${this.GarageDoor.On}`);
518
518
  }
519
519
  else if (this.otherDeviceType === 'door') {
520
520
  if (this.Door.On === undefined) {
521
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Door.On}`);
521
+ await this.debugLog(`On: ${this.Door.On}`);
522
522
  }
523
523
  else {
524
524
  if (this.Door.On) {
525
525
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
526
526
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
527
527
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
528
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
528
+ await this.debugLog('updateCharacteristic'
529
529
  + ` TargetPosition: 100, CurrentPosition: 100 (${this.Door.On})`);
530
530
  }
531
531
  else {
532
532
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
533
533
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
534
534
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
535
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
535
+ await this.debugLog('updateCharacteristic'
536
536
  + ` TargetPosition: 0, CurrentPosition: 0 (${this.Door.On})`);
537
537
  }
538
538
  }
539
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Door On: ${this.Door.On}`);
539
+ await this.debugLog(`Door On: ${this.Door.On}`);
540
540
  }
541
541
  else if (this.otherDeviceType === 'window') {
542
542
  if (this.Window.On === undefined) {
543
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Window.On}`);
543
+ await this.debugLog(`On: ${this.Window.On}`);
544
544
  }
545
545
  else {
546
546
  if (this.Window.On) {
547
547
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
548
548
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
549
549
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
550
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
550
+ await this.debugLog('updateCharacteristic'
551
551
  + ` TargetPosition: 100, CurrentPosition: 100 (${this.Window.On})`);
552
552
  }
553
553
  else {
554
554
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
555
555
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
556
556
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
557
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
557
+ await this.debugLog('updateCharacteristic'
558
558
  + ` TargetPosition: 0, CurrentPosition: 0 (${this.Window.On})`);
559
559
  }
560
560
  }
561
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Window On: ${this.Window.On}`);
561
+ await this.debugLog(`Window On: ${this.Window.On}`);
562
562
  }
563
563
  else if (this.otherDeviceType === 'windowcovering') {
564
564
  if (this.WindowCovering.On === undefined) {
565
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.WindowCovering.On}`);
565
+ await this.debugLog(`On: ${this.WindowCovering.On}`);
566
566
  }
567
567
  else {
568
568
  if (this.WindowCovering.On) {
569
569
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
570
570
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
571
571
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
572
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
572
+ await this.debugLog('updateCharacteristic'
573
573
  + ` TargetPosition: 100, CurrentPosition: 100 (${this.WindowCovering.On})`);
574
574
  }
575
575
  else {
576
576
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
577
577
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
578
578
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
579
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
579
+ await this.debugLog('updateCharacteristic'
580
580
  + ` TargetPosition: 0, CurrentPosition: 0 (${this.WindowCovering.On})`);
581
581
  }
582
582
  }
583
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Window Covering On: ${this.WindowCovering.On}`);
583
+ await this.debugLog(`Window Covering On: ${this.WindowCovering.On}`);
584
584
  }
585
585
  else if (this.otherDeviceType === 'lock') {
586
586
  if (this.LockMechanism?.On === undefined) {
587
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.LockMechanism?.On}`);
587
+ await this.debugLog(`On: ${this.LockMechanism?.On}`);
588
588
  }
589
589
  else {
590
590
  if (this.LockMechanism.On) {
591
591
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.UNSECURED);
592
592
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.UNSECURED);
593
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
593
+ await this.debugLog('updateCharacteristic'
594
594
  + ` LockTargetState: UNSECURED, LockCurrentState: UNSECURE (${this.LockMechanism.On})`);
595
595
  }
596
596
  else {
597
597
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.SECURED);
598
598
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.SECURED);
599
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
599
+ await this.debugLog('updateCharacteristic'
600
600
  + ` LockTargetState: SECURED, LockCurrentState: SECURED (${this.LockMechanism.On})`);
601
601
  }
602
602
  }
603
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Lock On: ${this.LockMechanism?.On}`);
603
+ await this.debugLog(`Lock On: ${this.LockMechanism?.On}`);
604
604
  }
605
605
  else if (this.otherDeviceType === 'faucet') {
606
606
  if (this.Faucet.On === undefined) {
607
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Faucet.On}`);
607
+ await this.debugLog(`On: ${this.Faucet.On}`);
608
608
  }
609
609
  else {
610
610
  if (this.Faucet.On) {
611
611
  this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE);
612
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Faucet.On}`);
612
+ await this.debugLog(`updateCharacteristic Active: ${this.Faucet.On}`);
613
613
  }
614
614
  else {
615
615
  this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
616
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Faucet.On}`);
616
+ await this.debugLog(`updateCharacteristic Active: ${this.Faucet.On}`);
617
617
  }
618
618
  }
619
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Faucet On: ${this.Faucet.On}`);
619
+ await this.debugLog(`Faucet On: ${this.Faucet.On}`);
620
620
  }
621
621
  else if (this.otherDeviceType === 'fan') {
622
622
  if (this.Fan.On === undefined) {
623
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Fan.On}`);
623
+ await this.debugLog(`On: ${this.Fan.On}`);
624
624
  }
625
625
  else {
626
626
  if (this.Fan.On) {
627
627
  this.Fan.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan.On);
628
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Fan.On}`);
628
+ await this.debugLog(`updateCharacteristic On: ${this.Fan.On}`);
629
629
  }
630
630
  else {
631
631
  this.Fan.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan.On);
632
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Fan.On}`);
632
+ await this.debugLog(`updateCharacteristic On: ${this.Fan.On}`);
633
633
  }
634
634
  }
635
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Fan On: ${this.Fan.On}`);
635
+ await this.debugLog(`Fan On: ${this.Fan.On}`);
636
636
  }
637
637
  else if (this.otherDeviceType === 'stateful') {
638
638
  if (this.StatefulProgrammableSwitch.On === undefined) {
639
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.StatefulProgrammableSwitch.On}`);
639
+ await this.debugLog(`On: ${this.StatefulProgrammableSwitch.On}`);
640
640
  }
641
641
  else {
642
642
  if (this.StatefulProgrammableSwitch.On) {
643
643
  this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
644
644
  this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1);
645
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
645
+ await this.debugLog('updateCharacteristic'
646
646
  + ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1 (${this.StatefulProgrammableSwitch.On})`);
647
647
  }
648
648
  else {
649
649
  this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
650
650
  this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0);
651
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
651
+ await this.debugLog('updateCharacteristic'
652
652
  + ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0 (${this.StatefulProgrammableSwitch.On})`);
653
653
  }
654
654
  }
655
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} StatefulProgrammableSwitch On: ${this.StatefulProgrammableSwitch.On}`);
655
+ await this.debugLog(`StatefulProgrammableSwitch On: ${this.StatefulProgrammableSwitch.On}`);
656
656
  }
657
657
  else if (this.otherDeviceType === 'switch') {
658
658
  if (this.Switch.On === undefined) {
659
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Switch.On}`);
659
+ await this.debugLog(`On: ${this.Switch.On}`);
660
660
  }
661
661
  else {
662
662
  this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch.On);
663
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Switch.On}`);
663
+ await this.debugLog(`updateCharacteristic On: ${this.Switch.On}`);
664
664
  }
665
665
  }
666
666
  else {
667
667
  if (this.Outlet.On === undefined) {
668
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Outlet.On}`);
668
+ await this.debugLog(`On: ${this.Outlet.On}`);
669
669
  }
670
670
  else {
671
671
  this.Outlet.Service.updateCharacteristic(this.hap.Characteristic.On, this.Outlet.On);
672
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Outlet.On}`);
672
+ await this.debugLog(`updateCharacteristic On: ${this.Outlet.On}`);
673
673
  }
674
674
  }
675
675
  }
@@ -739,7 +739,7 @@ export class Others extends irdeviceBase {
739
739
  // If Outlet.Service still present, then remove first
740
740
  if (this.Outlet?.Service) {
741
741
  this.Outlet.Service = this.accessory.getService(this.hap.Service.Outlet);
742
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Outlet Service`);
742
+ this.warnLog('Removing Leftover Outlet Service');
743
743
  accessory.removeService(this.Outlet.Service);
744
744
  }
745
745
  }
@@ -747,7 +747,7 @@ export class Others extends irdeviceBase {
747
747
  // If GarageDoor.Service still present, then remove first
748
748
  if (this.GarageDoor?.Service) {
749
749
  this.GarageDoor.Service = this.accessory.getService(this.hap.Service.GarageDoorOpener);
750
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Garage Door Service`);
750
+ this.warnLog('Removing Leftover Garage Door Service');
751
751
  accessory.removeService(this.GarageDoor.Service);
752
752
  }
753
753
  }
@@ -755,7 +755,7 @@ export class Others extends irdeviceBase {
755
755
  // If Door.Service still present, then remove first
756
756
  if (this.Door?.Service) {
757
757
  this.Door.Service = this.accessory.getService(this.hap.Service.Door);
758
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Door Service`);
758
+ this.warnLog('Removing Leftover Door Service');
759
759
  accessory.removeService(this.Door.Service);
760
760
  }
761
761
  }
@@ -763,7 +763,7 @@ export class Others extends irdeviceBase {
763
763
  // If Lock.Service still present, then remove first
764
764
  if (this.LockMechanism?.Service) {
765
765
  this.LockMechanism.Service = this.accessory.getService(this.hap.Service.LockMechanism);
766
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Lock Service`);
766
+ this.warnLog('Removing Leftover Lock Service');
767
767
  accessory.removeService(this.LockMechanism.Service);
768
768
  }
769
769
  }
@@ -771,7 +771,7 @@ export class Others extends irdeviceBase {
771
771
  // If Faucet.Service still present, then remove first
772
772
  if (this.Faucet?.Service) {
773
773
  this.Faucet.Service = this.accessory.getService(this.hap.Service.Faucet);
774
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Faucet Service`);
774
+ this.warnLog('Removing Leftover Faucet Service');
775
775
  accessory.removeService(this.Faucet.Service);
776
776
  }
777
777
  }
@@ -779,7 +779,7 @@ export class Others extends irdeviceBase {
779
779
  // If Fan Service still present, then remove first
780
780
  if (this.Fan?.Service) {
781
781
  this.Fan.Service = this.accessory.getService(this.hap.Service.Fan);
782
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Fan Service`);
782
+ this.warnLog('Removing Leftover Fan Service');
783
783
  accessory.removeService(this.Fan.Service);
784
784
  }
785
785
  }
@@ -787,7 +787,7 @@ export class Others extends irdeviceBase {
787
787
  // If Window.Service still present, then remove first
788
788
  if (this.Window?.Service) {
789
789
  this.Window.Service = this.accessory.getService(this.hap.Service.Window);
790
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Window Service`);
790
+ this.warnLog('Removing Leftover Window Service');
791
791
  accessory.removeService(this.Window.Service);
792
792
  }
793
793
  }
@@ -795,7 +795,7 @@ export class Others extends irdeviceBase {
795
795
  // If WindowCovering.Service still present, then remove first
796
796
  if (this.WindowCovering?.Service) {
797
797
  this.WindowCovering.Service = this.accessory.getService(this.hap.Service.WindowCovering);
798
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Window Covering Service`);
798
+ this.warnLog('Removing Leftover Window Covering Service');
799
799
  accessory.removeService(this.WindowCovering.Service);
800
800
  }
801
801
  }
@@ -803,7 +803,7 @@ export class Others extends irdeviceBase {
803
803
  // If StatefulProgrammableSwitch.Service still present, then remove first
804
804
  if (this.StatefulProgrammableSwitch?.Service) {
805
805
  this.StatefulProgrammableSwitch.Service = this.accessory.getService(this.hap.Service.StatefulProgrammableSwitch);
806
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Stateful Programmable Switch Service`);
806
+ this.warnLog('Removing Leftover Stateful Programmable Switch Service');
807
807
  accessory.removeService(this.StatefulProgrammableSwitch.Service);
808
808
  }
809
809
  }
@@ -811,24 +811,24 @@ export class Others extends irdeviceBase {
811
811
  // If Switch.Service still present, then remove first
812
812
  if (this.Switch?.Service) {
813
813
  this.Switch.Service = this.accessory.getService(this.hap.Service.Switch);
814
- this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Switch Service`);
814
+ this.warnLog('Removing Leftover Switch Service');
815
815
  accessory.removeService(this.Switch.Service);
816
816
  }
817
817
  }
818
818
  async getOtherConfigSettings(device) {
819
819
  if (!device.other?.deviceType && this.accessory.context.deviceType) {
820
820
  this.otherDeviceType = this.accessory.context.deviceType;
821
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
821
+ await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
822
822
  }
823
823
  else if (device.other?.deviceType) {
824
824
  this.accessory.context.deviceType = device.other.deviceType;
825
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Accessory Cache: ${this.accessory.context.deviceType}`);
825
+ await this.debugWarnLog(`Accessory Cache: ${this.accessory.context.deviceType}`);
826
826
  this.otherDeviceType = this.accessory.context.deviceType;
827
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
827
+ await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}`);
828
828
  }
829
829
  else {
830
830
  this.otherDeviceType = 'outlet';
831
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} no deviceType set, using default deviceType: ${this.otherDeviceType}`);
831
+ this.warnLog(`no deviceType set, using default deviceType: ${this.otherDeviceType}`);
832
832
  }
833
833
  }
834
834
  }