@switchbot/homebridge-switchbot 4.1.1-beta.2 → 4.1.1-beta.4

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 (100) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/device/blindtilt.js +103 -103
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.js +84 -84
  5. package/dist/device/bot.js.map +1 -1
  6. package/dist/device/ceilinglight.js +97 -97
  7. package/dist/device/ceilinglight.js.map +1 -1
  8. package/dist/device/colorbulb.js +139 -139
  9. package/dist/device/colorbulb.js.map +1 -1
  10. package/dist/device/contact.js +47 -47
  11. package/dist/device/contact.js.map +1 -1
  12. package/dist/device/curtain.d.ts +1 -1
  13. package/dist/device/curtain.d.ts.map +1 -1
  14. package/dist/device/curtain.js +91 -89
  15. package/dist/device/curtain.js.map +1 -1
  16. package/dist/device/device.d.ts +12 -12
  17. package/dist/device/device.d.ts.map +1 -1
  18. package/dist/device/device.js +42 -42
  19. package/dist/device/device.js.map +1 -1
  20. package/dist/device/fan.js +95 -95
  21. package/dist/device/fan.js.map +1 -1
  22. package/dist/device/hub.js +46 -46
  23. package/dist/device/hub.js.map +1 -1
  24. package/dist/device/humidifier.js +84 -84
  25. package/dist/device/humidifier.js.map +1 -1
  26. package/dist/device/iosensor.js +44 -44
  27. package/dist/device/iosensor.js.map +1 -1
  28. package/dist/device/lightstrip.js +118 -118
  29. package/dist/device/lightstrip.js.map +1 -1
  30. package/dist/device/lock.js +74 -74
  31. package/dist/device/lock.js.map +1 -1
  32. package/dist/device/meter.js +44 -44
  33. package/dist/device/meter.js.map +1 -1
  34. package/dist/device/meterplus.js +42 -42
  35. package/dist/device/meterplus.js.map +1 -1
  36. package/dist/device/meterpro.js +42 -42
  37. package/dist/device/meterpro.js.map +1 -1
  38. package/dist/device/motion.js +44 -44
  39. package/dist/device/motion.js.map +1 -1
  40. package/dist/device/plug.d.ts.map +1 -1
  41. package/dist/device/plug.js +59 -59
  42. package/dist/device/plug.js.map +1 -1
  43. package/dist/device/robotvacuumcleaner.js +73 -73
  44. package/dist/device/robotvacuumcleaner.js.map +1 -1
  45. package/dist/device/waterdetector.js +44 -44
  46. package/dist/device/waterdetector.js.map +1 -1
  47. package/dist/irdevice/airconditioner.js +31 -31
  48. package/dist/irdevice/airconditioner.js.map +1 -1
  49. package/dist/irdevice/airpurifier.js +10 -10
  50. package/dist/irdevice/airpurifier.js.map +1 -1
  51. package/dist/irdevice/camera.js +9 -9
  52. package/dist/irdevice/camera.js.map +1 -1
  53. package/dist/irdevice/fan.js +11 -11
  54. package/dist/irdevice/fan.js.map +1 -1
  55. package/dist/irdevice/irdevice.js +11 -11
  56. package/dist/irdevice/irdevice.js.map +1 -1
  57. package/dist/irdevice/light.js +9 -9
  58. package/dist/irdevice/light.js.map +1 -1
  59. package/dist/irdevice/other.js +55 -55
  60. package/dist/irdevice/other.js.map +1 -1
  61. package/dist/irdevice/tv.js +33 -33
  62. package/dist/irdevice/tv.js.map +1 -1
  63. package/dist/irdevice/vacuumcleaner.js +9 -9
  64. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  65. package/dist/irdevice/waterheater.js +9 -9
  66. package/dist/irdevice/waterheater.js.map +1 -1
  67. package/dist/platform.js +228 -228
  68. package/dist/platform.js.map +1 -1
  69. package/package.json +9 -9
  70. package/src/device/blindtilt.ts +103 -103
  71. package/src/device/bot.ts +84 -84
  72. package/src/device/ceilinglight.ts +97 -97
  73. package/src/device/colorbulb.ts +139 -139
  74. package/src/device/contact.ts +47 -47
  75. package/src/device/curtain.ts +91 -89
  76. package/src/device/device.ts +42 -42
  77. package/src/device/fan.ts +95 -95
  78. package/src/device/hub.ts +46 -46
  79. package/src/device/humidifier.ts +84 -84
  80. package/src/device/iosensor.ts +44 -44
  81. package/src/device/lightstrip.ts +118 -118
  82. package/src/device/lock.ts +74 -74
  83. package/src/device/meter.ts +44 -44
  84. package/src/device/meterplus.ts +42 -42
  85. package/src/device/meterpro.ts +42 -42
  86. package/src/device/motion.ts +44 -44
  87. package/src/device/plug.ts +61 -61
  88. package/src/device/robotvacuumcleaner.ts +73 -73
  89. package/src/device/waterdetector.ts +44 -44
  90. package/src/irdevice/airconditioner.ts +31 -31
  91. package/src/irdevice/airpurifier.ts +10 -10
  92. package/src/irdevice/camera.ts +9 -9
  93. package/src/irdevice/fan.ts +11 -11
  94. package/src/irdevice/irdevice.ts +11 -11
  95. package/src/irdevice/light.ts +9 -9
  96. package/src/irdevice/other.ts +55 -55
  97. package/src/irdevice/tv.ts +33 -33
  98. package/src/irdevice/vacuumcleaner.ts +9 -9
  99. package/src/irdevice/waterheater.ts +9 -9
  100. package/src/platform.ts +228 -228
@@ -344,47 +344,47 @@ export class Others extends irdeviceBase {
344
344
  async OnSet(value: CharacteristicValue): Promise<void> {
345
345
  if (this.otherDeviceType === 'Switch') {
346
346
  if (this.Switch) {
347
- await this.debugLog(`Set On: ${value}`)
347
+ this.debugLog(`Set On: ${value}`)
348
348
  this.On = value !== false
349
349
  }
350
350
  } else if (this.otherDeviceType === 'GarageDoor') {
351
351
  if (this.GarageDoor) {
352
- await this.debugLog(`Set TargetDoorState: ${value}`)
352
+ this.debugLog(`Set TargetDoorState: ${value}`)
353
353
  this.On = value !== this.hap.Characteristic.TargetDoorState.CLOSED
354
354
  }
355
355
  } else if (this.otherDeviceType === 'Door') {
356
356
  if (this.Door) {
357
- await this.debugLog(`Set TargetPosition: ${value}`)
357
+ this.debugLog(`Set TargetPosition: ${value}`)
358
358
  this.On = value !== 0
359
359
  }
360
360
  } else if (this.otherDeviceType === 'Window') {
361
361
  if (this.Window) {
362
- await this.debugLog(`Set TargetPosition: ${value}`)
362
+ this.debugLog(`Set TargetPosition: ${value}`)
363
363
  this.On = value !== 0
364
364
  }
365
365
  } else if (this.otherDeviceType === 'WindowCovering') {
366
366
  if (this.WindowCovering) {
367
- await this.debugLog(`Set TargetPosition: ${value}`)
367
+ this.debugLog(`Set TargetPosition: ${value}`)
368
368
  this.On = value !== 0
369
369
  }
370
370
  } else if (this.otherDeviceType === 'Lock') {
371
371
  if (this.LockMechanism) {
372
- await this.debugLog(`Set LockTargetState: ${value}`)
372
+ this.debugLog(`Set LockTargetState: ${value}`)
373
373
  this.On = value !== this.hap.Characteristic.LockTargetState.SECURED
374
374
  }
375
375
  } else if (this.otherDeviceType === 'Faucet') {
376
376
  if (this.Faucet) {
377
- await this.debugLog(`Set Active: ${value}`)
377
+ this.debugLog(`Set Active: ${value}`)
378
378
  this.On = value !== this.hap.Characteristic.Active.INACTIVE
379
379
  }
380
380
  } else if (this.otherDeviceType === 'Stateful') {
381
381
  if (this.StatefulProgrammableSwitch) {
382
- await this.debugLog(`Set ProgrammableSwitchOutputState: ${value}`)
382
+ this.debugLog(`Set ProgrammableSwitchOutputState: ${value}`)
383
383
  this.On = value !== 0
384
384
  }
385
385
  } else {
386
386
  if (this.Outlet) {
387
- await this.debugLog(`Set On: ${value}`)
387
+ this.debugLog(`Set On: ${value}`)
388
388
  this.On = value !== false
389
389
  }
390
390
  }
@@ -407,7 +407,7 @@ export class Others extends irdeviceBase {
407
407
  * Other - "command" "channelSub" "default" = previous channel
408
408
  */
409
409
  async pushOnChanges(On: boolean): Promise<void> {
410
- await this.debugLog(`pushOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`)
410
+ this.debugLog(`pushOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`)
411
411
  if (this.device.customize) {
412
412
  if (On === true && !this.disablePushOn) {
413
413
  const commandType: string = await this.commandType()
@@ -425,7 +425,7 @@ export class Others extends irdeviceBase {
425
425
  }
426
426
 
427
427
  async pushOffChanges(On: boolean): Promise<void> {
428
- await this.debugLog(`pushOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`)
428
+ this.debugLog(`pushOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`)
429
429
  if (this.device.customize) {
430
430
  if (On === false && !this.disablePushOff) {
431
431
  const commandType: string = await this.commandType()
@@ -443,12 +443,12 @@ export class Others extends irdeviceBase {
443
443
  }
444
444
 
445
445
  async pushChanges(bodyChange: any): Promise<void> {
446
- await this.debugLog('pushChanges')
446
+ this.debugLog('pushChanges')
447
447
  if (this.device.connectionType === 'OpenAPI') {
448
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
448
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
449
449
  try {
450
- const { body } = await this.pushChangeRequest(bodyChange)
451
- const deviceStatus: any = await body
450
+ const response = await this.pushChangeRequest(bodyChange)
451
+ const deviceStatus: any = response.body
452
452
  await this.pushStatusCodes(deviceStatus)
453
453
  if (await this.successfulStatusCodes(deviceStatus)) {
454
454
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -461,151 +461,151 @@ export class Others extends irdeviceBase {
461
461
  await this.pushChangeError(e)
462
462
  }
463
463
  } else {
464
- await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
464
+ this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
465
465
  }
466
466
  }
467
467
 
468
468
  async updateHomeKitCharacteristics(): Promise<void> {
469
- await this.debugLog('updateHomeKitCharacteristics')
469
+ this.debugLog('updateHomeKitCharacteristics')
470
470
  // State
471
471
  if (this.otherDeviceType === 'Switch' && this.Switch) {
472
472
  if (this.On === undefined) {
473
- await this.debugLog(`On: ${this.On}`)
473
+ this.debugLog(`On: ${this.On}`)
474
474
  } else {
475
475
  this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.On)
476
- await this.debugLog(`updateCharacteristic On: ${this.On}`)
476
+ this.debugLog(`updateCharacteristic On: ${this.On}`)
477
477
  }
478
478
  } else if (this.otherDeviceType === 'GarageDoor' && this.GarageDoor) {
479
479
  if (this.On === undefined) {
480
- await this.debugLog(`On: ${this.On}`)
480
+ this.debugLog(`On: ${this.On}`)
481
481
  } else {
482
482
  if (this.On) {
483
483
  this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN)
484
484
  this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN)
485
- await this.debugLog(`updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open (${this.On})`)
485
+ this.debugLog(`updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open (${this.On})`)
486
486
  } else {
487
487
  this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED)
488
488
  this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED)
489
- await this.debugLog(`updateCharacteristicc TargetDoorState: Closed, CurrentDoorState: Closed (${this.On})`)
489
+ this.debugLog(`updateCharacteristicc TargetDoorState: Closed, CurrentDoorState: Closed (${this.On})`)
490
490
  }
491
491
  }
492
- await this.debugLog(`Garage Door On: ${this.On}`)
492
+ this.debugLog(`Garage Door On: ${this.On}`)
493
493
  } else if (this.otherDeviceType === 'Door' && this.Door) {
494
494
  if (this.On === undefined) {
495
- await this.debugLog(`On: ${this.On}`)
495
+ this.debugLog(`On: ${this.On}`)
496
496
  } else {
497
497
  if (this.On) {
498
498
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100)
499
499
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100)
500
500
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
501
- await this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
501
+ this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
502
502
  } else {
503
503
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0)
504
504
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0)
505
505
  this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
506
- await this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
506
+ this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
507
507
  }
508
508
  }
509
- await this.debugLog(`Door On: ${this.On}`)
509
+ this.debugLog(`Door On: ${this.On}`)
510
510
  } else if (this.otherDeviceType === 'Window' && this.Window) {
511
511
  if (this.On === undefined) {
512
- await this.debugLog(`On: ${this.On}`)
512
+ this.debugLog(`On: ${this.On}`)
513
513
  } else {
514
514
  if (this.On) {
515
515
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100)
516
516
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100)
517
517
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
518
- await this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
518
+ this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
519
519
  } else {
520
520
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0)
521
521
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0)
522
522
  this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
523
- await this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
523
+ this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
524
524
  }
525
525
  }
526
- await this.debugLog(`Window On: ${this.On}`)
526
+ this.debugLog(`Window On: ${this.On}`)
527
527
  } else if (this.otherDeviceType === 'WindowCovering' && this.WindowCovering) {
528
528
  if (this.On === undefined) {
529
- await this.debugLog(`On: ${this.On}`)
529
+ this.debugLog(`On: ${this.On}`)
530
530
  } else {
531
531
  if (this.On) {
532
532
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100)
533
533
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100)
534
534
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
535
- await this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
535
+ this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`)
536
536
  } else {
537
537
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0)
538
538
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0)
539
539
  this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
540
- await this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
540
+ this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`)
541
541
  }
542
542
  }
543
- await this.debugLog(`Window Covering On: ${this.On}`)
543
+ this.debugLog(`Window Covering On: ${this.On}`)
544
544
  } else if (this.otherDeviceType === 'Lock' && this.LockMechanism) {
545
545
  if (this.On === undefined) {
546
- await this.debugLog(`On: ${this.On}`)
546
+ this.debugLog(`On: ${this.On}`)
547
547
  } else {
548
548
  if (this.On) {
549
549
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.UNSECURED)
550
550
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.UNSECURED)
551
- await this.debugLog(`updateCharacteristicc LockTargetState: UNSECURED, LockCurrentState: UNSECURED (${this.On})`)
551
+ this.debugLog(`updateCharacteristicc LockTargetState: UNSECURED, LockCurrentState: UNSECURED (${this.On})`)
552
552
  } else {
553
553
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.SECURED)
554
554
  this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.SECURED)
555
- await this.debugLog(`updateCharacteristic LockTargetState: SECURED, LockCurrentState: SECURED (${this.On})`)
555
+ this.debugLog(`updateCharacteristic LockTargetState: SECURED, LockCurrentState: SECURED (${this.On})`)
556
556
  }
557
557
  }
558
- await this.debugLog(`Lock On: ${this.On}`)
558
+ this.debugLog(`Lock On: ${this.On}`)
559
559
  } else if (this.otherDeviceType === 'Faucet' && this.Faucet) {
560
560
  if (this.On === undefined) {
561
- await this.debugLog(`On: ${this.On}`)
561
+ this.debugLog(`On: ${this.On}`)
562
562
  } else {
563
563
  if (this.On) {
564
564
  this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE)
565
- await this.debugLog(`updateCharacteristic Active: ${this.On}`)
565
+ this.debugLog(`updateCharacteristic Active: ${this.On}`)
566
566
  } else {
567
567
  this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE)
568
- await this.debugLog(`updateCharacteristic Active: ${this.On}`)
568
+ this.debugLog(`updateCharacteristic Active: ${this.On}`)
569
569
  }
570
570
  }
571
- await this.debugLog(`Faucet On: ${this.On}`)
571
+ this.debugLog(`Faucet On: ${this.On}`)
572
572
  } else if (this.otherDeviceType === 'Fan' && this.Fan) {
573
573
  if (this.On === undefined) {
574
- await this.debugLog(`On: ${this.On}`)
574
+ this.debugLog(`On: ${this.On}`)
575
575
  } else {
576
576
  if (this.On) {
577
577
  this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE)
578
- await this.debugLog(`updateCharacteristic Active: ${this.On}`)
578
+ this.debugLog(`updateCharacteristic Active: ${this.On}`)
579
579
  } else {
580
580
  this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE)
581
- await this.debugLog(`updateCharacteristic Active: ${this.On}`)
581
+ this.debugLog(`updateCharacteristic Active: ${this.On}`)
582
582
  }
583
583
  }
584
- await this.debugLog(`Fan On: ${this.On}`)
584
+ this.debugLog(`Fan On: ${this.On}`)
585
585
  } else if (this.otherDeviceType === 'Stateful' && this.StatefulProgrammableSwitch) {
586
586
  if (this.On === undefined) {
587
- await this.debugLog(`On: ${this.On}`)
587
+ this.debugLog(`On: ${this.On}`)
588
588
  } else {
589
589
  if (this.On) {
590
590
  this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS)
591
591
  this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1)
592
- await this.debugLog(`updateCharacteristic ProgrammableSwitchEvent: ProgrammableSwitchOutputState: (${this.On})`)
592
+ this.debugLog(`updateCharacteristic ProgrammableSwitchEvent: ProgrammableSwitchOutputState: (${this.On})`)
593
593
  } else {
594
594
  this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS)
595
595
  this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0)
596
- await this.debugLog(`updateCharacteristic ProgrammableSwitchEvent: ProgrammableSwitchOutputState: (${this.On})`)
596
+ this.debugLog(`updateCharacteristic ProgrammableSwitchEvent: ProgrammableSwitchOutputState: (${this.On})`)
597
597
  }
598
598
  }
599
- await this.debugLog(`StatefulProgrammableSwitch On: ${this.On}`)
599
+ this.debugLog(`StatefulProgrammableSwitch On: ${this.On}`)
600
600
  } else if (this.otherDeviceType === 'Outlet' && this.Outlet) {
601
601
  if (this.On === undefined) {
602
- await this.debugLog(`On: ${this.On}`)
602
+ this.debugLog(`On: ${this.On}`)
603
603
  } else {
604
604
  this.Outlet.Service.updateCharacteristic(this.hap.Characteristic.On, this.On)
605
- await this.debugLog(`updateCharacteristic On: ${this.On}`)
605
+ this.debugLog(`updateCharacteristic On: ${this.On}`)
606
606
  }
607
607
  } else {
608
- await this.errorLog(`otherDeviceType: ${this.otherDeviceType}, On: ${this.On}`)
608
+ this.errorLog(`otherDeviceType: ${this.otherDeviceType}, On: ${this.On}`)
609
609
  }
610
610
  }
611
611
 
@@ -786,6 +786,6 @@ export class Others extends irdeviceBase {
786
786
  async getOtherConfigSettings(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): Promise<void> {
787
787
  this.otherDeviceType = (device as irOtherConfig).type ?? 'Outlet'
788
788
  const deviceType = (device as irOtherConfig).type ? 'Device Config' : 'Default'
789
- await this.debugLog(`Use ${deviceType} Device Type: ${this.otherDeviceType}`)
789
+ this.debugLog(`Use ${deviceType} Device Type: ${this.otherDeviceType}`)
790
790
  }
791
791
  }
@@ -107,7 +107,7 @@ export class TV extends irdeviceBase {
107
107
  }
108
108
 
109
109
  async VolumeSelectorSet(value: CharacteristicValue): Promise<void> {
110
- await this.debugLog(`VolumeSelector: ${value}`)
110
+ this.debugLog(`VolumeSelector: ${value}`)
111
111
  if (value === this.hap.Characteristic.VolumeSelector.INCREMENT) {
112
112
  this.pushVolumeUpChanges()
113
113
  } else {
@@ -118,61 +118,61 @@ export class TV extends irdeviceBase {
118
118
  async RemoteKeySet(value: CharacteristicValue): Promise<void> {
119
119
  switch (value) {
120
120
  case this.hap.Characteristic.RemoteKey.REWIND: {
121
- await this.debugLog('Set Remote Key Pressed: REWIND')
121
+ this.debugLog('Set Remote Key Pressed: REWIND')
122
122
  break
123
123
  }
124
124
  case this.hap.Characteristic.RemoteKey.FAST_FORWARD: {
125
- await this.debugLog('Set Remote Key Pressed: FAST_FORWARD')
125
+ this.debugLog('Set Remote Key Pressed: FAST_FORWARD')
126
126
  break
127
127
  }
128
128
  case this.hap.Characteristic.RemoteKey.NEXT_TRACK: {
129
- await this.debugLog('Set Remote Key Pressed: NEXT_TRACK')
129
+ this.debugLog('Set Remote Key Pressed: NEXT_TRACK')
130
130
  break
131
131
  }
132
132
  case this.hap.Characteristic.RemoteKey.PREVIOUS_TRACK: {
133
- await this.debugLog('Set Remote Key Pressed: PREVIOUS_TRACK')
133
+ this.debugLog('Set Remote Key Pressed: PREVIOUS_TRACK')
134
134
  break
135
135
  }
136
136
  case this.hap.Characteristic.RemoteKey.ARROW_UP: {
137
- await this.debugLog('Set Remote Key Pressed: ARROW_UP')
137
+ this.debugLog('Set Remote Key Pressed: ARROW_UP')
138
138
  // this.pushUpChanges();
139
139
  break
140
140
  }
141
141
  case this.hap.Characteristic.RemoteKey.ARROW_DOWN: {
142
- await this.debugLog('Set Remote Key Pressed: ARROW_DOWN')
142
+ this.debugLog('Set Remote Key Pressed: ARROW_DOWN')
143
143
  // this.pushDownChanges();
144
144
  break
145
145
  }
146
146
  case this.hap.Characteristic.RemoteKey.ARROW_LEFT: {
147
- await this.debugLog('Set Remote Key Pressed: ARROW_LEFT')
147
+ this.debugLog('Set Remote Key Pressed: ARROW_LEFT')
148
148
  // this.pushLeftChanges();
149
149
  break
150
150
  }
151
151
  case this.hap.Characteristic.RemoteKey.ARROW_RIGHT: {
152
- await this.debugLog('Set Remote Key Pressed: ARROW_RIGHT')
152
+ this.debugLog('Set Remote Key Pressed: ARROW_RIGHT')
153
153
  // this.pushRightChanges();
154
154
  break
155
155
  }
156
156
  case this.hap.Characteristic.RemoteKey.SELECT: {
157
- await this.debugLog('Set Remote Key Pressed: SELECT')
157
+ this.debugLog('Set Remote Key Pressed: SELECT')
158
158
  // this.pushOkChanges();
159
159
  break
160
160
  }
161
161
  case this.hap.Characteristic.RemoteKey.BACK: {
162
- await this.debugLog('Set Remote Key Pressed: BACK')
162
+ this.debugLog('Set Remote Key Pressed: BACK')
163
163
  // this.pushBackChanges();
164
164
  break
165
165
  }
166
166
  case this.hap.Characteristic.RemoteKey.EXIT: {
167
- await this.debugLog('Set Remote Key Pressed: EXIT')
167
+ this.debugLog('Set Remote Key Pressed: EXIT')
168
168
  break
169
169
  }
170
170
  case this.hap.Characteristic.RemoteKey.PLAY_PAUSE: {
171
- await this.debugLog('Set Remote Key Pressed: PLAY_PAUSE')
171
+ this.debugLog('Set Remote Key Pressed: PLAY_PAUSE')
172
172
  break
173
173
  }
174
174
  case this.hap.Characteristic.RemoteKey.INFORMATION: {
175
- await this.debugLog('Set Remote Key Pressed: INFORMATION')
175
+ this.debugLog('Set Remote Key Pressed: INFORMATION')
176
176
  // this.pushMenuChanges();
177
177
  break
178
178
  }
@@ -180,12 +180,12 @@ export class TV extends irdeviceBase {
180
180
  }
181
181
 
182
182
  async ActiveIdentifierSet(value: CharacteristicValue): Promise<void> {
183
- await this.debugLog(`ActiveIdentifier: ${value}`)
183
+ this.debugLog(`ActiveIdentifier: ${value}`)
184
184
  this.Television.ActiveIdentifier = value
185
185
  }
186
186
 
187
187
  async ActiveSet(value: CharacteristicValue): Promise<void> {
188
- await this.debugLog(`Active (value): ${value}`)
188
+ this.debugLog(`Active (value): ${value}`)
189
189
 
190
190
  this.Television.Active = value
191
191
  if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE) {
@@ -206,7 +206,7 @@ export class TV extends irdeviceBase {
206
206
  * TV "command" "channelSub" "default" previous channel
207
207
  */
208
208
  async pushTvOnChanges(): Promise<void> {
209
- await this.debugLog(`pushTvOnChanges Active: ${this.Television.Active}, disablePushOn: ${this.disablePushOn}`)
209
+ this.debugLog(`pushTvOnChanges Active: ${this.Television.Active}, disablePushOn: ${this.disablePushOn}`)
210
210
  if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
211
211
  const commandType: string = await this.commandType()
212
212
  const command: string = await this.commandOn()
@@ -220,7 +220,7 @@ export class TV extends irdeviceBase {
220
220
  }
221
221
 
222
222
  async pushTvOffChanges(): Promise<void> {
223
- await this.debugLog(`pushTvOffChanges Active: ${this.Television.Active}, disablePushOff: ${this.disablePushOff}`)
223
+ this.debugLog(`pushTvOffChanges Active: ${this.Television.Active}, disablePushOff: ${this.disablePushOff}`)
224
224
  if (this.Television.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
225
225
  const commandType: string = await this.commandType()
226
226
  const command: string = await this.commandOff()
@@ -234,7 +234,7 @@ export class TV extends irdeviceBase {
234
234
  }
235
235
 
236
236
  async pushOkChanges(): Promise<void> {
237
- await this.debugLog(`pushOkChanges disablePushDetail: ${this.disablePushDetail}`)
237
+ this.debugLog(`pushOkChanges disablePushDetail: ${this.disablePushDetail}`)
238
238
  if (!this.disablePushDetail) {
239
239
  const bodyChange: bodyChange = {
240
240
  command: 'Ok',
@@ -246,7 +246,7 @@ export class TV extends irdeviceBase {
246
246
  }
247
247
 
248
248
  async pushBackChanges(): Promise<void> {
249
- await this.debugLog(`pushBackChanges disablePushDetail: ${this.disablePushDetail}`)
249
+ this.debugLog(`pushBackChanges disablePushDetail: ${this.disablePushDetail}`)
250
250
  if (!this.disablePushDetail) {
251
251
  const bodyChange: bodyChange = {
252
252
  command: 'Back',
@@ -258,7 +258,7 @@ export class TV extends irdeviceBase {
258
258
  }
259
259
 
260
260
  async pushMenuChanges(): Promise<void> {
261
- await this.debugLog(`pushMenuChanges disablePushDetail: ${this.disablePushDetail}`)
261
+ this.debugLog(`pushMenuChanges disablePushDetail: ${this.disablePushDetail}`)
262
262
  if (!this.disablePushDetail) {
263
263
  const bodyChange: bodyChange = {
264
264
  command: 'Menu',
@@ -270,7 +270,7 @@ export class TV extends irdeviceBase {
270
270
  }
271
271
 
272
272
  async pushUpChanges(): Promise<void> {
273
- await this.debugLog(`pushUpChanges disablePushDetail: ${this.disablePushDetail}`)
273
+ this.debugLog(`pushUpChanges disablePushDetail: ${this.disablePushDetail}`)
274
274
  if (!this.disablePushDetail) {
275
275
  const bodyChange: bodyChange = {
276
276
  command: 'Up',
@@ -282,7 +282,7 @@ export class TV extends irdeviceBase {
282
282
  }
283
283
 
284
284
  async pushDownChanges(): Promise<void> {
285
- await this.debugLog(`pushDownChanges disablePushDetail: ${this.disablePushDetail}`)
285
+ this.debugLog(`pushDownChanges disablePushDetail: ${this.disablePushDetail}`)
286
286
  if (!this.disablePushDetail) {
287
287
  const bodyChange: bodyChange = {
288
288
  command: 'Down',
@@ -294,7 +294,7 @@ export class TV extends irdeviceBase {
294
294
  }
295
295
 
296
296
  async pushRightChanges(): Promise<void> {
297
- await this.debugLog(`pushRightChanges disablePushDetail: ${this.disablePushDetail}`)
297
+ this.debugLog(`pushRightChanges disablePushDetail: ${this.disablePushDetail}`)
298
298
  if (!this.disablePushDetail) {
299
299
  const bodyChange: bodyChange = {
300
300
  command: 'Right',
@@ -306,7 +306,7 @@ export class TV extends irdeviceBase {
306
306
  }
307
307
 
308
308
  async pushLeftChanges(): Promise<void> {
309
- await this.debugLog(`pushLeftChanges disablePushDetail: ${this.disablePushDetail}`)
309
+ this.debugLog(`pushLeftChanges disablePushDetail: ${this.disablePushDetail}`)
310
310
  if (!this.disablePushDetail) {
311
311
  const bodyChange: bodyChange = {
312
312
  command: 'Left',
@@ -318,7 +318,7 @@ export class TV extends irdeviceBase {
318
318
  }
319
319
 
320
320
  async pushVolumeUpChanges(): Promise<void> {
321
- await this.debugLog(`pushVolumeUpChanges disablePushDetail: ${this.disablePushDetail}`)
321
+ this.debugLog(`pushVolumeUpChanges disablePushDetail: ${this.disablePushDetail}`)
322
322
  if (!this.disablePushDetail) {
323
323
  const bodyChange: bodyChange = {
324
324
  command: 'volumeAdd',
@@ -330,7 +330,7 @@ export class TV extends irdeviceBase {
330
330
  }
331
331
 
332
332
  async pushVolumeDownChanges(): Promise<void> {
333
- await this.debugLog(`pushVolumeDownChanges disablePushDetail: ${this.disablePushDetail}`)
333
+ this.debugLog(`pushVolumeDownChanges disablePushDetail: ${this.disablePushDetail}`)
334
334
  if (!this.disablePushDetail) {
335
335
  const bodyChange: bodyChange = {
336
336
  command: 'volumeSub',
@@ -342,12 +342,12 @@ export class TV extends irdeviceBase {
342
342
  }
343
343
 
344
344
  async pushTVChanges(bodyChange: any): Promise<void> {
345
- await this.debugLog('pushTVChanges')
345
+ this.debugLog('pushTVChanges')
346
346
  if (this.device.connectionType === 'OpenAPI') {
347
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
347
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
348
348
  try {
349
- const { body } = await this.pushChangeRequest(bodyChange)
350
- const deviceStatus: any = await body
349
+ const response = await this.pushChangeRequest(bodyChange)
350
+ const deviceStatus: any = response.body
351
351
  await this.pushStatusCodes(deviceStatus)
352
352
  if (await this.successfulStatusCodes(deviceStatus)) {
353
353
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -360,12 +360,12 @@ export class TV extends irdeviceBase {
360
360
  await this.pushChangeError(e)
361
361
  }
362
362
  } else {
363
- await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
363
+ this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
364
364
  }
365
365
  }
366
366
 
367
367
  async updateHomeKitCharacteristics(): Promise<void> {
368
- await this.debugLog('updateHomeKitCharacteristics')
368
+ this.debugLog('updateHomeKitCharacteristics')
369
369
  // Active
370
370
  await this.updateCharacteristic(this.Television.Service, this.hap.Characteristic.Active, this.Television.Active, 'Active')
371
371
  // ActiveIdentifier
@@ -47,7 +47,7 @@ export class VacuumCleaner extends irdeviceBase {
47
47
  }
48
48
 
49
49
  async OnSet(value: CharacteristicValue): Promise<void> {
50
- await this.debugLog(`On: ${value}`)
50
+ this.debugLog(`On: ${value}`)
51
51
 
52
52
  // Set the requested state
53
53
  this.Switch.On = value
@@ -65,7 +65,7 @@ export class VacuumCleaner extends irdeviceBase {
65
65
  * Vacuum Cleaner "command" "turnOn" "default" set to ON state
66
66
  */
67
67
  async pushOnChanges(): Promise<void> {
68
- await this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`)
68
+ this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`)
69
69
  if (this.Switch.On && !this.disablePushOn) {
70
70
  const commandType: string = await this.commandType()
71
71
  const command: string = await this.commandOn()
@@ -79,7 +79,7 @@ export class VacuumCleaner extends irdeviceBase {
79
79
  }
80
80
 
81
81
  async pushOffChanges(): Promise<void> {
82
- await this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`)
82
+ this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`)
83
83
  if (!this.Switch.On && !this.disablePushOff) {
84
84
  const commandType: string = await this.commandType()
85
85
  const command: string = await this.commandOff()
@@ -93,12 +93,12 @@ export class VacuumCleaner extends irdeviceBase {
93
93
  }
94
94
 
95
95
  async pushChanges(bodyChange: any): Promise<void> {
96
- await this.debugLog('pushChanges')
96
+ this.debugLog('pushChanges')
97
97
  if (this.device.connectionType === 'OpenAPI') {
98
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
98
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
99
99
  try {
100
- const { body } = await this.pushChangeRequest(bodyChange)
101
- const deviceStatus: any = await body
100
+ const response = await this.pushChangeRequest(bodyChange)
101
+ const deviceStatus: any = response.body
102
102
  await this.pushStatusCodes(deviceStatus)
103
103
  if (await this.successfulStatusCodes(deviceStatus)) {
104
104
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -111,12 +111,12 @@ export class VacuumCleaner extends irdeviceBase {
111
111
  await this.pushChangeError(e)
112
112
  }
113
113
  } else {
114
- await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
114
+ this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
115
115
  }
116
116
  }
117
117
 
118
118
  async updateHomeKitCharacteristics(): Promise<void> {
119
- await this.debugLog('updateHomeKitCharacteristics')
119
+ this.debugLog('updateHomeKitCharacteristics')
120
120
  // On
121
121
  await this.updateCharacteristic(this.Switch.Service, this.hap.Characteristic.On, this.Switch.On, 'On')
122
122
  }
@@ -47,7 +47,7 @@ export class WaterHeater extends irdeviceBase {
47
47
  }
48
48
 
49
49
  async ActiveSet(value: CharacteristicValue): Promise<void> {
50
- await this.debugLog(`Active: ${value}`)
50
+ this.debugLog(`Active: ${value}`)
51
51
 
52
52
  this.Valve.Active = value
53
53
  if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE) {
@@ -66,7 +66,7 @@ export class WaterHeater extends irdeviceBase {
66
66
  * WaterHeater "command" "turnOn" "default" set to ON state
67
67
  */
68
68
  async pushWaterHeaterOnChanges(): Promise<void> {
69
- await this.debugLog(`pushWaterHeaterOnChanges Active: ${this.Valve.Active}, disablePushOn: ${this.disablePushOn}`)
69
+ this.debugLog(`pushWaterHeaterOnChanges Active: ${this.Valve.Active}, disablePushOn: ${this.disablePushOn}`)
70
70
  if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
71
71
  const commandType: string = await this.commandType()
72
72
  const command: string = await this.commandOn()
@@ -80,7 +80,7 @@ export class WaterHeater extends irdeviceBase {
80
80
  }
81
81
 
82
82
  async pushWaterHeaterOffChanges(): Promise<void> {
83
- await this.debugLog(`pushWaterHeaterOffChanges Active: ${this.Valve.Active}, disablePushOff: ${this.disablePushOff}`)
83
+ this.debugLog(`pushWaterHeaterOffChanges Active: ${this.Valve.Active}, disablePushOff: ${this.disablePushOff}`)
84
84
  if (this.Valve.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
85
85
  const commandType: string = await this.commandType()
86
86
  const command: string = await this.commandOff()
@@ -94,12 +94,12 @@ export class WaterHeater extends irdeviceBase {
94
94
  }
95
95
 
96
96
  async pushChanges(bodyChange: any): Promise<void> {
97
- await this.debugLog('pushChanges')
97
+ this.debugLog('pushChanges')
98
98
  if (this.device.connectionType === 'OpenAPI') {
99
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
99
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
100
100
  try {
101
- const { body } = await this.pushChangeRequest(bodyChange)
102
- const deviceStatus: any = await body
101
+ const response = await this.pushChangeRequest(bodyChange)
102
+ const deviceStatus: any = response.body
103
103
  await this.pushStatusCodes(deviceStatus)
104
104
  if (await this.successfulStatusCodes(deviceStatus)) {
105
105
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -112,12 +112,12 @@ export class WaterHeater extends irdeviceBase {
112
112
  await this.pushChangeError(e)
113
113
  }
114
114
  } else {
115
- await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
115
+ this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
116
116
  }
117
117
  }
118
118
 
119
119
  async updateHomeKitCharacteristics(): Promise<void> {
120
- await this.debugLog('updateHomeKitCharacteristics')
120
+ this.debugLog('updateHomeKitCharacteristics')
121
121
  // Active
122
122
  await this.updateCharacteristic(this.Valve.Service, this.hap.Characteristic.Active, this.Valve.Active, 'Active')
123
123
  }