@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
@@ -158,7 +158,7 @@ export class AirConditioner extends irdeviceBase {
158
158
  * AirConditioner: "command" "highSpeed" "default" = fan speed to high
159
159
  */
160
160
  async pushAirConditionerOnChanges(): Promise<void> {
161
- await this.debugLog(`pushAirConditionerOnChanges Active: ${this.HeaterCooler.Active}, disablePushOn: ${this.disablePushOn}`)
161
+ this.debugLog(`pushAirConditionerOnChanges Active: ${this.HeaterCooler.Active}, disablePushOn: ${this.disablePushOn}`)
162
162
  if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
163
163
  const commandType: string = await this.commandType()
164
164
  const command: string = await this.commandOn()
@@ -172,7 +172,7 @@ export class AirConditioner extends irdeviceBase {
172
172
  }
173
173
 
174
174
  async pushAirConditionerOffChanges(): Promise<void> {
175
- await this.debugLog(`pushAirConditionerOffChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.disablePushOff}`)
175
+ this.debugLog(`pushAirConditionerOffChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.disablePushOff}`)
176
176
  if (this.HeaterCooler.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
177
177
  const commandType: string = await this.commandType()
178
178
  const command: string = await this.commandOff()
@@ -186,7 +186,7 @@ export class AirConditioner extends irdeviceBase {
186
186
  }
187
187
 
188
188
  async pushAirConditionerStatusChanges(): Promise<void> {
189
- await this.debugLog(`pushAirConditionerStatusChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
189
+ this.debugLog(`pushAirConditionerStatusChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
190
190
  if (!this.Busy) {
191
191
  this.Busy = true
192
192
  this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE
@@ -198,7 +198,7 @@ export class AirConditioner extends irdeviceBase {
198
198
  }
199
199
 
200
200
  async pushAirConditionerDetailsChanges(): Promise<void> {
201
- await this.debugLog(`pushAirConditionerDetailsChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
201
+ this.debugLog(`pushAirConditionerDetailsChanges Active: ${this.HeaterCooler.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
202
202
  // await this.deviceContext();
203
203
  if (this.CurrentMode === undefined) {
204
204
  this.CurrentMode = 1
@@ -214,7 +214,7 @@ export class AirConditioner extends irdeviceBase {
214
214
  if (this.CurrentMode === 1) {
215
215
  // Remove or make configurable?
216
216
  this.HeaterCooler.ThresholdTemperature = 25
217
- await this.debugLog(`CurrentMode: ${this.CurrentMode}, ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`)
217
+ this.debugLog(`CurrentMode: ${this.CurrentMode}, ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`)
218
218
  }
219
219
  const parameter = `${this.HeaterCooler.ThresholdTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`
220
220
 
@@ -312,12 +312,12 @@ export class AirConditioner extends irdeviceBase {
312
312
  }
313
313
 
314
314
  async pushChanges(bodyChange: any): Promise<void> {
315
- await this.debugLog('pushChanges')
315
+ this.debugLog('pushChanges')
316
316
  if (this.device.connectionType === 'OpenAPI' && !this.disablePushDetail) {
317
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
317
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
318
318
  try {
319
- const { body } = await this.pushChangeRequest(bodyChange)
320
- const deviceStatus: any = await body
319
+ const response = await this.pushChangeRequest(bodyChange)
320
+ const deviceStatus: any = response.body
321
321
  await this.pushStatusCodes(deviceStatus)
322
322
  if (await this.successfulStatusCodes(deviceStatus)) {
323
323
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -330,8 +330,8 @@ export class AirConditioner extends irdeviceBase {
330
330
  await this.pushChangeError(e)
331
331
  }
332
332
  } else {
333
- await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
334
- await this.debugLog(`Connection Type: ${this.device.connectionType}, disablePushDetails: ${this.disablePushDetail}`)
333
+ this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
334
+ this.debugLog(`Connection Type: ${this.device.connectionType}, disablePushDetails: ${this.disablePushDetail}`)
335
335
  await this.updateHomeKitCharacteristics()
336
336
  }
337
337
  }
@@ -339,22 +339,22 @@ export class AirConditioner extends irdeviceBase {
339
339
  async CurrentTemperatureGet(): Promise<CharacteristicValue> {
340
340
  if (this.meter?.context?.CurrentTemperature) {
341
341
  this.accessory.context.CurrentTemperature = this.meter.context.CurrentTemperature
342
- await this.debugLog(`Using CurrentTemperature from ${this.meter.context.deviceType} (${this.meter.context.deviceId})`)
342
+ this.debugLog(`Using CurrentTemperature from ${this.meter.context.deviceType} (${this.meter.context.deviceId})`)
343
343
  }
344
344
 
345
345
  this.HeaterCooler.CurrentTemperature = this.accessory.context.CurrentTemperature || 24
346
- await this.debugLog(`Get CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`)
346
+ this.debugLog(`Get CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`)
347
347
  return this.HeaterCooler.CurrentTemperature
348
348
  }
349
349
 
350
350
  async CurrentRelativeHumidityGet(): Promise<CharacteristicValue> {
351
351
  if (this.meter?.context?.CurrentRelativeHumidity) {
352
352
  this.accessory.context.CurrentRelativeHumidity = this.meter.context.CurrentRelativeHumidity
353
- await this.debugLog(`Using CurrentRelativeHumidity from ${this.meter.context.deviceType} (${this.meter.context.deviceId})`)
353
+ this.debugLog(`Using CurrentRelativeHumidity from ${this.meter.context.deviceType} (${this.meter.context.deviceId})`)
354
354
  }
355
355
 
356
356
  this.HumiditySensor!.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity || 0
357
- await this.debugLog(`Get CurrentRelativeHumidity: ${this.HumiditySensor!.CurrentRelativeHumidity}`)
357
+ this.debugLog(`Get CurrentRelativeHumidity: ${this.HumiditySensor!.CurrentRelativeHumidity}`)
358
358
  return this.HumiditySensor!.CurrentRelativeHumidity as CharacteristicValue
359
359
  }
360
360
 
@@ -364,7 +364,7 @@ export class AirConditioner extends irdeviceBase {
364
364
  } else {
365
365
  this.HeaterCooler.RotationSpeed = this.CurrentFanSpeed - 1
366
366
  }
367
- await this.debugLog(`Get RotationSpeed: ${this.HeaterCooler.RotationSpeed}`)
367
+ this.debugLog(`Get RotationSpeed: ${this.HeaterCooler.RotationSpeed}`)
368
368
  return this.HeaterCooler.RotationSpeed
369
369
  }
370
370
 
@@ -375,23 +375,23 @@ export class AirConditioner extends irdeviceBase {
375
375
  this.CurrentFanSpeed = Number(value) + 1
376
376
  }
377
377
  this.HeaterCooler.RotationSpeed = value
378
- await this.debugLog(`Set RotationSpeed: ${this.HeaterCooler.RotationSpeed}, CurrentFanSpeed: ${this.CurrentFanSpeed}`)
378
+ this.debugLog(`Set RotationSpeed: ${this.HeaterCooler.RotationSpeed}, CurrentFanSpeed: ${this.CurrentFanSpeed}`)
379
379
  this.pushAirConditionerStatusChanges()
380
380
  }
381
381
 
382
382
  async ActiveSet(value: CharacteristicValue): Promise<void> {
383
- await this.debugLog(`Set Active: ${value}`)
383
+ this.debugLog(`Set Active: ${value}`)
384
384
 
385
385
  this.HeaterCooler.Active = value
386
386
  if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE) {
387
- await this.debugLog(`pushAirConditionerOnChanges, Active: ${this.HeaterCooler.Active}`)
387
+ this.debugLog(`pushAirConditionerOnChanges, Active: ${this.HeaterCooler.Active}`)
388
388
  if (this.disablePushOn) {
389
389
  this.pushAirConditionerStatusChanges()
390
390
  } else {
391
391
  this.pushAirConditionerOnChanges()
392
392
  }
393
393
  } else {
394
- await this.debugLog(`pushAirConditionerOffChanges, Active: ${this.HeaterCooler.Active}`)
394
+ this.debugLog(`pushAirConditionerOffChanges, Active: ${this.HeaterCooler.Active}`)
395
395
  this.pushAirConditionerOffChanges()
396
396
  }
397
397
  }
@@ -399,7 +399,7 @@ export class AirConditioner extends irdeviceBase {
399
399
  async TargetHeaterCoolerStateGet(): Promise<CharacteristicValue> {
400
400
  const targetState = this.HeaterCooler.TargetHeaterCoolerState || this.accessory.context.TargetHeaterCoolerState
401
401
  this.HeaterCooler.TargetHeaterCoolerState = this.ValidValues.includes(targetState) ? targetState : this.ValidValues[0]
402
- await this.debugLog(`Get (${this.getTargetHeaterCoolerStateName()}) TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}, ValidValues: ${this.ValidValues}, hide_automode: ${this.hide_automode}`)
402
+ this.debugLog(`Get (${this.getTargetHeaterCoolerStateName()}) TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}, ValidValues: ${this.ValidValues}, hide_automode: ${this.hide_automode}`)
403
403
  return this.HeaterCooler.TargetHeaterCoolerState
404
404
  }
405
405
 
@@ -419,27 +419,27 @@ export class AirConditioner extends irdeviceBase {
419
419
  async TargetHeaterCoolerStateAUTO(): Promise<void> {
420
420
  this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.AUTO
421
421
  this.CurrentMode = 1
422
- await this.debugLog(`Set (AUTO) TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`)
423
- await this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`)
422
+ this.debugLog(`Set (AUTO) TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`)
423
+ this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`)
424
424
  }
425
425
 
426
426
  async TargetHeaterCoolerStateCOOL(): Promise<void> {
427
427
  this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.COOL
428
428
  this.CurrentMode = 2
429
- await this.debugLog(`Set (COOL) TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`)
430
- await this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`)
429
+ this.debugLog(`Set (COOL) TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`)
430
+ this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`)
431
431
  }
432
432
 
433
433
  async TargetHeaterCoolerStateHEAT(): Promise<void> {
434
434
  this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.HEAT
435
435
  this.CurrentMode = 5
436
- await this.debugLog(`Set (HEAT) TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`)
437
- await this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`)
436
+ this.debugLog(`Set (HEAT) TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`)
437
+ this.debugLog(`Switchbot CurrentMode: ${this.CurrentMode}`)
438
438
  }
439
439
 
440
440
  async CurrentHeaterCoolerStateGet(): Promise<CharacteristicValue> {
441
441
  await this.UpdateCurrentHeaterCoolerState()
442
- await this.debugLog(`Get (${this.getTargetHeaterCoolerStateName()}) CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`)
442
+ this.debugLog(`Get (${this.getTargetHeaterCoolerStateName()}) CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`)
443
443
 
444
444
  return this.HeaterCooler.CurrentHeaterCoolerState
445
445
  }
@@ -481,18 +481,18 @@ export class AirConditioner extends irdeviceBase {
481
481
  ? 0
482
482
  : this.HumiditySensor.CurrentRelativeHumidity ?? this.accessory.context.CurrentRelativeHumidity
483
483
  }
484
- await this.debugLog(`Get ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`)
484
+ this.debugLog(`Get ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`)
485
485
  return this.HeaterCooler.ThresholdTemperature
486
486
  }
487
487
 
488
488
  async ThresholdTemperatureSet(value: CharacteristicValue): Promise<void> {
489
489
  this.HeaterCooler.ThresholdTemperature = value
490
- await this.debugLog(`Set ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}, ThresholdTemperatureCached: ${this.accessory.context.ThresholdTemperature}`)
490
+ this.debugLog(`Set ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}, ThresholdTemperatureCached: ${this.accessory.context.ThresholdTemperature}`)
491
491
  this.pushAirConditionerStatusChanges()
492
492
  }
493
493
 
494
494
  async updateHomeKitCharacteristics(): Promise<void> {
495
- await this.debugLog('updateHomeKitCharacteristics')
495
+ this.debugLog('updateHomeKitCharacteristics')
496
496
  // Active
497
497
  await this.updateCharacteristic(this.HeaterCooler.Service, this.hap.Characteristic.Active, this.HeaterCooler.Active, 'Active')
498
498
  // RotationSpeed
@@ -98,7 +98,7 @@ export class AirPurifier extends irdeviceBase {
98
98
  }
99
99
 
100
100
  async ActiveSet(value: CharacteristicValue): Promise<void> {
101
- await this.debugLog(`Set Active: ${value}`)
101
+ this.debugLog(`Set Active: ${value}`)
102
102
 
103
103
  this.AirPurifier.Active = value
104
104
  if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE) {
@@ -145,7 +145,7 @@ export class AirPurifier extends irdeviceBase {
145
145
  * AirPurifier: "command" "highSpeed" "default" = fan speed to high
146
146
  */
147
147
  async pushAirPurifierOnChanges(): Promise<void> {
148
- await this.debugLog(`pushAirPurifierOnChanges Active: ${this.AirPurifier.Active}, disablePushOn: ${this.disablePushOn}`)
148
+ this.debugLog(`pushAirPurifierOnChanges Active: ${this.AirPurifier.Active}, disablePushOn: ${this.disablePushOn}`)
149
149
  if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
150
150
  const commandType: string = await this.commandType()
151
151
  const command: string = await this.commandOn()
@@ -159,7 +159,7 @@ export class AirPurifier extends irdeviceBase {
159
159
  }
160
160
 
161
161
  async pushAirPurifierOffChanges(): Promise<void> {
162
- await this.debugLog(`pushAirPurifierOffChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}`)
162
+ this.debugLog(`pushAirPurifierOffChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}`)
163
163
  if (this.AirPurifier.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOn) {
164
164
  const commandType: string = await this.commandType()
165
165
  const command: string = await this.commandOff()
@@ -173,7 +173,7 @@ export class AirPurifier extends irdeviceBase {
173
173
  }
174
174
 
175
175
  async pushAirPurifierStatusChanges(): Promise<void> {
176
- await this.debugLog(`pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
176
+ this.debugLog(`pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
177
177
  if (!this.Busy) {
178
178
  this.Busy = true
179
179
  this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE
@@ -185,7 +185,7 @@ export class AirPurifier extends irdeviceBase {
185
185
  }
186
186
 
187
187
  async pushAirPurifierDetailsChanges(): Promise<void> {
188
- await this.debugLog(`pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
188
+ this.debugLog(`pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
189
189
  this.CurrentAPTemp = this.TemperatureSensor!.CurrentTemperature ?? 24
190
190
  this.CurrentAPMode = this.CurrentMode ?? 1
191
191
  this.CurrentAPFanSpeed = this.CurrentFanSpeed ?? 1
@@ -209,12 +209,12 @@ export class AirPurifier extends irdeviceBase {
209
209
  }
210
210
 
211
211
  async pushChanges(bodyChange: any): Promise<void> {
212
- await this.debugLog('pushChanges')
212
+ this.debugLog('pushChanges')
213
213
  if (this.device.connectionType === 'OpenAPI') {
214
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
214
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
215
215
  try {
216
- const { body } = await this.pushChangeRequest(bodyChange)
217
- const deviceStatus: any = await body
216
+ const response = await this.pushChangeRequest(bodyChange)
217
+ const deviceStatus: any = response.body
218
218
  await this.pushStatusCodes(deviceStatus)
219
219
  if (await this.successfulStatusCodes(deviceStatus)) {
220
220
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -232,7 +232,7 @@ export class AirPurifier extends irdeviceBase {
232
232
  }
233
233
 
234
234
  async updateHomeKitCharacteristics(): Promise<void> {
235
- await this.debugLog('updateHomeKitCharacteristics')
235
+ this.debugLog('updateHomeKitCharacteristics')
236
236
  // Active
237
237
  await this.updateCharacteristic(this.AirPurifier.Service, this.hap.Characteristic.Active, this.AirPurifier.Active, 'Active')
238
238
  // CurrentAirPurifierState
@@ -47,7 +47,7 @@ export class Camera 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
  this.Switch.On = value
53
53
  if (this.Switch.On) {
@@ -68,7 +68,7 @@ export class Camera extends irdeviceBase {
68
68
  * Camera - "command" "channelSub" "default" = previous channel
69
69
  */
70
70
  async pushOnChanges(): Promise<void> {
71
- await this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`)
71
+ this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`)
72
72
  if (this.Switch.On && !this.disablePushOn) {
73
73
  const commandType: string = await this.commandType()
74
74
  const command: string = await this.commandOn()
@@ -82,7 +82,7 @@ export class Camera extends irdeviceBase {
82
82
  }
83
83
 
84
84
  async pushOffChanges(): Promise<void> {
85
- await this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`)
85
+ this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`)
86
86
  if (!this.Switch.On && !this.disablePushOff) {
87
87
  const commandType: string = await this.commandType()
88
88
  const command: string = await this.commandOff()
@@ -96,12 +96,12 @@ export class Camera extends irdeviceBase {
96
96
  }
97
97
 
98
98
  async pushChanges(bodyChange: any): Promise<void> {
99
- await this.debugLog('pushChanges')
99
+ this.debugLog('pushChanges')
100
100
  if (this.device.connectionType === 'OpenAPI') {
101
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
101
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
102
102
  try {
103
- const { body } = await this.pushChangeRequest(bodyChange)
104
- const deviceStatus: any = await body
103
+ const response = await this.pushChangeRequest(bodyChange)
104
+ const deviceStatus: any = response.body
105
105
  await this.pushStatusCodes(deviceStatus)
106
106
  if (await this.successfulStatusCodes(deviceStatus)) {
107
107
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -114,12 +114,12 @@ export class Camera extends irdeviceBase {
114
114
  await this.pushChangeError(e)
115
115
  }
116
116
  } else {
117
- await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
117
+ this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
118
118
  }
119
119
  }
120
120
 
121
121
  async updateHomeKitCharacteristics(): Promise<void> {
122
- await this.debugLog('updateHomeKitCharacteristics')
122
+ this.debugLog('updateHomeKitCharacteristics')
123
123
  // Active
124
124
  await this.updateCharacteristic(this.Switch.Service, this.hap.Characteristic.On, this.Switch.On, 'On')
125
125
  }
@@ -83,7 +83,7 @@ export class IRFan extends irdeviceBase {
83
83
  }
84
84
 
85
85
  async SwingModeSet(value: CharacteristicValue): Promise<void> {
86
- await this.debugLog(`SwingMode: ${value}`)
86
+ this.debugLog(`SwingMode: ${value}`)
87
87
  if (value > this.Fan.SwingMode) {
88
88
  this.Fan.SwingMode = 1
89
89
  await this.pushFanOnChanges()
@@ -98,7 +98,7 @@ export class IRFan extends irdeviceBase {
98
98
  }
99
99
 
100
100
  async RotationSpeedSet(value: CharacteristicValue): Promise<void> {
101
- await this.debugLog(`RotationSpeed: ${value}`)
101
+ this.debugLog(`RotationSpeed: ${value}`)
102
102
  if (value > this.Fan.RotationSpeed) {
103
103
  this.Fan.RotationSpeed = 1
104
104
  this.pushFanSpeedUpChanges()
@@ -112,7 +112,7 @@ export class IRFan extends irdeviceBase {
112
112
  }
113
113
 
114
114
  async ActiveSet(value: CharacteristicValue): Promise<void> {
115
- await this.debugLog(`Active: ${value}`)
115
+ this.debugLog(`Active: ${value}`)
116
116
 
117
117
  this.Fan.Active = value
118
118
  if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE) {
@@ -132,7 +132,7 @@ export class IRFan extends irdeviceBase {
132
132
  * Fan - "command" "highSpeed" "default" = fan speed to high
133
133
  */
134
134
  async pushFanOnChanges(): Promise<void> {
135
- await this.debugLog(`pushFanOnChanges Active: ${this.Fan.Active}, disablePushOn: ${this.disablePushOn}`)
135
+ this.debugLog(`pushFanOnChanges Active: ${this.Fan.Active}, disablePushOn: ${this.disablePushOn}`)
136
136
  if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
137
137
  const commandType: string = await this.commandType()
138
138
  const command: string = await this.commandOn()
@@ -146,7 +146,7 @@ export class IRFan extends irdeviceBase {
146
146
  }
147
147
 
148
148
  async pushFanOffChanges(): Promise<void> {
149
- await this.debugLog(`pushLightOffChanges Active: ${this.Fan.Active}, disablePushOff: ${this.disablePushOff}`)
149
+ this.debugLog(`pushLightOffChanges Active: ${this.Fan.Active}, disablePushOff: ${this.disablePushOff}`)
150
150
  if (this.Fan.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
151
151
  const commandType: string = await this.commandType()
152
152
  const command: string = await this.commandOff()
@@ -187,12 +187,12 @@ export class IRFan extends irdeviceBase {
187
187
  }
188
188
 
189
189
  async pushChanges(bodyChange: any): Promise<void> {
190
- await this.debugLog('pushChanges')
190
+ this.debugLog('pushChanges')
191
191
  if (this.device.connectionType === 'OpenAPI') {
192
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
192
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
193
193
  try {
194
- const { body } = await this.pushChangeRequest(bodyChange)
195
- const deviceStatus: any = await body
194
+ const response = await this.pushChangeRequest(bodyChange)
195
+ const deviceStatus: any = response.body
196
196
  await this.pushStatusCodes(deviceStatus)
197
197
  if (await this.successfulStatusCodes(deviceStatus)) {
198
198
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -205,12 +205,12 @@ export class IRFan extends irdeviceBase {
205
205
  await this.pushChangeError(e)
206
206
  }
207
207
  } else {
208
- await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
208
+ this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
209
209
  }
210
210
  }
211
211
 
212
212
  async updateHomeKitCharacteristics(): Promise<void> {
213
- await this.debugLog('updateHomeKitCharacteristics')
213
+ this.debugLog('updateHomeKitCharacteristics')
214
214
  // Active
215
215
  await this.updateCharacteristic(this.Fan.Service, this.hap.Characteristic.Active, this.Fan.Active, 'Active')
216
216
  // SwingMode
@@ -51,16 +51,16 @@ export abstract class irdeviceBase {
51
51
  async getDeviceLogSettings(device: irdevice & irDevicesConfig): Promise<void> {
52
52
  if (this.platform.debugMode) {
53
53
  this.deviceLogging = this.accessory.context.logging = 'debugMode'
54
- await this.debugWarnLog(`Using Debug Mode Logging: ${this.deviceLogging}`)
54
+ this.debugWarnLog(`Using Debug Mode Logging: ${this.deviceLogging}`)
55
55
  } else if (device.logging) {
56
56
  this.deviceLogging = this.accessory.context.logging = device.logging
57
- await this.debugWarnLog(`Using Device Config Logging: ${this.deviceLogging}`)
57
+ this.debugWarnLog(`Using Device Config Logging: ${this.deviceLogging}`)
58
58
  } else if (this.config.logging) {
59
59
  this.deviceLogging = this.accessory.context.logging = this.config.logging
60
- await this.debugWarnLog(`Using Platform Config Logging: ${this.deviceLogging}`)
60
+ this.debugWarnLog(`Using Platform Config Logging: ${this.deviceLogging}`)
61
61
  } else {
62
62
  this.deviceLogging = this.accessory.context.logging = 'standard'
63
- await this.debugWarnLog(`Logging Not Set, Using: ${this.deviceLogging}`)
63
+ this.debugWarnLog(`Logging Not Set, Using: ${this.deviceLogging}`)
64
64
  }
65
65
  }
66
66
 
@@ -116,7 +116,7 @@ export abstract class irdeviceBase {
116
116
 
117
117
  const deviceFirmwareVersion = device.firmware ?? accessory.context.version ?? this.platform.version ?? '0.0.0'
118
118
  const version = deviceFirmwareVersion.toString()
119
- await this.debugLog(`version: ${version?.replace(/^V|-.*$/g, '')}`)
119
+ this.debugLog(`version: ${version?.replace(/^V|-.*$/g, '')}`)
120
120
  let deviceVersion: string
121
121
  if (version?.includes('.') === false) {
122
122
  const replace = version?.replace(/^V|-.*$/g, '')
@@ -158,19 +158,19 @@ export abstract class irdeviceBase {
158
158
  */
159
159
  async updateCharacteristic(Service: Service, Characteristic: any, CharacteristicValue: CharacteristicValue | undefined, CharacteristicName: string): Promise<void> {
160
160
  if (CharacteristicValue === undefined) {
161
- await this.debugLog(`${CharacteristicName}: ${CharacteristicValue}`)
161
+ this.debugLog(`${CharacteristicName}: ${CharacteristicValue}`)
162
162
  } else {
163
163
  Service.updateCharacteristic(Characteristic, CharacteristicValue)
164
- await this.debugLog(`updateCharacteristic ${CharacteristicName}: ${CharacteristicValue}`)
165
- await this.debugWarnLog(`${CharacteristicName} context before: ${this.accessory.context[CharacteristicName]}`)
164
+ this.debugLog(`updateCharacteristic ${CharacteristicName}: ${CharacteristicValue}`)
165
+ this.debugWarnLog(`${CharacteristicName} context before: ${this.accessory.context[CharacteristicName]}`)
166
166
  this.accessory.context[CharacteristicName] = CharacteristicValue
167
- await this.debugWarnLog(`${CharacteristicName} context after: ${this.accessory.context[CharacteristicName]}`)
167
+ this.debugWarnLog(`${CharacteristicName} context after: ${this.accessory.context[CharacteristicName]}`)
168
168
  }
169
169
  }
170
170
 
171
171
  async pushStatusCodes(deviceStatus: any) {
172
- await this.debugWarnLog(`deviceStatus: ${JSON.stringify(deviceStatus)}`)
173
- await this.debugWarnLog(`deviceStatus statusCode: ${deviceStatus.statusCode}`)
172
+ this.debugWarnLog(`deviceStatus: ${JSON.stringify(deviceStatus)}`)
173
+ this.debugWarnLog(`deviceStatus statusCode: ${deviceStatus.statusCode}`)
174
174
  }
175
175
 
176
176
  async successfulPushChange(deviceStatus: any, bodyChange: any) {
@@ -111,7 +111,7 @@ export class Light extends irdeviceBase {
111
111
  }
112
112
 
113
113
  async OnSet(value: CharacteristicValue): Promise<void> {
114
- await this.debugLog(`On: ${value}`)
114
+ this.debugLog(`On: ${value}`)
115
115
 
116
116
  this.LightBulb!.On = value
117
117
  if (this.LightBulb?.On) {
@@ -128,7 +128,7 @@ export class Light extends irdeviceBase {
128
128
  }
129
129
 
130
130
  async ProgrammableSwitchOutputStateSetOn(value: CharacteristicValue): Promise<void> {
131
- await this.debugLog(`On: ${value}`)
131
+ this.debugLog(`On: ${value}`)
132
132
 
133
133
  this.ProgrammableSwitchOn!.ProgrammableSwitchOutputState = value
134
134
  if (this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState === 1) {
@@ -142,7 +142,7 @@ export class Light extends irdeviceBase {
142
142
  }
143
143
 
144
144
  async ProgrammableSwitchOutputStateSetOff(value: CharacteristicValue): Promise<void> {
145
- await this.debugLog(`On: ${value}`)
145
+ this.debugLog(`On: ${value}`)
146
146
 
147
147
  this.ProgrammableSwitchOff!.ProgrammableSwitchOutputState = value
148
148
  if (this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState === 1) {
@@ -166,7 +166,7 @@ export class Light extends irdeviceBase {
166
166
  * Light - "command" "channelSub" "default" = previous channel
167
167
  */
168
168
  async pushLightOnChanges(On: boolean): Promise<void> {
169
- await this.debugLog(`pushLightOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}`)
169
+ this.debugLog(`pushLightOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}`)
170
170
  if (On === true && this.disablePushOn === false) {
171
171
  const commandType: string = await this.commandType()
172
172
  const command: string = await this.commandOn()
@@ -180,7 +180,7 @@ export class Light extends irdeviceBase {
180
180
  }
181
181
 
182
182
  async pushLightOffChanges(On: boolean): Promise<void> {
183
- await this.debugLog(`pushLightOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}`)
183
+ this.debugLog(`pushLightOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}`)
184
184
  if (On === false && this.disablePushOff === false) {
185
185
  const commandType: string = await this.commandType()
186
186
  const command: string = await this.commandOff()
@@ -196,10 +196,10 @@ export class Light extends irdeviceBase {
196
196
  async pushChanges(bodyChange: any, On: boolean): Promise<void> {
197
197
  this.debugLog('pushChanges')
198
198
  if (this.device.connectionType === 'OpenAPI') {
199
- await this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
199
+ this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
200
200
  try {
201
- const { body } = await this.pushChangeRequest(bodyChange)
202
- const deviceStatus: any = await body
201
+ const response = await this.pushChangeRequest(bodyChange)
202
+ const deviceStatus: any = response.body
203
203
  await this.pushStatusCodes(deviceStatus)
204
204
  if (await this.successfulStatusCodes(deviceStatus)) {
205
205
  await this.successfulPushChange(deviceStatus, bodyChange)
@@ -218,7 +218,7 @@ export class Light extends irdeviceBase {
218
218
  }
219
219
 
220
220
  async updateHomeKitCharacteristics(): Promise<void> {
221
- await this.debugLog('updateHomeKitCharacteristics')
221
+ this.debugLog('updateHomeKitCharacteristics')
222
222
  if (!(this.device as irLightConfig).stateless && this.LightBulb?.Service) {
223
223
  // On
224
224
  await this.updateCharacteristic(this.LightBulb.Service, this.hap.Characteristic.On, this.LightBulb.On, 'On')