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

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 (57) hide show
  1. package/dist/device/ceilinglight.d.ts.map +1 -1
  2. package/dist/device/ceilinglight.js +6 -9
  3. package/dist/device/ceilinglight.js.map +1 -1
  4. package/dist/device/colorbulb.d.ts.map +1 -1
  5. package/dist/device/colorbulb.js +7 -3
  6. package/dist/device/colorbulb.js.map +1 -1
  7. package/dist/irdevice/airconditioner.d.ts +1 -3
  8. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  9. package/dist/irdevice/airconditioner.js +44 -103
  10. package/dist/irdevice/airconditioner.js.map +1 -1
  11. package/dist/irdevice/airpurifier.d.ts +0 -1
  12. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  13. package/dist/irdevice/airpurifier.js +18 -49
  14. package/dist/irdevice/airpurifier.js.map +1 -1
  15. package/dist/irdevice/camera.d.ts.map +1 -1
  16. package/dist/irdevice/camera.js +9 -9
  17. package/dist/irdevice/camera.js.map +1 -1
  18. package/dist/irdevice/fan.d.ts.map +1 -1
  19. package/dist/irdevice/fan.js +19 -19
  20. package/dist/irdevice/fan.js.map +1 -1
  21. package/dist/irdevice/irdevice.d.ts +22 -10
  22. package/dist/irdevice/irdevice.d.ts.map +1 -1
  23. package/dist/irdevice/irdevice.js +89 -67
  24. package/dist/irdevice/irdevice.js.map +1 -1
  25. package/dist/irdevice/light.d.ts.map +1 -1
  26. package/dist/irdevice/light.js +15 -17
  27. package/dist/irdevice/light.js.map +1 -1
  28. package/dist/irdevice/other.d.ts.map +1 -1
  29. package/dist/irdevice/other.js +76 -76
  30. package/dist/irdevice/other.js.map +1 -1
  31. package/dist/irdevice/tv.d.ts.map +1 -1
  32. package/dist/irdevice/tv.js +35 -35
  33. package/dist/irdevice/tv.js.map +1 -1
  34. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  35. package/dist/irdevice/vacuumcleaner.js +9 -9
  36. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  37. package/dist/irdevice/waterheater.d.ts.map +1 -1
  38. package/dist/irdevice/waterheater.js +9 -9
  39. package/dist/irdevice/waterheater.js.map +1 -1
  40. package/dist/platform.d.ts +1 -1
  41. package/dist/platform.d.ts.map +1 -1
  42. package/dist/platform.js +202 -201
  43. package/dist/platform.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/device/ceilinglight.ts +6 -14
  46. package/src/device/colorbulb.ts +7 -10
  47. package/src/irdevice/airconditioner.ts +53 -97
  48. package/src/irdevice/airpurifier.ts +23 -45
  49. package/src/irdevice/camera.ts +9 -9
  50. package/src/irdevice/fan.ts +19 -19
  51. package/src/irdevice/irdevice.ts +92 -68
  52. package/src/irdevice/light.ts +15 -17
  53. package/src/irdevice/other.ts +76 -76
  54. package/src/irdevice/tv.ts +35 -35
  55. package/src/irdevice/vacuumcleaner.ts +9 -9
  56. package/src/irdevice/waterheater.ts +9 -9
  57. package/src/platform.ts +202 -201
package/src/platform.ts CHANGED
@@ -141,7 +141,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
141
141
  }
142
142
  } catch (e: any) {
143
143
  this.errorLog(`Failed to Discover, Error Message: ${e.message}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
144
- this.debugErrorLog(`Failed to Discover, Error: ${e}`);
144
+ await this.debugErrorLog(`Failed to Discover, Error: ${e}`);
145
145
  }
146
146
  });
147
147
 
@@ -164,7 +164,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
164
164
  this.mqttClient.subscribe('homebridge-switchbot/webhook/+');
165
165
  this.mqttClient.on('message', async (topic: string, message) => {
166
166
  try {
167
- await this.debugLog(`Received Webhook via MQTT: ${topic}=${message}`);
167
+ await await this.debugLog(`Received Webhook via MQTT: ${topic}=${message}`);
168
168
  const context = JSON.parse(message.toString());
169
169
  this.webhookEventHandler[context.deviceMac]?.(context);
170
170
  } catch (e: any) {
@@ -194,7 +194,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
194
194
  request.on('data', async (data) => {
195
195
  try {
196
196
  const body = JSON.parse(data);
197
- this.debugLog(`Received Webhook: ${JSON.stringify(body)}`);
197
+ await this.debugLog(`Received Webhook: ${JSON.stringify(body)}`);
198
198
  if (this.config.options?.mqttURL) {
199
199
  const mac = body.context.deviceMac
200
200
  ?.toLowerCase()
@@ -235,9 +235,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
235
235
  }),
236
236
  });
237
237
  const response: any = await body.json();
238
- this.debugLog(`setupWebhook: url:${url}`);
239
- this.debugLog(`setupWebhook: body:${JSON.stringify(response)}`);
240
- this.debugLog(`setupWebhook: statusCode:${statusCode}`);
238
+ await this.debugLog(`setupWebhook: url:${url}`);
239
+ await this.debugLog(`setupWebhook: body:${JSON.stringify(response)}`);
240
+ await this.debugLog(`setupWebhook: statusCode:${statusCode}`);
241
241
  if (statusCode !== 200 || response?.statusCode !== 100) {
242
242
  this.errorLog(`Failed to configure webhook. Existing webhook well be overridden. HTTP:${statusCode} API:${response?.statusCode} `
243
243
  + `message:${response?.message}`);
@@ -257,9 +257,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
257
257
  }),
258
258
  });
259
259
  const response: any = await body.json();
260
- this.debugLog(`updateWebhook: url:${url}`);
261
- this.debugLog(`updateWebhook: body:${JSON.stringify(response)}`);
262
- this.debugLog(`updateWebhook: statusCode:${statusCode}`);
260
+ await this.debugLog(`updateWebhook: url:${url}`);
261
+ await this.debugLog(`updateWebhook: body:${JSON.stringify(response)}`);
262
+ await this.debugLog(`updateWebhook: statusCode:${statusCode}`);
263
263
  if (statusCode !== 200 || response?.statusCode !== 100) {
264
264
  this.errorLog(`Failed to update webhook. HTTP:${statusCode} API:${response?.statusCode} message:${response?.message}`);
265
265
  }
@@ -276,8 +276,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
276
276
  }),
277
277
  });
278
278
  const response: any = await body.json();
279
- this.debugLog(`queryWebhook: body:${JSON.stringify(response)}`);
280
- this.debugLog(`queryWebhook: statusCode:${statusCode}`);
279
+ await this.debugLog(`queryWebhook: body:${JSON.stringify(response)}`);
280
+ await this.debugLog(`queryWebhook: statusCode:${statusCode}`);
281
281
  if (statusCode !== 200 || response?.statusCode !== 100) {
282
282
  this.errorLog(`Failed to query webhook. HTTP:${statusCode} API:${response?.statusCode} message:${response?.message}`);
283
283
  } else {
@@ -298,7 +298,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
298
298
  }),
299
299
  });
300
300
  const response: any = await body.json();
301
- this.debugLog(`deleteWebhook: url:${url}, body:${JSON.stringify(response)}, statusCode:${statusCode}`);
301
+ await this.debugLog(`deleteWebhook: url:${url}, body:${JSON.stringify(response)}, statusCode:${statusCode}`);
302
302
  if (statusCode !== 200 || response?.statusCode !== 100) {
303
303
  this.errorLog(`Failed to delete webhook. HTTP:${statusCode} API:${response?.statusCode} message:${response?.message}`);
304
304
  } else {
@@ -315,8 +315,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
315
315
  * This function is invoked when homebridge restores cached accessories from disk at startup.
316
316
  * It should be used to setup event handlers for characteristics and update respective values.
317
317
  */
318
- configureAccessory(accessory: PlatformAccessory) {
319
- this.debugLog(`Loading accessory from cache: ${accessory.displayName}`);
318
+ async configureAccessory(accessory: PlatformAccessory) {
319
+ await this.debugLog(`Loading accessory from cache: ${accessory.displayName}`);
320
320
 
321
321
  // add the restored accessory to the accessories cache so we can track if it has already been registered
322
322
  this.accessories.push(accessory);
@@ -341,7 +341,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
341
341
  platformConfig['pushRate'] = this.config.options.pushRate;
342
342
  }
343
343
  if (Object.entries(platformConfig).length !== 0) {
344
- this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
344
+ await this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
345
345
  }
346
346
 
347
347
  if (this.config.options) {
@@ -468,7 +468,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
468
468
  pluginConfig.credentials.openToken = undefined;
469
469
  }
470
470
 
471
- this.debugWarnLog(`token: ${pluginConfig.credentials.token}`);
471
+ await this.debugWarnLog(`token: ${pluginConfig.credentials.token}`);
472
472
 
473
473
  // save the config, ensuring we maintain pretty json
474
474
  writeFileSync(this.api.user.configPath(), JSON.stringify(currentConfig, null, 4));
@@ -511,29 +511,29 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
511
511
  let retryCount = 0;
512
512
  const maxRetries = this.maxRetries; // Maximum number of retries
513
513
  const delayBetweenRetries = this.delayBetweenRetries; // Delay between retries in milliseconds
514
- this.debugWarnLog(`Retry Count: ${retryCount}`);
515
- this.debugWarnLog(`Max Retries: ${maxRetries}`);
516
- this.debugWarnLog(`Delay Between Retries: ${delayBetweenRetries}`);
514
+ await this.debugWarnLog(`Retry Count: ${retryCount}`);
515
+ await this.debugWarnLog(`Max Retries: ${maxRetries}`);
516
+ await this.debugWarnLog(`Delay Between Retries: ${delayBetweenRetries}`);
517
517
  while (retryCount < maxRetries) {
518
518
  try {
519
519
  const { body, statusCode } = await request(Devices, {
520
520
  headers: this.generateHeaders(),
521
521
  });
522
- this.debugWarnLog(`statusCode: ${statusCode}`);
522
+ await this.debugWarnLog(`statusCode: ${statusCode}`);
523
523
  const devicesAPI: any = await body.json();
524
- this.debugWarnLog(`devicesAPI: ${JSON.stringify(devicesAPI)}`);
525
- this.debugWarnLog(`devicesAPI Body: ${JSON.stringify(devicesAPI.body)}`);
526
- this.debugWarnLog(`devicesAPI StatusCode: ${devicesAPI.statusCode}`);
524
+ await this.debugWarnLog(`devicesAPI: ${JSON.stringify(devicesAPI)}`);
525
+ await this.debugWarnLog(`devicesAPI Body: ${JSON.stringify(devicesAPI.body)}`);
526
+ await this.debugWarnLog(`devicesAPI StatusCode: ${devicesAPI.statusCode}`);
527
527
  if ((statusCode === 200 || statusCode === 100) && (devicesAPI.statusCode === 200 || devicesAPI.statusCode === 100)) {
528
- this.debugErrorLog(`statusCode: ${statusCode} & devicesAPI StatusCode: ${devicesAPI.statusCode}`);
528
+ await this.debugErrorLog(`statusCode: ${statusCode} & devicesAPI StatusCode: ${devicesAPI.statusCode}`);
529
529
  // SwitchBot Devices
530
530
  const deviceLists = devicesAPI.body.deviceList;
531
- this.debugWarnLog(`DeviceLists: ${JSON.stringify(deviceLists)}`);
532
- this.debugWarnLog(`DeviceLists Length: ${deviceLists.length}`);
531
+ await this.debugWarnLog(`DeviceLists: ${JSON.stringify(deviceLists)}`);
532
+ await this.debugWarnLog(`DeviceLists Length: ${deviceLists.length}`);
533
533
  if (!this.config.options?.devices) {
534
- this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
534
+ await this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
535
535
  if (deviceLists.length === 0) {
536
- this.debugLog(`SwitchBot API Currently Doesn't Have Any Devices With Cloud Services Enabled: ${JSON.stringify(devicesAPI.body)}`);
536
+ await this.debugLog(`SwitchBot API Has No Devices With Cloud Services Enabled: ${JSON.stringify(devicesAPI.body)}`);
537
537
  } else {
538
538
  const devices = deviceLists.map((v: any) => v);
539
539
  for (const device of devices) {
@@ -546,9 +546,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
546
546
  }
547
547
  }
548
548
  } else if (this.config.credentials?.token && this.config.options.devices) {
549
- this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
549
+ await this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
550
550
  if (deviceLists.length === 0) {
551
- this.debugLog(`SwitchBot API Currently Doesn't Have Any Devices With Cloud Services Enabled: ${JSON.stringify(devicesAPI.body)}`);
551
+ await this.debugLog(`SwitchBot API Has No Devices With Cloud Services Enabled: ${JSON.stringify(devicesAPI.body)}`);
552
552
  } else {
553
553
  const deviceConfigs = this.config.options?.devices;
554
554
 
@@ -562,7 +562,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
562
562
  }));
563
563
 
564
564
  const devices = mergeBydeviceId(deviceLists, deviceConfigs);
565
- this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
565
+ await this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
566
566
  for (const device of devices) {
567
567
  if (!device.deviceType) {
568
568
  device.deviceType = device.configDeviceType;
@@ -582,13 +582,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
582
582
  if (devicesAPI.body.deviceList.length !== 0) {
583
583
  this.infoLog(`Total SwitchBot Devices Found: ${devicesAPI.body.deviceList.length}`);
584
584
  } else {
585
- this.debugLog(`Total SwitchBot Devices Found: ${devicesAPI.body.deviceList.length}`);
585
+ await this.debugLog(`Total SwitchBot Devices Found: ${devicesAPI.body.deviceList.length}`);
586
586
  }
587
587
 
588
588
  // IR Devices
589
589
  const irDeviceLists = devicesAPI.body.infraredRemoteList;
590
590
  if (!this.config.options?.irdevices) {
591
- this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`);
591
+ await this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`);
592
592
  const devices = irDeviceLists.map((v: any) => v);
593
593
  for (const device of devices) {
594
594
  if (device.remoteType) {
@@ -596,7 +596,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
596
596
  }
597
597
  }
598
598
  } else {
599
- this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`);
599
+ await this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`);
600
600
  const irDeviceConfig = this.config.options?.irdevices;
601
601
 
602
602
  const mergeIRBydeviceId = (a1: { deviceId: string }[], a2: any[]) =>
@@ -609,7 +609,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
609
609
  }));
610
610
 
611
611
  const devices = mergeIRBydeviceId(irDeviceLists, irDeviceConfig);
612
- this.debugLog(`IR Devices: ${JSON.stringify(devices)}`);
612
+ await this.debugLog(`IR Devices: ${JSON.stringify(devices)}`);
613
613
  for (const device of devices) {
614
614
  this.createIRDevice(device);
615
615
  }
@@ -617,7 +617,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
617
617
  if (devicesAPI.body.infraredRemoteList.length !== 0) {
618
618
  this.infoLog(`Total IR Devices Found: ${devicesAPI.body.infraredRemoteList.length}`);
619
619
  } else {
620
- this.debugLog(`Total IR Devices Found: ${devicesAPI.body.infraredRemoteList.length}`);
620
+ await this.debugLog(`Total IR Devices Found: ${devicesAPI.body.infraredRemoteList.length}`);
621
621
  }
622
622
  break;
623
623
  } else {
@@ -633,11 +633,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
633
633
  retryCount++;
634
634
  this.debugErrorLog(
635
635
  `Failed to Discover Devices, Error Message: ${JSON.stringify(e.message)}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
636
- this.debugErrorLog(`Failed to Discover Devices, Error: ${e}`);
636
+ await this.debugErrorLog(`Failed to Discover Devices, Error: ${e}`);
637
637
  }
638
638
  }
639
639
  } else if (!this.config.credentials?.token && this.config.options?.devices) {
640
- this.debugLog(`SwitchBot Device Manual Config Set: ${JSON.stringify(this.config.options?.devices)}`);
640
+ await this.debugLog(`SwitchBot Device Manual Config Set: ${JSON.stringify(this.config.options?.devices)}`);
641
641
  const deviceConfigs = this.config.options?.devices;
642
642
  const devices = deviceConfigs.map((v: any) => v);
643
643
  for (const device of devices) {
@@ -652,73 +652,73 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
652
652
  }
653
653
  }
654
654
 
655
- private createDevice(device: device & devicesConfig) {
655
+ private async createDevice(device: device & devicesConfig) {
656
656
  switch (device.deviceType!) {
657
657
  case 'Humidifier':
658
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
658
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
659
659
  this.createHumidifier(device);
660
660
  break;
661
661
  case 'Hub Mini':
662
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
662
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
663
663
  break;
664
664
  case 'Hub Plus':
665
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
665
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
666
666
  break;
667
667
  case 'Hub 2':
668
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
668
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
669
669
  this.createHub2(device);
670
670
  break;
671
671
  case 'Bot':
672
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
672
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
673
673
  this.createBot(device);
674
674
  break;
675
675
  case 'Meter':
676
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
676
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
677
677
  this.createMeter(device);
678
678
  break;
679
679
  case 'MeterPlus':
680
680
  case 'Meter Plus (JP)':
681
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
681
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
682
682
  this.createMeterPlus(device);
683
683
  break;
684
684
  case 'WoIOSensor':
685
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
685
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
686
686
  this.createIOSensor(device);
687
687
  break;
688
688
  case 'Water Detector':
689
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
689
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
690
690
  this.createWaterDetector(device);
691
691
  break;
692
692
  case 'Motion Sensor':
693
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
693
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
694
694
  this.createMotion(device);
695
695
  break;
696
696
  case 'Contact Sensor':
697
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
697
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
698
698
  this.createContact(device);
699
699
  break;
700
700
  case 'Curtain':
701
701
  case 'Curtain3':
702
- this.debugLog(`Discovered ${device.deviceType} ${device.deviceName}: ${device.deviceId}`);
702
+ await this.debugLog(`Discovered ${device.deviceType} ${device.deviceName}: ${device.deviceId}`);
703
703
  this.createCurtain(device);
704
704
  break;
705
705
  case 'Blind Tilt':
706
- this.debugLog(`Discovered ${device.deviceType} ${device.deviceName}: ${device.deviceId}`);
706
+ await this.debugLog(`Discovered ${device.deviceType} ${device.deviceName}: ${device.deviceId}`);
707
707
  this.createBlindTilt(device);
708
708
  break;
709
709
  case 'Plug':
710
710
  case 'Plug Mini (US)':
711
711
  case 'Plug Mini (JP)':
712
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
712
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
713
713
  this.createPlug(device);
714
714
  break;
715
715
  case 'Smart Lock':
716
716
  case 'Smart Lock Pro':
717
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
717
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
718
718
  this.createLock(device);
719
719
  break;
720
720
  case 'Color Bulb':
721
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
721
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
722
722
  this.createColorBulb(device);
723
723
  break;
724
724
  case 'K10+':
@@ -727,26 +727,26 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
727
727
  case 'Robot Vacuum Cleaner S1':
728
728
  case 'Robot Vacuum Cleaner S1 Plus':
729
729
  case 'Robot Vacuum Cleaner S10':
730
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
730
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
731
731
  this.createRobotVacuumCleaner(device);
732
732
  break;
733
733
  case 'Ceiling Light':
734
734
  case 'Ceiling Light Pro':
735
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
735
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
736
736
  this.createCeilingLight(device);
737
737
  break;
738
738
  case 'Strip Light':
739
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
739
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
740
740
  this.createStripLight(device);
741
741
  break;
742
742
  case 'Battery Circulator Fan':
743
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
743
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
744
744
  this.createFan(device);
745
745
  break;
746
746
  case 'Remote':
747
747
  case 'Indoor Cam':
748
748
  case 'remote with screen+':
749
- this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}, is currently not supported, device: ${JSON.stringify(device)}`);
749
+ await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}, is currently not supported, device: ${JSON.stringify(device)}`);
750
750
  break;
751
751
  default:
752
752
  this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.deviceType}, is currently not supported.`,
@@ -754,7 +754,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
754
754
  }
755
755
  }
756
756
 
757
- private createIRDevice(device: irdevice & devicesConfig) {
757
+ private async createIRDevice(device: irdevice & devicesConfig) {
758
758
  if (device.connectionType === undefined) {
759
759
  device.connectionType = 'OpenAPI';
760
760
  }
@@ -771,7 +771,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
771
771
  case 'DIY DVD':
772
772
  case 'Speaker':
773
773
  case 'DIY Speaker':
774
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
774
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
775
775
  if (device.external === undefined) {
776
776
  device.external = true;
777
777
  this.createTV(device);
@@ -781,45 +781,45 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
781
781
  break;
782
782
  case 'Fan':
783
783
  case 'DIY Fan':
784
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
784
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
785
785
  this.createIRFan(device);
786
786
  break;
787
787
  case 'Air Conditioner':
788
788
  case 'DIY Air Conditioner':
789
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
789
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
790
790
  this.createAirConditioner(device);
791
791
  break;
792
792
  case 'Light':
793
793
  case 'DIY Light':
794
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
794
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
795
795
  this.createLight(device);
796
796
  break;
797
797
  case 'Air Purifier':
798
798
  case 'DIY Air Purifier':
799
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
799
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
800
800
  this.createAirPurifier(device);
801
801
  break;
802
802
  case 'Water Heater':
803
803
  case 'DIY Water Heater':
804
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
804
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
805
805
  this.createWaterHeater(device);
806
806
  break;
807
807
  case 'Vacuum Cleaner':
808
808
  case 'DIY Vacuum Cleaner':
809
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
809
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
810
810
  this.createVacuumCleaner(device);
811
811
  break;
812
812
  case 'Camera':
813
813
  case 'DIY Camera':
814
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
814
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
815
815
  this.createCamera(device);
816
816
  break;
817
817
  case 'Others':
818
- this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
818
+ await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
819
819
  this.createOthers(device);
820
820
  break;
821
821
  default:
822
- this.debugLog(`Unsupported Device: ${JSON.stringify(device)}`);
822
+ await this.debugLog(`Unsupported Device: ${JSON.stringify(device)}`);
823
823
  this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.remoteType}, is currently not supported.`);
824
824
  this.warnLog('Submit Feature Requests Here: ' + 'https://tinyurl.com/SwitchBotFeatureRequest');
825
825
  }
@@ -849,7 +849,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
849
849
  // create the accessory handler for the restored accessory
850
850
  // this is imported from `platformAccessory.ts`
851
851
  new Humidifier(this, existingAccessory, device);
852
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
852
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
853
853
  } else {
854
854
  this.unregisterPlatformAccessories(existingAccessory);
855
855
  }
@@ -875,13 +875,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
875
875
  // create the accessory handler for the newly create accessory
876
876
  // this is imported from `platformAccessory.ts`
877
877
  new Humidifier(this, accessory, device);
878
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
878
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
879
879
 
880
880
  // publish device externally or link the accessory to your platform
881
881
  this.externalOrPlatform(device, accessory);
882
882
  this.accessories.push(accessory);
883
883
  } else {
884
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
884
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
885
885
  }
886
886
  }
887
887
 
@@ -909,7 +909,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
909
909
  // create the accessory handler for the restored accessory
910
910
  // this is imported from `platformAccessory.ts`
911
911
  new Bot(this, existingAccessory, device);
912
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
912
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
913
913
  } else {
914
914
  this.unregisterPlatformAccessories(existingAccessory);
915
915
  }
@@ -936,13 +936,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
936
936
  // create the accessory handler for the newly create accessory
937
937
  // this is imported from `platformAccessory.ts`
938
938
  new Bot(this, accessory, device);
939
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
939
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
940
940
 
941
941
  // publish device externally or link the accessory to your platform
942
942
  this.externalOrPlatform(device, accessory);
943
943
  this.accessories.push(accessory);
944
944
  } else {
945
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
945
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
946
946
  }
947
947
  }
948
948
 
@@ -970,7 +970,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
970
970
  // create the accessory handler for the restored accessory
971
971
  // this is imported from `platformAccessory.ts`
972
972
  new Meter(this, existingAccessory, device);
973
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
973
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
974
974
  } else {
975
975
  this.unregisterPlatformAccessories(existingAccessory);
976
976
  }
@@ -996,13 +996,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
996
996
  // create the accessory handler for the newly create accessory
997
997
  // this is imported from `platformAccessory.ts`
998
998
  new Meter(this, accessory, device);
999
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
999
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1000
1000
 
1001
1001
  // publish device externally or link the accessory to your platform
1002
1002
  this.externalOrPlatform(device, accessory);
1003
1003
  this.accessories.push(accessory);
1004
1004
  } else {
1005
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1005
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1006
1006
  }
1007
1007
  }
1008
1008
 
@@ -1031,7 +1031,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1031
1031
  // create the accessory handler for the restored accessory
1032
1032
  // this is imported from `platformAccessory.ts`
1033
1033
  new MeterPlus(this, existingAccessory, device);
1034
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1034
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1035
1035
  } else {
1036
1036
  this.unregisterPlatformAccessories(existingAccessory);
1037
1037
  }
@@ -1057,13 +1057,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1057
1057
  // create the accessory handler for the newly create accessory
1058
1058
  // this is imported from `platformAccessory.ts`
1059
1059
  new MeterPlus(this, accessory, device);
1060
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1060
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1061
1061
 
1062
1062
  // publish device externally or link the accessory to your platform
1063
1063
  this.externalOrPlatform(device, accessory);
1064
1064
  this.accessories.push(accessory);
1065
1065
  } else {
1066
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1066
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1067
1067
  }
1068
1068
  }
1069
1069
 
@@ -1092,7 +1092,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1092
1092
  // create the accessory handler for the restored accessory
1093
1093
  // this is imported from `platformAccessory.ts`
1094
1094
  new Hub(this, existingAccessory, device);
1095
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1095
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1096
1096
  } else {
1097
1097
  this.unregisterPlatformAccessories(existingAccessory);
1098
1098
  }
@@ -1118,13 +1118,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1118
1118
  // create the accessory handler for the newly create accessory
1119
1119
  // this is imported from `platformAccessory.ts`
1120
1120
  new Hub(this, accessory, device);
1121
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1121
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1122
1122
 
1123
1123
  // publish device externally or link the accessory to your platform
1124
1124
  this.externalOrPlatform(device, accessory);
1125
1125
  this.accessories.push(accessory);
1126
1126
  } else {
1127
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1127
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1128
1128
  }
1129
1129
  }
1130
1130
 
@@ -1152,7 +1152,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1152
1152
  // create the accessory handler for the restored accessory
1153
1153
  // this is imported from `platformAccessory.ts`
1154
1154
  new IOSensor(this, existingAccessory, device);
1155
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1155
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1156
1156
  } else {
1157
1157
  this.unregisterPlatformAccessories(existingAccessory);
1158
1158
  }
@@ -1178,13 +1178,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1178
1178
  // create the accessory handler for the newly create accessory
1179
1179
  // this is imported from `platformAccessory.ts`
1180
1180
  new IOSensor(this, accessory, device);
1181
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1181
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1182
1182
 
1183
1183
  // publish device externally or link the accessory to your platform
1184
1184
  this.externalOrPlatform(device, accessory);
1185
1185
  this.accessories.push(accessory);
1186
1186
  } else {
1187
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1187
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1188
1188
  }
1189
1189
  }
1190
1190
 
@@ -1212,7 +1212,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1212
1212
  // create the accessory handler for the restored accessory
1213
1213
  // this is imported from `platformAccessory.ts`
1214
1214
  new WaterDetector(this, existingAccessory, device);
1215
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1215
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1216
1216
  } else {
1217
1217
  this.unregisterPlatformAccessories(existingAccessory);
1218
1218
  }
@@ -1238,13 +1238,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1238
1238
  // create the accessory handler for the newly create accessory
1239
1239
  // this is imported from `platformAccessory.ts`
1240
1240
  new WaterDetector(this, accessory, device);
1241
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1241
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1242
1242
 
1243
1243
  // publish device externally or link the accessory to your platform
1244
1244
  this.externalOrPlatform(device, accessory);
1245
1245
  this.accessories.push(accessory);
1246
1246
  } else {
1247
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1247
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1248
1248
  }
1249
1249
  }
1250
1250
 
@@ -1272,7 +1272,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1272
1272
  // create the accessory handler for the restored accessory
1273
1273
  // this is imported from `platformAccessory.ts`
1274
1274
  new Motion(this, existingAccessory, device);
1275
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1275
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1276
1276
  } else {
1277
1277
  this.unregisterPlatformAccessories(existingAccessory);
1278
1278
  }
@@ -1298,13 +1298,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1298
1298
  // create the accessory handler for the newly create accessory
1299
1299
  // this is imported from `platformAccessory.ts`
1300
1300
  new Motion(this, accessory, device);
1301
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1301
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1302
1302
 
1303
1303
  // publish device externally or link the accessory to your platform
1304
1304
  this.externalOrPlatform(device, accessory);
1305
1305
  this.accessories.push(accessory);
1306
1306
  } else {
1307
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1307
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1308
1308
  }
1309
1309
  }
1310
1310
 
@@ -1332,7 +1332,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1332
1332
  // create the accessory handler for the restored accessory
1333
1333
  // this is imported from `platformAccessory.ts`
1334
1334
  new Contact(this, existingAccessory, device);
1335
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1335
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1336
1336
  } else {
1337
1337
  this.unregisterPlatformAccessories(existingAccessory);
1338
1338
  }
@@ -1358,13 +1358,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1358
1358
  // create the accessory handler for the newly create accessory
1359
1359
  // this is imported from `platformAccessory.ts`
1360
1360
  new Contact(this, accessory, device);
1361
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1361
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1362
1362
 
1363
1363
  // publish device externally or link the accessory to your platform
1364
1364
  this.externalOrPlatform(device, accessory);
1365
1365
  this.accessories.push(accessory);
1366
1366
  } else {
1367
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1367
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1368
1368
  }
1369
1369
  }
1370
1370
 
@@ -1392,7 +1392,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1392
1392
  // create the accessory handler for the restored accessory
1393
1393
  // this is imported from `platformAccessory.ts`
1394
1394
  new BlindTilt(this, existingAccessory, device);
1395
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1395
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1396
1396
  } else {
1397
1397
  this.unregisterPlatformAccessories(existingAccessory);
1398
1398
  }
@@ -1432,13 +1432,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1432
1432
  // create the accessory handler for the newly create accessory
1433
1433
  // this is imported from `platformAccessory.ts`
1434
1434
  new BlindTilt(this, accessory, device);
1435
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1435
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1436
1436
 
1437
1437
  // publish device externally or link the accessory to your platform
1438
1438
  this.externalOrPlatform(device, accessory);
1439
1439
  this.accessories.push(accessory);
1440
1440
  } else {
1441
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1441
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1442
1442
  }
1443
1443
  }
1444
1444
 
@@ -1466,7 +1466,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1466
1466
  // create the accessory handler for the restored accessory
1467
1467
  // this is imported from `platformAccessory.ts`
1468
1468
  new Curtain(this, existingAccessory, device);
1469
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1469
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1470
1470
  } else {
1471
1471
  this.unregisterPlatformAccessories(existingAccessory);
1472
1472
  }
@@ -1507,13 +1507,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1507
1507
  // create the accessory handler for the newly create accessory
1508
1508
  // this is imported from `platformAccessory.ts`
1509
1509
  new Curtain(this, accessory, device);
1510
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1510
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1511
1511
 
1512
1512
  // publish device externally or link the accessory to your platform
1513
1513
  this.externalOrPlatform(device, accessory);
1514
1514
  this.accessories.push(accessory);
1515
1515
  } else {
1516
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1516
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1517
1517
  }
1518
1518
  }
1519
1519
 
@@ -1541,7 +1541,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1541
1541
  // create the accessory handler for the restored accessory
1542
1542
  // this is imported from `platformAccessory.ts`
1543
1543
  new Plug(this, existingAccessory, device);
1544
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1544
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1545
1545
  } else {
1546
1546
  this.unregisterPlatformAccessories(existingAccessory);
1547
1547
  }
@@ -1567,13 +1567,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1567
1567
  // create the accessory handler for the newly create accessory
1568
1568
  // this is imported from `platformAccessory.ts`
1569
1569
  new Plug(this, accessory, device);
1570
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1570
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1571
1571
 
1572
1572
  // publish device externally or link the accessory to your platform
1573
1573
  this.externalOrPlatform(device, accessory);
1574
1574
  this.accessories.push(accessory);
1575
1575
  } else {
1576
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1576
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1577
1577
  }
1578
1578
  }
1579
1579
 
@@ -1601,7 +1601,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1601
1601
  // create the accessory handler for the restored accessory
1602
1602
  // this is imported from `platformAccessory.ts`
1603
1603
  new Lock(this, existingAccessory, device);
1604
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1604
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1605
1605
  } else {
1606
1606
  this.unregisterPlatformAccessories(existingAccessory);
1607
1607
  }
@@ -1627,13 +1627,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1627
1627
  // create the accessory handler for the newly create accessory
1628
1628
  // this is imported from `platformAccessory.ts`
1629
1629
  new Lock(this, accessory, device);
1630
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1630
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1631
1631
 
1632
1632
  // publish device externally or link the accessory to your platform
1633
1633
  this.externalOrPlatform(device, accessory);
1634
1634
  this.accessories.push(accessory);
1635
1635
  } else {
1636
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1636
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1637
1637
  }
1638
1638
  }
1639
1639
 
@@ -1661,7 +1661,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1661
1661
  // create the accessory handler for the restored accessory
1662
1662
  // this is imported from `platformAccessory.ts`
1663
1663
  new ColorBulb(this, existingAccessory, device);
1664
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1664
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1665
1665
  } else {
1666
1666
  this.unregisterPlatformAccessories(existingAccessory);
1667
1667
  }
@@ -1687,13 +1687,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1687
1687
  // create the accessory handler for the newly create accessory
1688
1688
  // this is imported from `platformAccessory.ts`
1689
1689
  new ColorBulb(this, accessory, device);
1690
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1690
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1691
1691
 
1692
1692
  // publish device externally or link the accessory to your platform
1693
1693
  this.externalOrPlatform(device, accessory);
1694
1694
  this.accessories.push(accessory);
1695
1695
  } else {
1696
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1696
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1697
1697
  }
1698
1698
  }
1699
1699
 
@@ -1721,7 +1721,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1721
1721
  // create the accessory handler for the restored accessory
1722
1722
  // this is imported from `platformAccessory.ts`
1723
1723
  new CeilingLight(this, existingAccessory, device);
1724
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1724
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1725
1725
  } else {
1726
1726
  this.unregisterPlatformAccessories(existingAccessory);
1727
1727
  }
@@ -1747,13 +1747,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1747
1747
  // create the accessory handler for the newly create accessory
1748
1748
  // this is imported from `platformAccessory.ts`
1749
1749
  new CeilingLight(this, accessory, device);
1750
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1750
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1751
1751
 
1752
1752
  // publish device externally or link the accessory to your platform
1753
1753
  this.externalOrPlatform(device, accessory);
1754
1754
  this.accessories.push(accessory);
1755
1755
  } else {
1756
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1756
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1757
1757
  }
1758
1758
  }
1759
1759
 
@@ -1781,7 +1781,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1781
1781
  // create the accessory handler for the restored accessory
1782
1782
  // this is imported from `platformAccessory.ts`
1783
1783
  new StripLight(this, existingAccessory, device);
1784
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1784
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1785
1785
  } else {
1786
1786
  this.unregisterPlatformAccessories(existingAccessory);
1787
1787
  }
@@ -1807,13 +1807,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1807
1807
  // create the accessory handler for the newly create accessory
1808
1808
  // this is imported from `platformAccessory.ts`
1809
1809
  new StripLight(this, accessory, device);
1810
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1810
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1811
1811
 
1812
1812
  // publish device externally or link the accessory to your platform
1813
1813
  this.externalOrPlatform(device, accessory);
1814
1814
  this.accessories.push(accessory);
1815
1815
  } else {
1816
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1816
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1817
1817
  }
1818
1818
  }
1819
1819
 
@@ -1841,7 +1841,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1841
1841
  // create the accessory handler for the restored accessory
1842
1842
  // this is imported from `platformAccessory.ts`
1843
1843
  new Fan(this, existingAccessory, device);
1844
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1844
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1845
1845
  } else {
1846
1846
  this.unregisterPlatformAccessories(existingAccessory);
1847
1847
  }
@@ -1867,13 +1867,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1867
1867
  // create the accessory handler for the newly create accessory
1868
1868
  // this is imported from `platformAccessory.ts`
1869
1869
  new Fan(this, accessory, device);
1870
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1870
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1871
1871
 
1872
1872
  // publish device externally or link the accessory to your platform
1873
1873
  this.externalOrPlatform(device, accessory);
1874
1874
  this.accessories.push(accessory);
1875
1875
  } else {
1876
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1876
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1877
1877
  }
1878
1878
  }
1879
1879
 
@@ -1901,7 +1901,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1901
1901
  // create the accessory handler for the restored accessory
1902
1902
  // this is imported from `platformAccessory.ts`
1903
1903
  new RobotVacuumCleaner(this, existingAccessory, device);
1904
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1904
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1905
1905
  } else {
1906
1906
  this.unregisterPlatformAccessories(existingAccessory);
1907
1907
  }
@@ -1927,13 +1927,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1927
1927
  // create the accessory handler for the newly create accessory
1928
1928
  // this is imported from `platformAccessory.ts`
1929
1929
  new RobotVacuumCleaner(this, accessory, device);
1930
- this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1930
+ await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1931
1931
 
1932
1932
  // publish device externally or link the accessory to your platform
1933
1933
  this.externalOrPlatform(device, accessory);
1934
1934
  this.accessories.push(accessory);
1935
1935
  } else {
1936
- this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1936
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
1937
1937
  }
1938
1938
  }
1939
1939
 
@@ -1956,7 +1956,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1956
1956
  // create the accessory handler for the restored accessory
1957
1957
  // this is imported from `platformAccessory.ts`
1958
1958
  new TV(this, existingAccessory, device);
1959
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
1959
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
1960
1960
  } else if (!device.hide_device && device.hubDeviceId) {
1961
1961
  // the accessory does not yet exist, so we need to create it
1962
1962
  if (!device.external) {
@@ -1979,12 +1979,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1979
1979
  // create the accessory handler for the newly create accessory
1980
1980
  // this is imported from `platformAccessory.ts`
1981
1981
  new TV(this, accessory, device);
1982
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
1982
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
1983
1983
 
1984
1984
  this.externalOrPlatformIR(device, accessory);
1985
1985
  this.accessories.push(accessory);
1986
1986
  } else {
1987
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
1987
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
1988
1988
  }
1989
1989
  }
1990
1990
 
@@ -2012,7 +2012,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2012
2012
  // create the accessory handler for the restored accessory
2013
2013
  // this is imported from `platformAccessory.ts`
2014
2014
  new IRFan(this, existingAccessory, device);
2015
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2015
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2016
2016
  } else {
2017
2017
  this.unregisterPlatformAccessories(existingAccessory);
2018
2018
  }
@@ -2038,13 +2038,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2038
2038
  // create the accessory handler for the newly create accessory
2039
2039
  // this is imported from `platformAccessory.ts`
2040
2040
  new IRFan(this, accessory, device);
2041
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2041
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2042
2042
 
2043
2043
  // publish device externally or link the accessory to your platform
2044
2044
  this.externalOrPlatformIR(device, accessory);
2045
2045
  this.accessories.push(accessory);
2046
2046
  } else {
2047
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2047
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2048
2048
  }
2049
2049
  }
2050
2050
 
@@ -2072,7 +2072,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2072
2072
  // create the accessory handler for the restored accessory
2073
2073
  // this is imported from `platformAccessory.ts`
2074
2074
  new Light(this, existingAccessory, device);
2075
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2075
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2076
2076
  } else {
2077
2077
  this.unregisterPlatformAccessories(existingAccessory);
2078
2078
  }
@@ -2098,13 +2098,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2098
2098
  // create the accessory handler for the newly create accessory
2099
2099
  // this is imported from `platformAccessory.ts`
2100
2100
  new Light(this, accessory, device);
2101
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2101
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2102
2102
 
2103
2103
  // publish device externally or link the accessory to your platform
2104
2104
  this.externalOrPlatformIR(device, accessory);
2105
2105
  this.accessories.push(accessory);
2106
2106
  } else {
2107
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2107
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2108
2108
  }
2109
2109
  }
2110
2110
 
@@ -2132,7 +2132,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2132
2132
  // create the accessory handler for the restored accessory
2133
2133
  // this is imported from `platformAccessory.ts`
2134
2134
  new AirConditioner(this, existingAccessory, device);
2135
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2135
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2136
2136
  } else {
2137
2137
  this.unregisterPlatformAccessories(existingAccessory);
2138
2138
  }
@@ -2158,13 +2158,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2158
2158
  // create the accessory handler for the newly create accessory
2159
2159
  // this is imported from `platformAccessory.ts`
2160
2160
  new AirConditioner(this, accessory, device);
2161
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2161
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2162
2162
 
2163
2163
  // publish device externally or link the accessory to your platform
2164
2164
  this.externalOrPlatformIR(device, accessory);
2165
2165
  this.accessories.push(accessory);
2166
2166
  } else {
2167
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2167
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2168
2168
  }
2169
2169
  }
2170
2170
 
@@ -2192,7 +2192,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2192
2192
  // create the accessory handler for the restored accessory
2193
2193
  // this is imported from `platformAccessory.ts`
2194
2194
  new AirPurifier(this, existingAccessory, device);
2195
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2195
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2196
2196
  } else {
2197
2197
  this.unregisterPlatformAccessories(existingAccessory);
2198
2198
  }
@@ -2218,13 +2218,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2218
2218
  // create the accessory handler for the newly create accessory
2219
2219
  // this is imported from `platformAccessory.ts`
2220
2220
  new AirPurifier(this, accessory, device);
2221
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2221
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2222
2222
 
2223
2223
  // publish device externally or link the accessory to your platform
2224
2224
  this.externalOrPlatformIR(device, accessory);
2225
2225
  this.accessories.push(accessory);
2226
2226
  } else {
2227
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2227
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2228
2228
  }
2229
2229
  }
2230
2230
 
@@ -2252,7 +2252,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2252
2252
  // create the accessory handler for the restored accessory
2253
2253
  // this is imported from `platformAccessory.ts`
2254
2254
  new WaterHeater(this, existingAccessory, device);
2255
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2255
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2256
2256
  } else {
2257
2257
  this.unregisterPlatformAccessories(existingAccessory);
2258
2258
  }
@@ -2278,13 +2278,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2278
2278
  // create the accessory handler for the newly create accessory
2279
2279
  // this is imported from `platformAccessory.ts`
2280
2280
  new WaterHeater(this, accessory, device);
2281
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2281
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2282
2282
 
2283
2283
  // publish device externally or link the accessory to your platform
2284
2284
  this.externalOrPlatformIR(device, accessory);
2285
2285
  this.accessories.push(accessory);
2286
2286
  } else {
2287
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2287
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2288
2288
  }
2289
2289
  }
2290
2290
 
@@ -2312,7 +2312,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2312
2312
  // create the accessory handler for the restored accessory
2313
2313
  // this is imported from `platformAccessory.ts`
2314
2314
  new VacuumCleaner(this, existingAccessory, device);
2315
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2315
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2316
2316
  } else {
2317
2317
  this.unregisterPlatformAccessories(existingAccessory);
2318
2318
  }
@@ -2338,13 +2338,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2338
2338
  // create the accessory handler for the newly create accessory
2339
2339
  // this is imported from `platformAccessory.ts`
2340
2340
  new VacuumCleaner(this, accessory, device);
2341
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2341
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2342
2342
 
2343
2343
  // publish device externally or link the accessory to your platform
2344
2344
  this.externalOrPlatformIR(device, accessory);
2345
2345
  this.accessories.push(accessory);
2346
2346
  } else {
2347
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2347
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2348
2348
  }
2349
2349
  }
2350
2350
 
@@ -2372,7 +2372,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2372
2372
  // create the accessory handler for the restored accessory
2373
2373
  // this is imported from `platformAccessory.ts`
2374
2374
  new Camera(this, existingAccessory, device);
2375
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2375
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2376
2376
  } else {
2377
2377
  this.unregisterPlatformAccessories(existingAccessory);
2378
2378
  }
@@ -2398,13 +2398,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2398
2398
  // create the accessory handler for the newly create accessory
2399
2399
  // this is imported from `platformAccessory.ts`
2400
2400
  new Camera(this, accessory, device);
2401
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2401
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2402
2402
 
2403
2403
  // publish device externally or link the accessory to your platform
2404
2404
  this.externalOrPlatformIR(device, accessory);
2405
2405
  this.accessories.push(accessory);
2406
2406
  } else {
2407
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2407
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2408
2408
  }
2409
2409
  }
2410
2410
 
@@ -2432,7 +2432,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2432
2432
  // create the accessory handler for the restored accessory
2433
2433
  // this is imported from `platformAccessory.ts`
2434
2434
  new Others(this, existingAccessory, device);
2435
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2435
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2436
2436
  } else {
2437
2437
  this.unregisterPlatformAccessories(existingAccessory);
2438
2438
  }
@@ -2458,13 +2458,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2458
2458
  // create the accessory handler for the newly create accessory
2459
2459
  // this is imported from `platformAccessory.ts`
2460
2460
  new Others(this, accessory, device);
2461
- this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2461
+ await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2462
2462
 
2463
2463
  // publish device externally or link the accessory to your platform
2464
2464
  this.externalOrPlatformIR(device, accessory);
2465
2465
  this.accessories.push(accessory);
2466
2466
  } else {
2467
- this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2467
+ await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
2468
2468
  }
2469
2469
  }
2470
2470
 
@@ -2478,11 +2478,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2478
2478
  }*/
2479
2479
  let registerWindowCovering: boolean;
2480
2480
  if (isCurtainDevice(device)) {
2481
- this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, curtainDevicesIds: ${device.curtainDevicesIds}, master: `
2482
- + `${device.master}, group: ${device.group}, disable_group: ${device.curtain?.disable_group}, connectionType: ${device.connectionType}`);
2481
+ await this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, curtainDevicesIds: ${device.curtainDevicesIds},`
2482
+ + ` master: ${device.master}, group: ${device.group}, disable_group: ${device.curtain?.disable_group},`
2483
+ + ` connectionType: ${device.connectionType}`);
2483
2484
  registerWindowCovering = await this.registerWindowCovering(device);
2484
2485
  } else if (isBlindTiltDevice(device)) {
2485
- this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, blindTiltDevicesIds: ${device.blindTiltDevicesIds},`
2486
+ await this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, blindTiltDevicesIds: ${device.blindTiltDevicesIds},`
2486
2487
  + ` master: ${device.master}, group: ${device.group}, disable_group: ${device.curtain?.disable_group},`
2487
2488
  + ` connectionType: ${device.connectionType}`);
2488
2489
  registerWindowCovering =await this.registerWindowCovering(device);
@@ -2493,38 +2494,38 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2493
2494
  }
2494
2495
 
2495
2496
  async registerWindowCovering(device: ((curtain | curtain3) & devicesConfig) | (blindTilt & devicesConfig)) {
2496
- this.debugLog(device.master);
2497
+ await this.debugLog(`master: ${device.master}`);
2497
2498
  let registerCurtain: boolean;
2498
2499
  if (device.master && device.group) {
2499
2500
  // OpenAPI: Master Curtains/Blind Tilt in Group
2500
2501
  registerCurtain = true;
2501
- this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group}`
2502
- + ` connectionType; ${device.connectionType}`);
2503
- this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2502
+ await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master},`
2503
+ + ` device.group: ${device.group} connectionType; ${device.connectionType}`);
2504
+ await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2504
2505
  } else if (!device.master && device.curtain?.disable_group) {
2505
2506
  //!device.group && device.connectionType === 'BLE'
2506
2507
  // OpenAPI: Non-Master Curtains/Blind Tilts that has Disable Grouping Checked
2507
2508
  registerCurtain = true;
2508
- this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, disable_group: `
2509
+ await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, disable_group: `
2509
2510
  + `${device.curtain?.disable_group}, connectionType; ${device.connectionType}`);
2510
- this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2511
+ await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2511
2512
  } else if (device.master && !device.group) {
2512
2513
  // OpenAPI: Master Curtains/Blind Tilts not in Group
2513
2514
  registerCurtain = true;
2514
- this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group}`
2515
- + ` connectionType; ${device.connectionType}`);
2516
- this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2515
+ await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master},`
2516
+ + ` device.group: ${device.group} connectionType; ${device.connectionType}`);
2517
+ await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2517
2518
  } else if (device.connectionType === 'BLE') {
2518
2519
  // BLE: Curtains/Blind Tilt
2519
2520
  registerCurtain = true;
2520
- this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] connectionType: ${device.connectionType}, `
2521
+ await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] connectionType: ${device.connectionType}, `
2521
2522
  + ` group: ${device.group}`);
2522
- this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2523
+ await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2523
2524
  } else {
2524
2525
  registerCurtain = false;
2525
- this.debugErrorLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] disable_group: ${device.curtain?.disable_group},`
2526
+ await this.debugErrorLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] disable_group: ${device.curtain?.disable_group},`
2526
2527
  + ` device.master: ${device.master}, device.group: ${device.group}`);
2527
- this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}, device.connectionType: ${device.connectionType}`);
2528
+ await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}, device.connectionType: ${device.connectionType}`);
2528
2529
  }
2529
2530
  return registerCurtain;
2530
2531
  }
@@ -2548,16 +2549,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2548
2549
  case 'Curtain3':
2549
2550
  case 'Blind Tilt':
2550
2551
  registerDevice = await this.registerCurtains(device);
2551
- this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2552
+ await this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2552
2553
  break;
2553
2554
  default:
2554
2555
  registerDevice = true;
2555
- this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2556
+ await this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2556
2557
  }
2557
2558
  if (registerDevice === true) {
2558
- this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2559
+ await this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2559
2560
  } else {
2560
- this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2561
+ await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2561
2562
  }
2562
2563
  } else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName && device.connectionType === 'BLE') {
2563
2564
  switch (device.deviceType) {
@@ -2565,16 +2566,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2565
2566
  case 'Curtain3':
2566
2567
  case 'Blind Tilt':
2567
2568
  registerDevice = await this.registerCurtains(device);
2568
- this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2569
+ await this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2569
2570
  break;
2570
2571
  default:
2571
2572
  registerDevice = true;
2572
- this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2573
+ await this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2573
2574
  }
2574
2575
  if (registerDevice === true) {
2575
- this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2576
+ await this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2576
2577
  } else {
2577
- this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2578
+ await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2578
2579
  }
2579
2580
  } else if (!device.hide_device && device.connectionType === 'OpenAPI') {
2580
2581
  switch (device.deviceType) {
@@ -2582,16 +2583,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2582
2583
  case 'Curtain3':
2583
2584
  case 'Blind Tilt':
2584
2585
  registerDevice = await this.registerCurtains(device);
2585
- this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2586
+ await this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2586
2587
  break;
2587
2588
  default:
2588
2589
  registerDevice = true;
2589
- this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2590
+ await this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2590
2591
  }
2591
2592
  if (registerDevice === true) {
2592
- this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2593
+ await this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2593
2594
  } else {
2594
- this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2595
+ await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2595
2596
  }
2596
2597
  } else if (!device.hide_device && device.connectionType === 'Disabled') {
2597
2598
  switch (device.deviceType) {
@@ -2599,22 +2600,22 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2599
2600
  case 'Curtain3':
2600
2601
  case 'Blind Tilt':
2601
2602
  registerDevice = await this.registerCurtains(device);
2602
- this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2603
+ await this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2603
2604
  break;
2604
2605
  default:
2605
2606
  registerDevice = true;
2606
- this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2607
+ await this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2607
2608
  }
2608
- this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will continue to display in HomeKit`);
2609
+ await this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will continue to display in HomeKit`);
2609
2610
  } else if (!device.connectionType && !device.hide_device) {
2610
2611
  registerDevice = false;
2611
- this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2612
+ await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2612
2613
  } else if (device.hide_device) {
2613
2614
  registerDevice = false;
2614
- this.debugErrorLog(`Device: ${device.deviceName} hide_device: ${device.hide_device}, will not display in HomeKit`);
2615
+ await this.debugErrorLog(`Device: ${device.deviceName} hide_device: ${device.hide_device}, will not display in HomeKit`);
2615
2616
  } else {
2616
2617
  registerDevice = false;
2617
- this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, hide_device: `
2618
+ await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, hide_device: `
2618
2619
  + `${device.hide_device}, will not display in HomeKit`);
2619
2620
  }
2620
2621
  return registerDevice;
@@ -2627,20 +2628,20 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2627
2628
  * publish your TV as an external accessory.
2628
2629
  */
2629
2630
  if (device.external) {
2630
- this.debugWarnLog(`${accessory.displayName} External Accessory Mode`);
2631
+ await this.debugWarnLog(`${accessory.displayName} External Accessory Mode`);
2631
2632
  this.externalAccessory(accessory);
2632
2633
  } else {
2633
- this.debugLog(`${accessory.displayName} External Accessory Mode: ${device.external}`);
2634
+ await this.debugLog(`${accessory.displayName} External Accessory Mode: ${device.external}`);
2634
2635
  this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
2635
2636
  }
2636
2637
  }
2637
2638
 
2638
2639
  public async externalOrPlatform(device: device & devicesConfig, accessory: PlatformAccessory) {
2639
2640
  if (device.external) {
2640
- this.debugWarnLog(`${accessory.displayName} External Accessory Mode`);
2641
- this.externalAccessory(accessory);
2641
+ await this.debugWarnLog(`${accessory.displayName} External Accessory Mode`);
2642
+ await this.externalAccessory(accessory);
2642
2643
  } else {
2643
- this.debugLog(`${accessory.displayName} External Accessory Mode: ${device.external}`);
2644
+ await this.debugLog(`${accessory.displayName} External Accessory Mode: ${device.external}`);
2644
2645
  this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
2645
2646
  }
2646
2647
  }
@@ -2677,10 +2678,10 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2677
2678
  await this.errorLog(`Requests reached the daily limit, statusCode: ${statusCode}`);
2678
2679
  break;
2679
2680
  case 100:
2680
- await this.debugLog(`Command successfully sent, statusCode: ${statusCode}`);
2681
+ await await this.debugLog(`Command successfully sent, statusCode: ${statusCode}`);
2681
2682
  break;
2682
2683
  case 200:
2683
- await this.debugLog(`Request successful, statusCode: ${statusCode}`);
2684
+ await await this.debugLog(`Request successful, statusCode: ${statusCode}`);
2684
2685
  break;
2685
2686
  case 400:
2686
2687
  await this.errorLog('Bad Request, The client has issued an invalid request. This is commonly used to specify validation errors in a request '
@@ -2734,13 +2735,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2734
2735
  if (statusCode === 200 || statusCode === 100) {
2735
2736
  return { body, statusCode };
2736
2737
  } else {
2737
- await this.debugLog(`Received status code: ${statusCode}`);
2738
+ await await this.debugLog(`Received status code: ${statusCode}`);
2738
2739
  }
2739
2740
  } catch (error: any) {
2740
2741
  await this.errorLog(`Error making request: ${error.message}`);
2741
2742
  }
2742
2743
  retryCount++;
2743
- await this.debugLog(`Retry attempt ${retryCount} of ${maxRetries}`);
2744
+ await await this.debugLog(`Retry attempt ${retryCount} of ${maxRetries}`);
2744
2745
  await sleep(delayBetweenRetries);
2745
2746
  }
2746
2747
  return { body: null, statusCode: -1 };
@@ -2752,7 +2753,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2752
2753
  try {
2753
2754
  const SwitchBot = (await import('node-switchbot')).SwitchBot;
2754
2755
  queueScheduler.schedule(() => (switchbot = new SwitchBot()));
2755
- await this.debugLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' found: ${switchbot}`);
2756
+ await await this.debugLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' found: ${switchbot}`);
2756
2757
  } catch (e: any) {
2757
2758
  switchbot = false;
2758
2759
  await this.errorLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' found: ${switchbot}, Error: ${e}`);
@@ -2767,7 +2768,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2767
2768
  'utf-8',
2768
2769
  ),
2769
2770
  );
2770
- await this.debugLog(`Plugin Version: ${json.version}`);
2771
+ await await this.debugLog(`Plugin Version: ${json.version}`);
2771
2772
  this.version = json.version;
2772
2773
  }
2773
2774
 
@@ -2803,7 +2804,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2803
2804
  platformConfig.delayBetweenRetries = this.delayBetweenRetries / 1000;
2804
2805
  }
2805
2806
  if (Object.entries(platformConfig).length !== 0) {
2806
- await this.debugLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
2807
+ await await this.debugLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
2807
2808
  }
2808
2809
  this.platformConfig = platformConfig;
2809
2810
  }
@@ -2813,13 +2814,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2813
2814
  this.debugMode = process.argv.includes('-D') || process.argv.includes('--debug');
2814
2815
  if (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard' || this.config.options?.logging === 'none') {
2815
2816
  this.platformLogging = this.config.options.logging;
2816
- await this.debugWarnLog(`Using Config Logging: ${this.platformLogging}`);
2817
+ await await this.debugWarnLog(`Using Config Logging: ${this.platformLogging}`);
2817
2818
  } else if (this.debugMode) {
2818
2819
  this.platformLogging = 'debugMode';
2819
- await this.debugWarnLog(`Using ${this.platformLogging} Logging`);
2820
+ await await this.debugWarnLog(`Using ${this.platformLogging} Logging`);
2820
2821
  } else {
2821
2822
  this.platformLogging = 'standard';
2822
- await this.debugWarnLog(`Using ${this.platformLogging} Logging`);
2823
+ await await this.debugWarnLog(`Using ${this.platformLogging} Logging`);
2823
2824
  }
2824
2825
  }
2825
2826