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

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 (96) hide show
  1. package/dist/device/blindtilt.js +102 -102
  2. package/dist/device/blindtilt.js.map +1 -1
  3. package/dist/device/bot.js +85 -85
  4. package/dist/device/bot.js.map +1 -1
  5. package/dist/device/ceilinglight.js +98 -98
  6. package/dist/device/ceilinglight.js.map +1 -1
  7. package/dist/device/colorbulb.js +140 -140
  8. package/dist/device/colorbulb.js.map +1 -1
  9. package/dist/device/contact.js +44 -44
  10. package/dist/device/contact.js.map +1 -1
  11. package/dist/device/curtain.js +82 -82
  12. package/dist/device/curtain.js.map +1 -1
  13. package/dist/device/device.d.ts +11 -11
  14. package/dist/device/device.d.ts.map +1 -1
  15. package/dist/device/device.js +41 -41
  16. package/dist/device/device.js.map +1 -1
  17. package/dist/device/fan.js +96 -96
  18. package/dist/device/fan.js.map +1 -1
  19. package/dist/device/hub.js +43 -43
  20. package/dist/device/hub.js.map +1 -1
  21. package/dist/device/humidifier.js +84 -84
  22. package/dist/device/humidifier.js.map +1 -1
  23. package/dist/device/iosensor.js +44 -44
  24. package/dist/device/iosensor.js.map +1 -1
  25. package/dist/device/lightstrip.js +119 -119
  26. package/dist/device/lightstrip.js.map +1 -1
  27. package/dist/device/lock.js +75 -75
  28. package/dist/device/lock.js.map +1 -1
  29. package/dist/device/meter.js +44 -44
  30. package/dist/device/meter.js.map +1 -1
  31. package/dist/device/meterplus.js +42 -42
  32. package/dist/device/meterplus.js.map +1 -1
  33. package/dist/device/meterpro.js +42 -42
  34. package/dist/device/meterpro.js.map +1 -1
  35. package/dist/device/motion.js +42 -42
  36. package/dist/device/motion.js.map +1 -1
  37. package/dist/device/plug.js +60 -60
  38. package/dist/device/plug.js.map +1 -1
  39. package/dist/device/robotvacuumcleaner.js +74 -74
  40. package/dist/device/robotvacuumcleaner.js.map +1 -1
  41. package/dist/device/waterdetector.js +44 -44
  42. package/dist/device/waterdetector.js.map +1 -1
  43. package/dist/irdevice/airconditioner.js +31 -31
  44. package/dist/irdevice/airconditioner.js.map +1 -1
  45. package/dist/irdevice/airpurifier.js +10 -10
  46. package/dist/irdevice/airpurifier.js.map +1 -1
  47. package/dist/irdevice/camera.js +9 -9
  48. package/dist/irdevice/camera.js.map +1 -1
  49. package/dist/irdevice/fan.js +11 -11
  50. package/dist/irdevice/fan.js.map +1 -1
  51. package/dist/irdevice/irdevice.js +11 -11
  52. package/dist/irdevice/irdevice.js.map +1 -1
  53. package/dist/irdevice/light.js +9 -9
  54. package/dist/irdevice/light.js.map +1 -1
  55. package/dist/irdevice/other.js +55 -55
  56. package/dist/irdevice/other.js.map +1 -1
  57. package/dist/irdevice/tv.js +33 -33
  58. package/dist/irdevice/tv.js.map +1 -1
  59. package/dist/irdevice/vacuumcleaner.js +9 -9
  60. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  61. package/dist/irdevice/waterheater.js +9 -9
  62. package/dist/irdevice/waterheater.js.map +1 -1
  63. package/dist/platform.js +228 -228
  64. package/dist/platform.js.map +1 -1
  65. package/package.json +1 -1
  66. package/src/device/blindtilt.ts +102 -102
  67. package/src/device/bot.ts +85 -85
  68. package/src/device/ceilinglight.ts +98 -98
  69. package/src/device/colorbulb.ts +140 -140
  70. package/src/device/contact.ts +44 -44
  71. package/src/device/curtain.ts +82 -82
  72. package/src/device/device.ts +41 -41
  73. package/src/device/fan.ts +96 -96
  74. package/src/device/hub.ts +43 -43
  75. package/src/device/humidifier.ts +84 -84
  76. package/src/device/iosensor.ts +44 -44
  77. package/src/device/lightstrip.ts +119 -119
  78. package/src/device/lock.ts +75 -75
  79. package/src/device/meter.ts +44 -44
  80. package/src/device/meterplus.ts +42 -42
  81. package/src/device/meterpro.ts +42 -42
  82. package/src/device/motion.ts +42 -42
  83. package/src/device/plug.ts +60 -60
  84. package/src/device/robotvacuumcleaner.ts +74 -74
  85. package/src/device/waterdetector.ts +44 -44
  86. package/src/irdevice/airconditioner.ts +31 -31
  87. package/src/irdevice/airpurifier.ts +10 -10
  88. package/src/irdevice/camera.ts +9 -9
  89. package/src/irdevice/fan.ts +11 -11
  90. package/src/irdevice/irdevice.ts +11 -11
  91. package/src/irdevice/light.ts +9 -9
  92. package/src/irdevice/other.ts +55 -55
  93. package/src/irdevice/tv.ts +33 -33
  94. package/src/irdevice/vacuumcleaner.ts +9 -9
  95. package/src/irdevice/waterheater.ts +9 -9
  96. package/src/platform.ts +228 -228
@@ -144,7 +144,7 @@ export class ColorBulb extends deviceBase {
144
144
  }
145
145
  catch (e) {
146
146
  await this.apiError(e);
147
- await this.errorLog(`failed pushChanges with ${device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
147
+ this.errorLog(`failed pushChanges with ${device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
148
148
  }
149
149
  this.colorBulbUpdateInProgress = false;
150
150
  });
@@ -153,59 +153,59 @@ export class ColorBulb extends deviceBase {
153
153
  * Parse the device status from the SwitchBotBLE API
154
154
  */
155
155
  async BLEparseStatus() {
156
- await this.debugLog('BLEparseStatus');
156
+ this.debugLog('BLEparseStatus');
157
157
  // On
158
158
  this.LightBulb.On = this.serviceData.power;
159
- await this.debugLog(`On: ${this.LightBulb.On}`);
159
+ this.debugLog(`On: ${this.LightBulb.On}`);
160
160
  // Brightness
161
161
  this.LightBulb.Brightness = this.serviceData.brightness;
162
- await this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
162
+ this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
163
163
  // Color, Hue & Brightness
164
- await this.debugLog(`red: ${this.serviceData.red}, green: ${this.serviceData.green}, blue: ${this.serviceData.blue}`);
164
+ this.debugLog(`red: ${this.serviceData.red}, green: ${this.serviceData.green}, blue: ${this.serviceData.blue}`);
165
165
  const [hue, saturation] = rgb2hs(this.serviceData.red, this.serviceData.green, this.serviceData.blue);
166
- await this.debugLog(`hs: ${JSON.stringify(rgb2hs(this.serviceData.red, this.serviceData.green, this.serviceData.blue))}`);
166
+ this.debugLog(`hs: ${JSON.stringify(rgb2hs(this.serviceData.red, this.serviceData.green, this.serviceData.blue))}`);
167
167
  // Hue
168
168
  this.LightBulb.Hue = hue;
169
- await this.debugLog(`Hue: ${this.LightBulb.Hue}`);
169
+ this.debugLog(`Hue: ${this.LightBulb.Hue}`);
170
170
  // Saturation
171
171
  this.LightBulb.Saturation = saturation;
172
- await this.debugLog(`Saturation: ${this.LightBulb.Saturation}`);
172
+ this.debugLog(`Saturation: ${this.LightBulb.Saturation}`);
173
173
  // ColorTemperature
174
174
  const miredColorTemperature = Math.round(1000000 / this.serviceData.color_temperature);
175
175
  this.LightBulb.ColorTemperature = Math.max(Math.min(miredColorTemperature, 500), 140);
176
- await this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
176
+ this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
177
177
  }
178
178
  /**
179
179
  * Parse the device status from the SwitchBot OpenAPI
180
180
  */
181
181
  async openAPIparseStatus() {
182
- await this.debugLog('openAPIparseStatus');
182
+ this.debugLog('openAPIparseStatus');
183
183
  // On
184
184
  this.LightBulb.On = this.deviceStatus.power === 'on';
185
- await this.debugLog(`On: ${this.LightBulb.On}`);
185
+ this.debugLog(`On: ${this.LightBulb.On}`);
186
186
  // Brightness
187
187
  this.LightBulb.Brightness = this.deviceStatus.brightness;
188
- await this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
188
+ this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
189
189
  // Color, Hue & Brightness
190
- await this.debugLog(`color: ${JSON.stringify(this.deviceStatus.color)}`);
190
+ this.debugLog(`color: ${JSON.stringify(this.deviceStatus.color)}`);
191
191
  const [red, green, blue] = this.deviceStatus.color.split(':');
192
- await this.debugLog(`red: ${JSON.stringify(red)}, green: ${JSON.stringify(green)}, blue: ${JSON.stringify(blue)}`);
192
+ this.debugLog(`red: ${JSON.stringify(red)}, green: ${JSON.stringify(green)}, blue: ${JSON.stringify(blue)}`);
193
193
  const [hue, saturation] = rgb2hs(red, green, blue);
194
- await this.debugLog(`hs: ${JSON.stringify(rgb2hs(red, green, blue))}`);
194
+ this.debugLog(`hs: ${JSON.stringify(rgb2hs(red, green, blue))}`);
195
195
  // Hue
196
196
  this.LightBulb.Hue = hue;
197
- await this.debugLog(`Hue: ${this.LightBulb.Hue}`);
197
+ this.debugLog(`Hue: ${this.LightBulb.Hue}`);
198
198
  // Saturation
199
199
  this.LightBulb.Saturation = saturation;
200
- await this.debugLog(`Saturation: ${this.LightBulb.Saturation}`);
200
+ this.debugLog(`Saturation: ${this.LightBulb.Saturation}`);
201
201
  // ColorTemperature
202
202
  const miredColorTemperature = Math.round(1000000 / this.deviceStatus.colorTemperature);
203
203
  this.LightBulb.ColorTemperature = Math.max(Math.min(miredColorTemperature, 500), 140);
204
- await this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
204
+ this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
205
205
  // Firmware Version
206
206
  if (this.deviceStatus.version) {
207
207
  const version = this.deviceStatus.version.toString();
208
- await this.debugLog(`Firmware Version: ${version.replace(/^V|-.*$/g, '')}`);
208
+ this.debugLog(`Firmware Version: ${version.replace(/^V|-.*$/g, '')}`);
209
209
  const deviceVersion = version.replace(/^V|-.*$/g, '') ?? '0.0.0';
210
210
  this.accessory
211
211
  .getService(this.hap.Service.AccessoryInformation)
@@ -214,41 +214,41 @@ export class ColorBulb extends deviceBase {
214
214
  .getCharacteristic(this.hap.Characteristic.FirmwareRevision)
215
215
  .updateValue(deviceVersion);
216
216
  this.accessory.context.version = deviceVersion;
217
- await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
217
+ this.debugSuccessLog(`version: ${this.accessory.context.version}`);
218
218
  }
219
219
  }
220
220
  async parseStatusWebhook() {
221
- await this.debugLog('parseStatusWebhook');
222
- await this.debugLog(`(powerState, brightness, color, colorTemperature) = Webhook:(${this.webhookContext.powerState}, ${this.webhookContext.brightness}, ${this.webhookContext.color}, ${this.webhookContext.colorTemperature}), current:(${this.LightBulb.On}, ${this.LightBulb.Brightness}, ${this.LightBulb.Hue}, ${this.LightBulb.Saturation}, ${this.LightBulb.ColorTemperature})`);
221
+ this.debugLog('parseStatusWebhook');
222
+ this.debugLog(`(powerState, brightness, color, colorTemperature) = Webhook:(${this.webhookContext.powerState}, ${this.webhookContext.brightness}, ${this.webhookContext.color}, ${this.webhookContext.colorTemperature}), current:(${this.LightBulb.On}, ${this.LightBulb.Brightness}, ${this.LightBulb.Hue}, ${this.LightBulb.Saturation}, ${this.LightBulb.ColorTemperature})`);
223
223
  // On
224
224
  this.LightBulb.On = this.webhookContext.powerState === 'ON';
225
- await this.debugLog(`On: ${this.LightBulb.On}`);
225
+ this.debugLog(`On: ${this.LightBulb.On}`);
226
226
  // Brightness
227
227
  this.LightBulb.Brightness = this.webhookContext.brightness;
228
- await this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
228
+ this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
229
229
  // Color, Hue & Brightness
230
- await this.debugLog(`color: ${JSON.stringify(this.webhookContext.color)}`);
230
+ this.debugLog(`color: ${JSON.stringify(this.webhookContext.color)}`);
231
231
  const [red, green, blue] = this.webhookContext.color.split(':');
232
- await this.debugLog(`red: ${JSON.stringify(red)}, green: ${JSON.stringify(green)}, blue: ${JSON.stringify(blue)}`);
232
+ this.debugLog(`red: ${JSON.stringify(red)}, green: ${JSON.stringify(green)}, blue: ${JSON.stringify(blue)}`);
233
233
  const [hue, saturation] = rgb2hs(red, green, blue);
234
- await this.debugLog(`hs: ${JSON.stringify(rgb2hs(red, green, blue))}`);
234
+ this.debugLog(`hs: ${JSON.stringify(rgb2hs(red, green, blue))}`);
235
235
  // Hue
236
236
  this.LightBulb.Hue = hue;
237
- await this.debugLog(`Hue: ${this.LightBulb.Hue}`);
237
+ this.debugLog(`Hue: ${this.LightBulb.Hue}`);
238
238
  // Saturation
239
239
  this.LightBulb.Saturation = saturation;
240
- await this.debugLog(`Saturation: ${this.LightBulb.Saturation}`);
240
+ this.debugLog(`Saturation: ${this.LightBulb.Saturation}`);
241
241
  // ColorTemperature
242
242
  const miredColorTemperature = Math.round(1000000 / this.webhookContext.colorTemperature);
243
243
  this.LightBulb.ColorTemperature = Math.max(Math.min(miredColorTemperature, 500), 140);
244
- await this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
244
+ this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
245
245
  }
246
246
  /**
247
247
  * Asks the SwitchBot API for the latest device information
248
248
  */
249
249
  async refreshStatus() {
250
250
  if (!this.device.enableCloudService && this.OpenAPI) {
251
- await this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`);
251
+ this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`);
252
252
  }
253
253
  else if (this.BLE) {
254
254
  await this.BLERefreshStatus();
@@ -258,11 +258,11 @@ export class ColorBulb extends deviceBase {
258
258
  }
259
259
  else {
260
260
  await this.offlineOff();
261
- await this.debugWarnLog(`Connection Type: ${this.device.connectionType}, refreshStatus will not happen.`);
261
+ this.debugWarnLog(`Connection Type: ${this.device.connectionType}, refreshStatus will not happen.`);
262
262
  }
263
263
  }
264
264
  async BLERefreshStatus() {
265
- await this.debugLog('BLERefreshStatus');
265
+ this.debugLog('BLERefreshStatus');
266
266
  const switchBotBLE = await this.switchbotBLE();
267
267
  if (switchBotBLE === undefined) {
268
268
  await this.BLERefreshConnection(switchBotBLE);
@@ -279,79 +279,79 @@ export class ColorBulb extends deviceBase {
279
279
  await this.updateHomeKitCharacteristics();
280
280
  }
281
281
  else {
282
- await this.errorLog(`failed to get serviceData, serviceData: ${JSON.stringify(serviceData)}`);
282
+ this.errorLog(`failed to get serviceData, serviceData: ${JSON.stringify(serviceData)}`);
283
283
  await this.BLERefreshConnection(switchBotBLE);
284
284
  }
285
285
  })();
286
286
  }
287
287
  }
288
288
  async registerPlatformBLE() {
289
- await this.debugLog('registerPlatformBLE');
289
+ this.debugLog('registerPlatformBLE');
290
290
  if (this.config.options?.BLE) {
291
- await this.debugLog('is listening to Platform BLE.');
291
+ this.debugLog('is listening to Platform BLE.');
292
292
  try {
293
293
  const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId);
294
294
  this.device.bleMac = formattedDeviceId;
295
- await this.debugLog(`bleMac: ${this.device.bleMac}`);
295
+ this.debugLog(`bleMac: ${this.device.bleMac}`);
296
296
  this.platform.bleEventHandler[this.device.bleMac] = async (context) => {
297
297
  try {
298
- await this.debugLog(`received BLE: ${JSON.stringify(context)}`);
298
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`);
299
299
  this.serviceData = context;
300
300
  await this.BLEparseStatus();
301
301
  await this.updateHomeKitCharacteristics();
302
302
  }
303
303
  catch (e) {
304
- await this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`);
304
+ this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`);
305
305
  }
306
306
  };
307
307
  }
308
308
  catch (error) {
309
- await this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
309
+ this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
310
310
  }
311
311
  }
312
312
  else {
313
- await this.debugLog('is not listening to Platform BLE');
313
+ this.debugLog('is not listening to Platform BLE');
314
314
  }
315
315
  }
316
316
  async openAPIRefreshStatus() {
317
- await this.debugLog('openAPIRefreshStatus');
317
+ this.debugLog('openAPIRefreshStatus');
318
318
  try {
319
- const { body } = await this.deviceRefreshStatus();
320
- const deviceStatus = await body;
321
- await this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
319
+ const response = await this.deviceRefreshStatus();
320
+ const deviceStatus = response.body;
321
+ this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
322
322
  if (await this.successfulStatusCodes(deviceStatus)) {
323
- await this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
323
+ this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
324
324
  this.deviceStatus = deviceStatus.body;
325
325
  await this.openAPIparseStatus();
326
326
  await this.updateHomeKitCharacteristics();
327
327
  }
328
328
  else {
329
- await this.debugWarnLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
330
- await this.debugWarnLog(deviceStatus);
329
+ this.debugWarnLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
330
+ this.debugWarnLog(deviceStatus);
331
331
  }
332
332
  }
333
333
  catch (e) {
334
334
  await this.apiError(e);
335
- await this.errorLog(`failed openAPIRefreshStatus with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
335
+ this.errorLog(`failed openAPIRefreshStatus with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
336
336
  }
337
337
  }
338
338
  async registerWebhook() {
339
339
  if (this.device.webhook) {
340
- await this.debugLog('is listening webhook.');
340
+ this.debugLog('is listening webhook.');
341
341
  this.platform.webhookEventHandler[this.device.deviceId] = async (context) => {
342
342
  try {
343
- await this.debugLog(`received Webhook: ${JSON.stringify(context)}`);
343
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`);
344
344
  this.webhookContext = context;
345
345
  await this.parseStatusWebhook();
346
346
  await this.updateHomeKitCharacteristics();
347
347
  }
348
348
  catch (e) {
349
- await this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`);
349
+ this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`);
350
350
  }
351
351
  };
352
352
  }
353
353
  else {
354
- await this.debugLog('is not listening webhook.');
354
+ this.debugLog('is not listening webhook.');
355
355
  }
356
356
  }
357
357
  /**
@@ -367,45 +367,45 @@ export class ColorBulb extends deviceBase {
367
367
  */
368
368
  async pushChanges() {
369
369
  if (!this.device.enableCloudService && this.OpenAPI) {
370
- await this.errorLog(`pushChanges enableCloudService: ${this.device.enableCloudService}`);
370
+ this.errorLog(`pushChanges enableCloudService: ${this.device.enableCloudService}`);
371
371
  }
372
372
  else if (this.BLE) {
373
373
  await this.BLEpushChanges();
374
374
  if (this.LightBulb.On) {
375
375
  // Push Brightness Update
376
- await this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
376
+ this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
377
377
  await this.BLEpushBrightnessChanges();
378
378
  // Push ColorTemperature Update
379
- await this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
379
+ this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
380
380
  await this.BLEpushColorTemperatureChanges();
381
381
  // Push Hue & Saturation Update
382
- await this.debugLog(`Hue: ${this.LightBulb.Hue}, Saturation: ${this.LightBulb.Saturation}`);
382
+ this.debugLog(`Hue: ${this.LightBulb.Hue}, Saturation: ${this.LightBulb.Saturation}`);
383
383
  await this.BLEpushRGBChanges();
384
384
  }
385
385
  else {
386
- await this.debugLog('BLE (Brightness), (ColorTemperature), (Hue), & (Saturation) changes will not happen, as the device is OFF.');
386
+ this.debugLog('BLE (Brightness), (ColorTemperature), (Hue), & (Saturation) changes will not happen, as the device is OFF.');
387
387
  }
388
388
  }
389
389
  else if (this.OpenAPI && this.platform.config.credentials?.token) {
390
390
  await this.openAPIpushChanges();
391
391
  if (this.LightBulb.On) {
392
392
  // Push Brightness Update
393
- await this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
393
+ this.debugLog(`Brightness: ${this.LightBulb.Brightness}`);
394
394
  await this.pushBrightnessChanges();
395
395
  // Push ColorTemperature Update
396
- await this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
396
+ this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
397
397
  await this.pushColorTemperatureChanges();
398
398
  // Push Hue & Saturation Update
399
- await this.debugLog(`Hue: ${this.LightBulb.Hue}, Saturation: ${this.LightBulb.Saturation}`);
399
+ this.debugLog(`Hue: ${this.LightBulb.Hue}, Saturation: ${this.LightBulb.Saturation}`);
400
400
  await this.pushHueSaturationChanges();
401
401
  }
402
402
  else {
403
- await this.debugLog('openAPI (Brightness), (ColorTemperature), (Hue), & (Saturation) changes will not happen, as the device is OFF.');
403
+ this.debugLog('openAPI (Brightness), (ColorTemperature), (Hue), & (Saturation) changes will not happen, as the device is OFF.');
404
404
  }
405
405
  }
406
406
  else {
407
407
  await this.offlineOff();
408
- await this.debugWarnLog(`Connection Type: ${this.device.connectionType}, pushChanges will not happen.`);
408
+ this.debugWarnLog(`Connection Type: ${this.device.connectionType}, pushChanges will not happen.`);
409
409
  }
410
410
  // Refresh the status from the API
411
411
  interval(15000)
@@ -416,21 +416,21 @@ export class ColorBulb extends deviceBase {
416
416
  });
417
417
  }
418
418
  async BLEpushChanges() {
419
- await this.debugLog('BLEpushChanges');
419
+ this.debugLog('BLEpushChanges');
420
420
  if (this.LightBulb.On !== this.accessory.context.On) {
421
- await this.debugLog(`BLEpushChanges On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`);
421
+ this.debugLog(`BLEpushChanges On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`);
422
422
  const switchBotBLE = await this.platform.connectBLE(this.accessory, this.device);
423
423
  try {
424
424
  const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId);
425
425
  this.device.bleMac = formattedDeviceId;
426
- await this.debugLog(`bleMac: ${this.device.bleMac}`);
426
+ this.debugLog(`bleMac: ${this.device.bleMac}`);
427
427
  if (switchBotBLE !== false) {
428
428
  switchBotBLE
429
429
  .discover({ model: this.device.bleModel, id: this.device.bleMac })
430
430
  .then(async (device_list) => {
431
- await this.infoLog(`On: ${this.LightBulb.On}`);
431
+ this.infoLog(`On: ${this.LightBulb.On}`);
432
432
  return await this.retryBLE({
433
- max: await this.maxRetryBLE(),
433
+ max: this.maxRetryBLE(),
434
434
  fn: async () => {
435
435
  if (this.LightBulb.On) {
436
436
  return await device_list[0].turnOn();
@@ -442,69 +442,69 @@ export class ColorBulb extends deviceBase {
442
442
  });
443
443
  })
444
444
  .then(async () => {
445
- await this.successLog(`On: ${this.LightBulb.On} sent over SwitchBot BLE, sent successfully`);
445
+ this.successLog(`On: ${this.LightBulb.On} sent over SwitchBot BLE, sent successfully`);
446
446
  await this.updateHomeKitCharacteristics();
447
447
  })
448
448
  .catch(async (e) => {
449
449
  await this.apiError(e);
450
- await this.errorLog(`failed BLEpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
450
+ this.errorLog(`failed BLEpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
451
451
  await this.BLEPushConnection();
452
452
  });
453
453
  }
454
454
  else {
455
- await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`);
455
+ this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`);
456
456
  await this.BLEPushConnection();
457
457
  }
458
458
  }
459
459
  catch (error) {
460
- await this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
460
+ this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
461
461
  }
462
462
  }
463
463
  else {
464
- await this.debugLog(`No changes (BLEpushChanges), On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`);
464
+ this.debugLog(`No changes (BLEpushChanges), On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`);
465
465
  }
466
466
  }
467
467
  async BLEpushBrightnessChanges() {
468
- await this.debugLog('BLEpushBrightnessChanges');
468
+ this.debugLog('BLEpushBrightnessChanges');
469
469
  if (this.LightBulb.Brightness !== this.accessory.context.Brightness) {
470
470
  const switchBotBLE = await this.platform.connectBLE(this.accessory, this.device);
471
471
  try {
472
472
  const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId);
473
473
  this.device.bleMac = formattedDeviceId;
474
- await this.debugLog(`bleMac: ${this.device.bleMac}`);
474
+ this.debugLog(`bleMac: ${this.device.bleMac}`);
475
475
  if (switchBotBLE !== false) {
476
476
  switchBotBLE
477
477
  .discover({ model: this.device.bleModel, id: this.device.bleMac })
478
478
  .then(async (device_list) => {
479
479
  const deviceList = device_list;
480
- await this.infoLog(`Target Brightness: ${this.LightBulb.Brightness}`);
480
+ this.infoLog(`Target Brightness: ${this.LightBulb.Brightness}`);
481
481
  return await deviceList[0].setBrightness(Number(this.LightBulb.Brightness));
482
482
  })
483
483
  .then(async () => {
484
- await this.successLog(`Brightness: ${this.LightBulb.Brightness} sent over SwitchBot BLE, sent successfully`);
484
+ this.successLog(`Brightness: ${this.LightBulb.Brightness} sent over SwitchBot BLE, sent successfully`);
485
485
  await this.updateHomeKitCharacteristics();
486
486
  })
487
487
  .catch(async (e) => {
488
488
  await this.apiError(e);
489
- await this.errorLog(`failed BLEpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
489
+ this.errorLog(`failed BLEpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
490
490
  await this.BLEPushConnection();
491
491
  });
492
492
  }
493
493
  else {
494
- await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`);
494
+ this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`);
495
495
  await this.BLEPushConnection();
496
496
  }
497
497
  }
498
498
  catch (error) {
499
- await this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
499
+ this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
500
500
  }
501
501
  }
502
502
  else {
503
- await this.debugLog(`No changes (BLEpushBrightnessChanges), Brightness: ${this.LightBulb.Brightness}, BrightnessCached: ${this.accessory.context.Brightness}`);
503
+ this.debugLog(`No changes (BLEpushBrightnessChanges), Brightness: ${this.LightBulb.Brightness}, BrightnessCached: ${this.accessory.context.Brightness}`);
504
504
  }
505
505
  }
506
506
  async BLEpushColorTemperatureChanges() {
507
- await this.debugLog('BLEpushColorTemperatureChanges');
507
+ this.debugLog('BLEpushColorTemperatureChanges');
508
508
  if (this.LightBulb.ColorTemperature !== this.accessory.context.ColorTemperature) {
509
509
  const kelvin = Math.round(1000000 / Number(this.LightBulb.ColorTemperature));
510
510
  this.accessory.context.kelvin = kelvin;
@@ -512,82 +512,82 @@ export class ColorBulb extends deviceBase {
512
512
  try {
513
513
  const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId);
514
514
  this.device.bleMac = formattedDeviceId;
515
- await this.debugLog(`bleMac: ${this.device.bleMac}`);
515
+ this.debugLog(`bleMac: ${this.device.bleMac}`);
516
516
  if (switchBotBLE !== false) {
517
517
  switchBotBLE
518
518
  .discover({ model: this.device.bleModel, id: this.device.bleMac })
519
519
  .then(async (device_list) => {
520
520
  const deviceList = device_list;
521
- await this.infoLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
521
+ this.infoLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`);
522
522
  return await deviceList[0].setColorTemperature(kelvin);
523
523
  })
524
524
  .then(async () => {
525
- await this.successLog(`ColorTemperature: ${this.LightBulb.ColorTemperature} sent over SwitchBot BLE, sent successfully`);
525
+ this.successLog(`ColorTemperature: ${this.LightBulb.ColorTemperature} sent over SwitchBot BLE, sent successfully`);
526
526
  await this.updateHomeKitCharacteristics();
527
527
  })
528
528
  .catch(async (e) => {
529
529
  await this.apiError(e);
530
- await this.errorLog(`failed BLEpushRGBChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
530
+ this.errorLog(`failed BLEpushRGBChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
531
531
  await this.BLEPushConnection();
532
532
  });
533
533
  }
534
534
  else {
535
- await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`);
535
+ this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`);
536
536
  await this.BLEPushConnection();
537
537
  }
538
538
  }
539
539
  catch (error) {
540
- await this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
540
+ this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
541
541
  }
542
542
  }
543
543
  else {
544
- await this.debugLog(`No changes (BLEpushColorTemperatureChanges), ColorTemperature: ${this.LightBulb.ColorTemperature}, ColorTemperatureCached: ${this.accessory.context.ColorTemperature}`);
544
+ this.debugLog(`No changes (BLEpushColorTemperatureChanges), ColorTemperature: ${this.LightBulb.ColorTemperature}, ColorTemperatureCached: ${this.accessory.context.ColorTemperature}`);
545
545
  }
546
546
  }
547
547
  async BLEpushRGBChanges() {
548
- await this.debugLog('BLEpushRGBChanges');
548
+ this.debugLog('BLEpushRGBChanges');
549
549
  if ((this.LightBulb.Hue !== this.accessory.context.Hue) || (this.LightBulb.Saturation !== this.accessory.context.Saturation)) {
550
- await this.debugLog(`Hue: ${JSON.stringify(this.LightBulb.Hue)}, Saturation: ${JSON.stringify(this.LightBulb.Saturation)}`);
550
+ this.debugLog(`Hue: ${JSON.stringify(this.LightBulb.Hue)}, Saturation: ${JSON.stringify(this.LightBulb.Saturation)}`);
551
551
  const [red, green, blue] = hs2rgb(this.LightBulb.Hue, this.LightBulb.Saturation);
552
- await this.debugLog(`rgb: ${JSON.stringify([red, green, blue])}`);
552
+ this.debugLog(`rgb: ${JSON.stringify([red, green, blue])}`);
553
553
  const switchBotBLE = await this.platform.connectBLE(this.accessory, this.device);
554
554
  try {
555
555
  const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId);
556
556
  this.device.bleMac = formattedDeviceId;
557
- await this.debugLog(`bleMac: ${this.device.bleMac}`);
557
+ this.debugLog(`bleMac: ${this.device.bleMac}`);
558
558
  if (switchBotBLE !== false) {
559
559
  switchBotBLE
560
560
  .discover({ model: this.device.bleModel, id: this.device.bleMac })
561
561
  .then(async (device_list) => {
562
562
  const deviceList = device_list;
563
- await this.infoLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)}`);
563
+ this.infoLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)}`);
564
564
  return await deviceList[0].setRGB(Number(this.LightBulb.Brightness), red, green, blue);
565
565
  })
566
566
  .then(async () => {
567
- await this.successLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)} sent over SwitchBot BLE, sent successfully`);
567
+ this.successLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)} sent over SwitchBot BLE, sent successfully`);
568
568
  await this.updateHomeKitCharacteristics();
569
569
  })
570
570
  .catch(async (e) => {
571
571
  await this.apiError(e);
572
- await this.errorLog(`failed BLEpushRGBChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
572
+ this.errorLog(`failed BLEpushRGBChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
573
573
  await this.BLEPushConnection();
574
574
  });
575
575
  }
576
576
  else {
577
- await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`);
577
+ this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`);
578
578
  await this.BLEPushConnection();
579
579
  }
580
580
  }
581
581
  catch (error) {
582
- await this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
582
+ this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
583
583
  }
584
584
  }
585
585
  else {
586
- await this.debugLog(`No changes (BLEpushRGBChanges), Hue: ${this.LightBulb.Hue}, HueCached: ${this.accessory.context.Hue}, Saturation: ${this.LightBulb.Saturation}, SaturationCached: ${this.accessory.context.Saturation}`);
586
+ this.debugLog(`No changes (BLEpushRGBChanges), Hue: ${this.LightBulb.Hue}, HueCached: ${this.accessory.context.Hue}, Saturation: ${this.LightBulb.Saturation}, SaturationCached: ${this.accessory.context.Saturation}`);
587
587
  }
588
588
  }
589
589
  async openAPIpushChanges() {
590
- await this.debugLog('openAPIpushChanges');
590
+ this.debugLog('openAPIpushChanges');
591
591
  if (this.LightBulb.On !== this.accessory.context.On) {
592
592
  const command = this.LightBulb.On ? 'turnOn' : 'turnOff';
593
593
  const bodyChange = {
@@ -595,13 +595,13 @@ export class ColorBulb extends deviceBase {
595
595
  parameter: 'default',
596
596
  commandType: 'command',
597
597
  };
598
- await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`);
598
+ this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`);
599
599
  try {
600
- const { body } = await this.pushChangeRequest(bodyChange);
601
- const deviceStatus = await body;
602
- await this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
600
+ const response = await this.pushChangeRequest(bodyChange);
601
+ const deviceStatus = response.body;
602
+ this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
603
603
  if (await this.successfulStatusCodes(deviceStatus)) {
604
- await this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
604
+ this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
605
605
  await this.updateHomeKitCharacteristics();
606
606
  }
607
607
  else {
@@ -610,31 +610,31 @@ export class ColorBulb extends deviceBase {
610
610
  }
611
611
  catch (e) {
612
612
  await this.apiError(e);
613
- await this.errorLog(`failed openAPIpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
613
+ this.errorLog(`failed openAPIpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
614
614
  }
615
615
  }
616
616
  else {
617
- await this.debugLog(`No changes (openAPIpushChanges), On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`);
617
+ this.debugLog(`No changes (openAPIpushChanges), On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`);
618
618
  }
619
619
  }
620
620
  async pushHueSaturationChanges() {
621
- await this.debugLog('pushHueSaturationChanges');
621
+ this.debugLog('pushHueSaturationChanges');
622
622
  if ((this.LightBulb.Hue !== this.accessory.context.Hue) || (this.LightBulb.Saturation !== this.accessory.context.Saturation)) {
623
- await this.debugLog(`Hue: ${JSON.stringify(this.LightBulb.Hue)}, Saturation: ${JSON.stringify(this.LightBulb.Saturation)}`);
623
+ this.debugLog(`Hue: ${JSON.stringify(this.LightBulb.Hue)}, Saturation: ${JSON.stringify(this.LightBulb.Saturation)}`);
624
624
  const [red, green, blue] = hs2rgb(this.LightBulb.Hue, this.LightBulb.Saturation);
625
- await this.debugLog(`rgb: ${JSON.stringify([red, green, blue])}`);
625
+ this.debugLog(`rgb: ${JSON.stringify([red, green, blue])}`);
626
626
  const bodyChange = {
627
627
  command: 'setColor',
628
628
  parameter: `${red}:${green}:${blue}`,
629
629
  commandType: 'command',
630
630
  };
631
- await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`);
631
+ this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`);
632
632
  try {
633
- const { body } = await this.pushChangeRequest(bodyChange);
634
- const deviceStatus = await body;
635
- await this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
633
+ const response = await this.pushChangeRequest(bodyChange);
634
+ const deviceStatus = response.body;
635
+ this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
636
636
  if (await this.successfulStatusCodes(deviceStatus)) {
637
- await this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
637
+ this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
638
638
  await this.updateHomeKitCharacteristics();
639
639
  }
640
640
  else {
@@ -643,15 +643,15 @@ export class ColorBulb extends deviceBase {
643
643
  }
644
644
  catch (e) {
645
645
  await this.apiError(e);
646
- await this.errorLog(`failed pushHueSaturationChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
646
+ this.errorLog(`failed pushHueSaturationChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
647
647
  }
648
648
  }
649
649
  else {
650
- await this.debugLog(`No changes (pushHueSaturationChanges), Hue: ${this.LightBulb.Hue}, HueCached: ${this.accessory.context.Hue}, Saturation: ${this.LightBulb.Saturation}, SaturationCached: ${this.accessory.context.Saturation}`);
650
+ this.debugLog(`No changes (pushHueSaturationChanges), Hue: ${this.LightBulb.Hue}, HueCached: ${this.accessory.context.Hue}, Saturation: ${this.LightBulb.Saturation}, SaturationCached: ${this.accessory.context.Saturation}`);
651
651
  }
652
652
  }
653
653
  async pushColorTemperatureChanges() {
654
- await this.debugLog('pushColorTemperatureChanges');
654
+ this.debugLog('pushColorTemperatureChanges');
655
655
  if (this.LightBulb.ColorTemperature !== this.accessory.context.ColorTemperature) {
656
656
  const kelvin = Math.round(1000000 / Number(this.LightBulb.ColorTemperature));
657
657
  this.accessory.context.kelvin = kelvin;
@@ -660,13 +660,13 @@ export class ColorBulb extends deviceBase {
660
660
  parameter: `${kelvin}`,
661
661
  commandType: 'command',
662
662
  };
663
- await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`);
663
+ this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`);
664
664
  try {
665
- const { body } = await this.pushChangeRequest(bodyChange);
666
- const deviceStatus = await body;
667
- await this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
665
+ const response = await this.pushChangeRequest(bodyChange);
666
+ const deviceStatus = response.body;
667
+ this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
668
668
  if (await this.successfulStatusCodes(deviceStatus)) {
669
- await this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
669
+ this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
670
670
  await this.updateHomeKitCharacteristics();
671
671
  }
672
672
  else {
@@ -675,28 +675,28 @@ export class ColorBulb extends deviceBase {
675
675
  }
676
676
  catch (e) {
677
677
  await this.apiError(e);
678
- await this.errorLog(`failed pushColorTemperatureChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
678
+ this.errorLog(`failed pushColorTemperatureChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
679
679
  }
680
680
  }
681
681
  else {
682
- await this.debugLog(`No changes (pushColorTemperatureChanges), ColorTemperature: ${this.LightBulb.ColorTemperature}, ColorTemperatureCached: ${this.accessory.context.ColorTemperature}`);
682
+ this.debugLog(`No changes (pushColorTemperatureChanges), ColorTemperature: ${this.LightBulb.ColorTemperature}, ColorTemperatureCached: ${this.accessory.context.ColorTemperature}`);
683
683
  }
684
684
  }
685
685
  async pushBrightnessChanges() {
686
- await this.debugLog('pushBrightnessChanges');
686
+ this.debugLog('pushBrightnessChanges');
687
687
  if (this.LightBulb.Brightness !== this.accessory.context.Brightness) {
688
688
  const bodyChange = {
689
689
  command: 'setBrightness',
690
690
  parameter: `${this.LightBulb.Brightness}`,
691
691
  commandType: 'command',
692
692
  };
693
- await this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`);
693
+ this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`);
694
694
  try {
695
- const { body } = await this.pushChangeRequest(bodyChange);
696
- const deviceStatus = await body;
697
- await this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
695
+ const response = await this.pushChangeRequest(bodyChange);
696
+ const deviceStatus = response.body;
697
+ this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
698
698
  if (await this.successfulStatusCodes(deviceStatus)) {
699
- await this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
699
+ this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
700
700
  await this.updateHomeKitCharacteristics();
701
701
  }
702
702
  else {
@@ -705,11 +705,11 @@ export class ColorBulb extends deviceBase {
705
705
  }
706
706
  catch (e) {
707
707
  await this.apiError(e);
708
- await this.errorLog(`failed pushBrightnessChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
708
+ this.errorLog(`failed pushBrightnessChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
709
709
  }
710
710
  }
711
711
  else {
712
- await this.debugLog(`No changes (pushBrightnessChanges), Brightness: ${this.LightBulb.Brightness}, BrightnessCached: ${this.accessory.context.Brightness}`);
712
+ this.debugLog(`No changes (pushBrightnessChanges), Brightness: ${this.LightBulb.Brightness}, BrightnessCached: ${this.accessory.context.Brightness}`);
713
713
  }
714
714
  }
715
715
  /**
@@ -717,10 +717,10 @@ export class ColorBulb extends deviceBase {
717
717
  */
718
718
  async OnSet(value) {
719
719
  if (this.LightBulb.On !== this.accessory.context.On) {
720
- await this.infoLog(`Set On: ${value}`);
720
+ this.infoLog(`Set On: ${value}`);
721
721
  }
722
722
  else {
723
- await this.debugLog(`No Changes, On: ${value}`);
723
+ this.debugLog(`No Changes, On: ${value}`);
724
724
  }
725
725
  this.LightBulb.On = value;
726
726
  this.doColorBulbUpdate.next();
@@ -730,7 +730,7 @@ export class ColorBulb extends deviceBase {
730
730
  */
731
731
  async BrightnessSet(value) {
732
732
  if (this.LightBulb.On && (this.LightBulb.Brightness !== this.accessory.context.Brightness)) {
733
- await this.infoLog(`Set Brightness: ${value}`);
733
+ this.infoLog(`Set Brightness: ${value}`);
734
734
  }
735
735
  else {
736
736
  if (this.LightBulb.On) {
@@ -827,21 +827,21 @@ export class ColorBulb extends deviceBase {
827
827
  async getAdaptiveLightingSettings(accessory, device) {
828
828
  // Adaptive Lighting
829
829
  this.adaptiveLighting = accessory.context.adaptiveLighting ?? true;
830
- await this.debugLog(`adaptiveLighting: ${this.adaptiveLighting}`);
830
+ this.debugLog(`adaptiveLighting: ${this.adaptiveLighting}`);
831
831
  // Adaptive Lighting Shift
832
832
  this.adaptiveLightingShift = device.adaptiveLightingShift ?? 0;
833
833
  this.debugLog(`adaptiveLightingShift: ${this.adaptiveLightingShift}`);
834
834
  }
835
835
  async BLEPushConnection() {
836
836
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
837
- await this.warnLog('Using OpenAPI Connection to Push Changes');
837
+ this.warnLog('Using OpenAPI Connection to Push Changes');
838
838
  await this.openAPIpushChanges();
839
839
  }
840
840
  }
841
841
  async BLERefreshConnection(switchbot) {
842
- await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
842
+ this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
843
843
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
844
- await this.warnLog('Using OpenAPI Connection to Refresh Status');
844
+ this.warnLog('Using OpenAPI Connection to Refresh Status');
845
845
  await this.openAPIRefreshStatus();
846
846
  }
847
847
  }