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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/device/blindtilt.js +103 -103
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.js +84 -84
  5. package/dist/device/bot.js.map +1 -1
  6. package/dist/device/ceilinglight.js +97 -97
  7. package/dist/device/ceilinglight.js.map +1 -1
  8. package/dist/device/colorbulb.js +139 -139
  9. package/dist/device/colorbulb.js.map +1 -1
  10. package/dist/device/contact.js +47 -47
  11. package/dist/device/contact.js.map +1 -1
  12. package/dist/device/curtain.d.ts +1 -1
  13. package/dist/device/curtain.d.ts.map +1 -1
  14. package/dist/device/curtain.js +91 -89
  15. package/dist/device/curtain.js.map +1 -1
  16. package/dist/device/device.d.ts +12 -12
  17. package/dist/device/device.d.ts.map +1 -1
  18. package/dist/device/device.js +42 -42
  19. package/dist/device/device.js.map +1 -1
  20. package/dist/device/fan.js +95 -95
  21. package/dist/device/fan.js.map +1 -1
  22. package/dist/device/hub.js +46 -46
  23. package/dist/device/hub.js.map +1 -1
  24. package/dist/device/humidifier.js +84 -84
  25. package/dist/device/humidifier.js.map +1 -1
  26. package/dist/device/iosensor.js +44 -44
  27. package/dist/device/iosensor.js.map +1 -1
  28. package/dist/device/lightstrip.js +118 -118
  29. package/dist/device/lightstrip.js.map +1 -1
  30. package/dist/device/lock.js +74 -74
  31. package/dist/device/lock.js.map +1 -1
  32. package/dist/device/meter.js +44 -44
  33. package/dist/device/meter.js.map +1 -1
  34. package/dist/device/meterplus.js +42 -42
  35. package/dist/device/meterplus.js.map +1 -1
  36. package/dist/device/meterpro.js +42 -42
  37. package/dist/device/meterpro.js.map +1 -1
  38. package/dist/device/motion.js +44 -44
  39. package/dist/device/motion.js.map +1 -1
  40. package/dist/device/plug.d.ts.map +1 -1
  41. package/dist/device/plug.js +59 -59
  42. package/dist/device/plug.js.map +1 -1
  43. package/dist/device/robotvacuumcleaner.js +73 -73
  44. package/dist/device/robotvacuumcleaner.js.map +1 -1
  45. package/dist/device/waterdetector.js +44 -44
  46. package/dist/device/waterdetector.js.map +1 -1
  47. package/dist/irdevice/airconditioner.js +31 -31
  48. package/dist/irdevice/airconditioner.js.map +1 -1
  49. package/dist/irdevice/airpurifier.js +10 -10
  50. package/dist/irdevice/airpurifier.js.map +1 -1
  51. package/dist/irdevice/camera.js +9 -9
  52. package/dist/irdevice/camera.js.map +1 -1
  53. package/dist/irdevice/fan.js +11 -11
  54. package/dist/irdevice/fan.js.map +1 -1
  55. package/dist/irdevice/irdevice.js +11 -11
  56. package/dist/irdevice/irdevice.js.map +1 -1
  57. package/dist/irdevice/light.js +9 -9
  58. package/dist/irdevice/light.js.map +1 -1
  59. package/dist/irdevice/other.js +55 -55
  60. package/dist/irdevice/other.js.map +1 -1
  61. package/dist/irdevice/tv.js +33 -33
  62. package/dist/irdevice/tv.js.map +1 -1
  63. package/dist/irdevice/vacuumcleaner.js +9 -9
  64. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  65. package/dist/irdevice/waterheater.js +9 -9
  66. package/dist/irdevice/waterheater.js.map +1 -1
  67. package/dist/platform.js +228 -228
  68. package/dist/platform.js.map +1 -1
  69. package/package.json +9 -9
  70. package/src/device/blindtilt.ts +103 -103
  71. package/src/device/bot.ts +84 -84
  72. package/src/device/ceilinglight.ts +97 -97
  73. package/src/device/colorbulb.ts +139 -139
  74. package/src/device/contact.ts +47 -47
  75. package/src/device/curtain.ts +91 -89
  76. package/src/device/device.ts +42 -42
  77. package/src/device/fan.ts +95 -95
  78. package/src/device/hub.ts +46 -46
  79. package/src/device/humidifier.ts +84 -84
  80. package/src/device/iosensor.ts +44 -44
  81. package/src/device/lightstrip.ts +118 -118
  82. package/src/device/lock.ts +74 -74
  83. package/src/device/meter.ts +44 -44
  84. package/src/device/meterplus.ts +42 -42
  85. package/src/device/meterpro.ts +42 -42
  86. package/src/device/motion.ts +44 -44
  87. package/src/device/plug.ts +61 -61
  88. package/src/device/robotvacuumcleaner.ts +73 -73
  89. package/src/device/waterdetector.ts +44 -44
  90. package/src/irdevice/airconditioner.ts +31 -31
  91. package/src/irdevice/airpurifier.ts +10 -10
  92. package/src/irdevice/camera.ts +9 -9
  93. package/src/irdevice/fan.ts +11 -11
  94. package/src/irdevice/irdevice.ts +11 -11
  95. package/src/irdevice/light.ts +9 -9
  96. package/src/irdevice/other.ts +55 -55
  97. package/src/irdevice/tv.ts +33 -33
  98. package/src/irdevice/vacuumcleaner.ts +9 -9
  99. package/src/irdevice/waterheater.ts +9 -9
  100. package/src/platform.ts +228 -228
package/src/platform.ts CHANGED
@@ -184,13 +184,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
184
184
  // in order to ensure they weren't added to homebridge already. This event can also be used
185
185
  // to start discovery of new accessories.
186
186
  this.api.on('didFinishLaunching', async () => {
187
- await this.debugLog('Executed didFinishLaunching callback')
187
+ this.debugLog('Executed didFinishLaunching callback')
188
188
  // run the method to discover / register your devices as accessories
189
189
  try {
190
190
  await this.discoverDevices()
191
191
  } catch (e: any) {
192
- await this.errorLog(`Failed to Discover, Error Message: ${e.message ?? e}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug')
193
- await this.debugErrorLog(`Failed to Discover, Error: ${e.message ?? e}`)
192
+ this.errorLog(`Failed to Discover, Error Message: ${e.message ?? e}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug')
193
+ this.debugErrorLog(`Failed to Discover, Error: ${e.message ?? e}`)
194
194
  }
195
195
  })
196
196
 
@@ -216,27 +216,27 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
216
216
  try {
217
217
  const { connectAsync } = asyncmqtt
218
218
  this.mqttClient = await connectAsync(this.config.options?.mqttURL, this.config.options.mqttOptions || {})
219
- await this.debugLog('MQTT connection has been established successfully.')
219
+ this.debugLog('MQTT connection has been established successfully.')
220
220
  this.mqttClient.on('error', async (e: Error) => {
221
- await this.errorLog(`Failed to publish MQTT messages. ${e.message ?? e}`)
221
+ this.errorLog(`Failed to publish MQTT messages. ${e.message ?? e}`)
222
222
  })
223
223
  if (!this.config.options?.webhookURL) {
224
224
  // receive webhook events via MQTT
225
- await this.infoLog(`Webhook is configured to be received through ${this.config.options.mqttURL}/homebridge-switchbot/webhook.`)
225
+ this.infoLog(`Webhook is configured to be received through ${this.config.options.mqttURL}/homebridge-switchbot/webhook.`)
226
226
  this.mqttClient.subscribe('homebridge-switchbot/webhook/+')
227
227
  this.mqttClient.on('message', async (topic: string, message) => {
228
228
  try {
229
- await this.debugLog(`Received Webhook via MQTT: ${topic}=${message}`)
229
+ this.debugLog(`Received Webhook via MQTT: ${topic}=${message}`)
230
230
  const context = JSON.parse(message.toString())
231
231
  this.webhookEventHandler[context.deviceMac]?.(context)
232
232
  } catch (e: any) {
233
- await this.errorLog(`Failed to handle webhook event. Error:${e.message ?? e}`)
233
+ this.errorLog(`Failed to handle webhook event. Error:${e.message ?? e}`)
234
234
  }
235
235
  })
236
236
  }
237
237
  } catch (e: any) {
238
238
  this.mqttClient = null
239
- await this.errorLog(`Failed to establish MQTT connection. ${e.message ?? e}`)
239
+ this.errorLog(`Failed to establish MQTT connection. ${e.message ?? e}`)
240
240
  }
241
241
  }
242
242
  }
@@ -257,14 +257,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
257
257
  this.webhookEventHandler[body.context.deviceMac]?.(body.context)
258
258
  })
259
259
  } catch (e: any) {
260
- await this.errorLog(`Failed to setup webhook. Error:${e.message ?? e}`)
260
+ this.errorLog(`Failed to setup webhook. Error:${e.message ?? e}`)
261
261
  }
262
262
 
263
263
  this.api.on('shutdown', async () => {
264
264
  try {
265
265
  this.switchBotAPI.deleteWebhook(url)
266
266
  } catch (e: any) {
267
- await this.errorLog(`Failed to delete webhook. Error:${e.message ?? e}`)
267
+ this.errorLog(`Failed to delete webhook. Error:${e.message ?? e}`)
268
268
  }
269
269
  })
270
270
  }
@@ -304,25 +304,25 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
304
304
  })
305
305
  }
306
306
  if (this.config.options?.BLE) {
307
- await this.debugLog('setupBLE')
307
+ this.debugLog('setupBLE')
308
308
  if (this.switchBotBLE === undefined) {
309
- await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(this.switchBotBLE)}`)
309
+ this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(this.switchBotBLE)}`)
310
310
  } else {
311
311
  // Start to monitor advertisement packets
312
312
  (async () => {
313
313
  // Start to monitor advertisement packets
314
- await this.debugLog('Scanning for BLE SwitchBot devices...')
314
+ this.debugLog('Scanning for BLE SwitchBot devices...')
315
315
  try {
316
316
  await this.switchBotBLE.startScan()
317
317
  } catch (e: any) {
318
- await this.errorLog(`Failed to start BLE scanning. Error:${e.message ?? e}`)
318
+ this.errorLog(`Failed to start BLE scanning. Error:${e.message ?? e}`)
319
319
  }
320
320
  // Set an event handler to monitor advertisement packets
321
321
  this.switchBotBLE.onadvertisement = async (ad: any) => {
322
322
  try {
323
323
  this.bleEventHandler[ad.address]?.(ad.serviceData)
324
324
  } catch (e: any) {
325
- await this.errorLog(`Failed to handle BLE event. Error:${e.message ?? e}`)
325
+ this.errorLog(`Failed to handle BLE event. Error:${e.message ?? e}`)
326
326
  }
327
327
  }
328
328
  })()
@@ -330,14 +330,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
330
330
  this.api.on('shutdown', async () => {
331
331
  try {
332
332
  // this.switchBotBLE.stopScan()
333
- await this.infoLog('Stopped BLE scanning to close listening.')
333
+ this.infoLog('Stopped BLE scanning to close listening.')
334
334
  } catch (e: any) {
335
- await this.errorLog(`Failed to stop Platform BLE scanning. Error:${e.message ?? e}`)
335
+ this.errorLog(`Failed to stop Platform BLE scanning. Error:${e.message ?? e}`)
336
336
  }
337
337
  })
338
338
  }
339
339
  } else {
340
- await this.debugLog('Platform BLE is not enabled')
340
+ this.debugLog('Platform BLE is not enabled')
341
341
  }
342
342
  }
343
343
 
@@ -347,7 +347,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
347
347
  */
348
348
  async configureAccessory(accessory: PlatformAccessory) {
349
349
  const { displayName } = accessory
350
- await this.debugLog(`Loading accessory from cache: ${displayName}`)
350
+ this.debugLog(`Loading accessory from cache: ${displayName}`)
351
351
 
352
352
  // add the restored accessory to the accessories cache so we can track if it has already been registered
353
353
  this.accessories.push(accessory)
@@ -357,7 +357,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
357
357
  * Verify the config passed to the plugin is valid
358
358
  */
359
359
  async verifyConfig() {
360
- await this.debugLog('Verifying Config')
360
+ this.debugLog('Verifying Config')
361
361
  this.config = this.config || {}
362
362
  this.config.options = this.config.options || {}
363
363
 
@@ -372,7 +372,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
372
372
  platformConfig.pushRate = this.config.options.pushRate
373
373
  }
374
374
  if (Object.entries(platformConfig).length !== 0) {
375
- await this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`)
375
+ this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`)
376
376
  }
377
377
 
378
378
  if (this.config.options) {
@@ -395,10 +395,10 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
395
395
  for (const irDeviceConfig of this.config.options.irdevices) {
396
396
  if (!irDeviceConfig.hide_device) {
397
397
  if (!irDeviceConfig.deviceId) {
398
- await this.errorLog('The devices config section is missing the *Device ID* in the config. Please check your config.')
398
+ this.errorLog('The devices config section is missing the *Device ID* in the config. Please check your config.')
399
399
  }
400
400
  if (!irDeviceConfig.deviceId && !irDeviceConfig.configRemoteType) {
401
- await this.errorLog('The devices config section is missing the *Device Type* in the config. Please check your config.')
401
+ this.errorLog('The devices config section is missing the *Device Type* in the config. Please check your config.')
402
402
  }
403
403
  }
404
404
  }
@@ -412,18 +412,18 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
412
412
  if (!this.config.options.refreshRate) {
413
413
  // default 120 seconds (2 minutes)
414
414
  this.config.options!.refreshRate! = 120
415
- await this.debugWarnLog('Using Default Refresh Rate (2 minutes).')
415
+ this.debugWarnLog('Using Default Refresh Rate (2 minutes).')
416
416
  }
417
417
 
418
418
  if (!this.config.options.pushRate) {
419
419
  // default 100 milliseconds
420
420
  this.config.options!.pushRate! = 0.1
421
- await this.debugWarnLog('Using Default Push Rate.')
421
+ this.debugWarnLog('Using Default Push Rate.')
422
422
  }
423
423
 
424
424
  if (!this.config.options.maxRetries) {
425
425
  this.config.options.maxRetries = 5
426
- await this.debugWarnLog('Using Default Max Retries.')
426
+ this.debugWarnLog('Using Default Max Retries.')
427
427
  } else {
428
428
  this.maxRetries = this.config.options.maxRetries
429
429
  }
@@ -431,22 +431,22 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
431
431
  if (!this.config.options.delayBetweenRetries) {
432
432
  // default 3 seconds
433
433
  this.config.options!.delayBetweenRetries! = 3000
434
- await this.debugWarnLog('Using Default Delay Between Retries.')
434
+ this.debugWarnLog('Using Default Delay Between Retries.')
435
435
  } else {
436
436
  this.delayBetweenRetries = this.config.options.delayBetweenRetries * 1000
437
437
  }
438
438
 
439
439
  if (!this.config.credentials && !this.config.options) {
440
- await this.debugWarnLog('Missing Credentials')
440
+ this.debugWarnLog('Missing Credentials')
441
441
  } else if (this.config.credentials && !this.config.credentials.notice) {
442
442
  if (!this.config.credentials?.token) {
443
- await this.debugErrorLog('Missing token')
444
- await this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work')
443
+ this.debugErrorLog('Missing token')
444
+ this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work')
445
445
  }
446
446
  if (this.config.credentials?.token) {
447
447
  if (!this.config.credentials?.secret) {
448
- await this.debugErrorLog('Missing secret')
449
- await this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work')
448
+ this.debugErrorLog('Missing secret')
449
+ this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work')
450
450
  }
451
451
  }
452
452
  }
@@ -461,14 +461,14 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
461
461
  const maxRetries = this.maxRetries
462
462
  const delayBetweenRetries = this.delayBetweenRetries
463
463
 
464
- await this.debugWarnLog(`Retry Count: ${retryCount}`)
465
- await this.debugWarnLog(`Max Retries: ${maxRetries}`)
466
- await this.debugWarnLog(`Delay Between Retries: ${delayBetweenRetries}`)
464
+ this.debugWarnLog(`Retry Count: ${retryCount}`)
465
+ this.debugWarnLog(`Max Retries: ${maxRetries}`)
466
+ this.debugWarnLog(`Delay Between Retries: ${delayBetweenRetries}`)
467
467
 
468
468
  while (retryCount < maxRetries) {
469
469
  try {
470
470
  const { response, statusCode } = await this.switchBotAPI.getDevices()
471
- await this.debugLog(`response: ${JSON.stringify(response)}`)
471
+ this.debugLog(`response: ${JSON.stringify(response)}`)
472
472
  if (this.isSuccessfulResponse(statusCode)) {
473
473
  await this.handleDevices(Array.isArray(response.body.deviceList) ? response.body.deviceList : [])
474
474
  await this.handleIRDevices(Array.isArray(response.body.infraredRemoteList) ? response.body.infraredRemoteList : [])
@@ -479,31 +479,31 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
479
479
  }
480
480
  } catch (e: any) {
481
481
  retryCount++
482
- await this.debugErrorLog(`Failed to Discover Devices, Error Message: ${JSON.stringify(e.message)}, Submit Bugs Here: https://tinyurl.com/SwitchBotBug`)
483
- await this.debugErrorLog(`Failed to Discover Devices, Error: ${e.message ?? e}`)
482
+ this.debugErrorLog(`Failed to Discover Devices, Error Message: ${JSON.stringify(e.message)}, Submit Bugs Here: https://tinyurl.com/SwitchBotBug`)
483
+ this.debugErrorLog(`Failed to Discover Devices, Error: ${e.message ?? e}`)
484
484
  }
485
485
  }
486
486
  }
487
487
 
488
488
  private async handleManualConfig() {
489
489
  if (this.config.options?.devices) {
490
- await this.debugLog(`SwitchBot Device Manual Config Set: ${JSON.stringify(this.config.options?.devices)}`)
490
+ this.debugLog(`SwitchBot Device Manual Config Set: ${JSON.stringify(this.config.options?.devices)}`)
491
491
  const devices = this.config.options.devices.map((v: any) => v)
492
492
  for (const device of devices) {
493
493
  device.deviceType = device.configDeviceType
494
494
  device.deviceName = device.configDeviceName
495
495
  try {
496
496
  device.deviceId = formatDeviceIdAsMac(device.deviceId, true)
497
- await this.debugLog(`deviceId: ${device.deviceId}`)
497
+ this.debugLog(`deviceId: ${device.deviceId}`)
498
498
  if (device.deviceType) {
499
499
  await this.createDevice(device)
500
500
  }
501
501
  } catch (error) {
502
- await this.errorLog(`failed to format device ID as MAC, Error: ${error}`)
502
+ this.errorLog(`failed to format device ID as MAC, Error: ${error}`)
503
503
  }
504
504
  }
505
505
  } else {
506
- await this.errorLog('Neither SwitchBot Token or Device Config are set.')
506
+ this.errorLog('Neither SwitchBot Token or Device Config are set.')
507
507
  }
508
508
  }
509
509
 
@@ -513,9 +513,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
513
513
 
514
514
  private async handleDevices(deviceLists: any[]) {
515
515
  if (!this.config.options?.devices && !this.config.options?.deviceConfig) {
516
- await this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`)
516
+ this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`)
517
517
  if (deviceLists.length === 0) {
518
- await this.debugLog('SwitchBot API Has No Devices With Cloud Services Enabled')
518
+ this.debugLog('SwitchBot API Has No Devices With Cloud Services Enabled')
519
519
  } else {
520
520
  for (const device of deviceLists) {
521
521
  if (device.deviceType) {
@@ -527,15 +527,15 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
527
527
  }
528
528
  }
529
529
  } else if (this.config.options?.devices || this.config.options?.deviceConfig) {
530
- await this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`)
530
+ this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`)
531
531
 
532
532
  // Step 1: Check and assign configDeviceType to deviceType if deviceType is not present
533
533
  const devicesWithTypeConfigPromises = deviceLists.map(async (device) => {
534
534
  if (!device.deviceType && device.configDeviceType) {
535
535
  device.deviceType = device.configDeviceType
536
- await this.warnLog(`API is displaying no deviceType: ${device.deviceType}, So using configDeviceType: ${device.configDeviceType}`)
536
+ this.warnLog(`API is displaying no deviceType: ${device.deviceType}, So using configDeviceType: ${device.configDeviceType}`)
537
537
  } else if (!device.deviceType && !device.configDeviceName) {
538
- await this.errorLog('No deviceType or configDeviceType for device. No device will be created.')
538
+ this.errorLog('No deviceType or configDeviceType for device. No device will be created.')
539
539
  return null // Skip this device
540
540
  }
541
541
 
@@ -549,7 +549,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
549
549
 
550
550
  const devices = this.mergeByDeviceId(this.config.options.devices ?? [], devicesWithTypeConfig ?? [])
551
551
 
552
- await this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`)
552
+ this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`)
553
553
 
554
554
  for (const device of devices) {
555
555
  const deviceIdConfig = this.config.options?.devices?.[device.deviceId] || {}
@@ -566,22 +566,22 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
566
566
 
567
567
  private async handleIRDevices(irDeviceLists: any[]) {
568
568
  if (!this.config.options?.irdevices && !this.config.options?.irdeviceConfig) {
569
- await this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`)
569
+ this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`)
570
570
  for (const device of irDeviceLists) {
571
571
  if (device.remoteType) {
572
572
  await this.createIRDevice(device)
573
573
  }
574
574
  }
575
575
  } else if (this.config.options?.irdevices || this.config.options?.irdeviceConfig) {
576
- await this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`)
576
+ this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`)
577
577
 
578
578
  // Step 1: Check and assign configRemoteType to remoteType if remoteType is not present
579
579
  const devicesWithTypeConfigPromises = irDeviceLists.map(async (device) => {
580
580
  if (!device.remoteType && device.configRemoteType) {
581
581
  device.remoteType = device.configRemoteType
582
- await this.warnLog(`API is displaying no remoteType: ${device.remoteType}, So using configRemoteType: ${device.configRemoteType}`)
582
+ this.warnLog(`API is displaying no remoteType: ${device.remoteType}, So using configRemoteType: ${device.configRemoteType}`)
583
583
  } else if (!device.remoteType && !device.configDeviceName) {
584
- await this.errorLog('No remoteType or configRemoteType for device. No device will be created.')
584
+ this.errorLog('No remoteType or configRemoteType for device. No device will be created.')
585
585
  return null // Skip this device
586
586
  }
587
587
 
@@ -594,7 +594,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
594
594
 
595
595
  const devices = this.mergeByDeviceId(this.config.options.irdevices ?? [], devicesWithRemoteTypeConfig ?? [])
596
596
 
597
- await this.debugLog(`IR Devices: ${JSON.stringify(devices)}`)
597
+ this.debugLog(`IR Devices: ${JSON.stringify(devices)}`)
598
598
  for (const device of devices) {
599
599
  const irdeviceIdConfig = this.config.options?.irdevices?.[device.deviceId] || {}
600
600
  const irdeviceWithConfig = Object.assign({}, device, irdeviceIdConfig)
@@ -661,12 +661,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
661
661
  }
662
662
 
663
663
  if (deviceTypeHandlers[device.deviceType!]) {
664
- await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`)
664
+ this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`)
665
665
  await deviceTypeHandlers[device.deviceType!](device)
666
666
  } else if (['Hub Mini', 'Hub Plus', 'Remote', 'Indoor Cam', 'remote with screen'].includes(device.deviceType!)) {
667
- await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}, is currently not supported, device: ${JSON.stringify(device)}`)
667
+ this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}, is currently not supported, device: ${JSON.stringify(device)}`)
668
668
  } else {
669
- await this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.deviceType}, is currently not supported. Submit Feature Requests Here: https://tinyurl.com/SwitchBotFeatureRequest, device: ${JSON.stringify(device)}`)
669
+ this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.deviceType}, is currently not supported. Submit Feature Requests Here: https://tinyurl.com/SwitchBotFeatureRequest, device: ${JSON.stringify(device)}`)
670
670
  }
671
671
  }
672
672
 
@@ -703,13 +703,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
703
703
  }
704
704
 
705
705
  if (deviceTypeHandlers[device.remoteType!]) {
706
- await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`)
706
+ this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`)
707
707
  if (device.remoteType.startsWith('DIY') && device.external === undefined) {
708
708
  device.external = true
709
709
  }
710
710
  await deviceTypeHandlers[device.remoteType!](device)
711
711
  } else {
712
- await this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.remoteType}, is currently not supported. Submit Feature Requests Here: https://tinyurl.com/SwitchBotFeatureRequest, device: ${JSON.stringify(device)}`)
712
+ this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.remoteType}, is currently not supported. Submit Feature Requests Here: https://tinyurl.com/SwitchBotFeatureRequest, device: ${JSON.stringify(device)}`)
713
713
  }
714
714
  }
715
715
 
@@ -733,12 +733,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
733
733
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
734
734
  existingAccessory.context.connectionType = await this.connectionType(device)
735
735
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
736
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
736
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
737
737
  this.api.updatePlatformAccessories([existingAccessory])
738
738
  // create the accessory handler for the restored accessory
739
739
  // this is imported from `platformAccessory.ts`
740
740
  new Humidifier(this, existingAccessory, device)
741
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
741
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
742
742
  } else {
743
743
  this.unregisterPlatformAccessories(existingAccessory)
744
744
  }
@@ -760,17 +760,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
760
760
  accessory.context.connectionType = await this.connectionType(device)
761
761
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
762
762
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
763
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
763
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
764
764
  // create the accessory handler for the newly create accessory
765
765
  // this is imported from `platformAccessory.ts`
766
766
  new Humidifier(this, accessory, device)
767
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
767
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
768
768
 
769
769
  // publish device externally or link the accessory to your platform
770
770
  this.externalOrPlatform(device, accessory)
771
771
  this.accessories.push(accessory)
772
772
  } else {
773
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
773
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
774
774
  }
775
775
  }
776
776
 
@@ -799,7 +799,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
799
799
  // create the accessory handler for the restored accessory
800
800
  // this is imported from `platformAccessory.ts`
801
801
  new Bot(this, existingAccessory, device)
802
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
802
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
803
803
  } else {
804
804
  this.unregisterPlatformAccessories(existingAccessory)
805
805
  }
@@ -822,18 +822,18 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
822
822
  accessory.context.connectionType = await this.connectionType(device)
823
823
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
824
824
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
825
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
825
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
826
826
  // accessory.context.version = findaccessories.accessoryAttribute.softwareRevision;
827
827
  // create the accessory handler for the newly create accessory
828
828
  // this is imported from `platformAccessory.ts`
829
829
  new Bot(this, accessory, device)
830
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
830
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
831
831
 
832
832
  // publish device externally or link the accessory to your platform
833
833
  this.externalOrPlatform(device, accessory)
834
834
  this.accessories.push(accessory)
835
835
  } else {
836
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
836
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
837
837
  }
838
838
  }
839
839
 
@@ -862,7 +862,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
862
862
  // create the accessory handler for the restored accessory
863
863
  // this is imported from `platformAccessory.ts`
864
864
  new Meter(this, existingAccessory, device)
865
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
865
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
866
866
  } else {
867
867
  this.unregisterPlatformAccessories(existingAccessory)
868
868
  }
@@ -885,17 +885,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
885
885
  accessory.context.connectionType = await this.connectionType(device)
886
886
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
887
887
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
888
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
888
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
889
889
  // create the accessory handler for the newly create accessory
890
890
  // this is imported from `platformAccessory.ts`
891
891
  new Meter(this, accessory, device)
892
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
892
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
893
893
 
894
894
  // publish device externally or link the accessory to your platform
895
895
  this.externalOrPlatform(device, accessory)
896
896
  this.accessories.push(accessory)
897
897
  } else {
898
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
898
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
899
899
  }
900
900
  }
901
901
 
@@ -925,7 +925,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
925
925
  // create the accessory handler for the restored accessory
926
926
  // this is imported from `platformAccessory.ts`
927
927
  new MeterPlus(this, existingAccessory, device)
928
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
928
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
929
929
  } else {
930
930
  this.unregisterPlatformAccessories(existingAccessory)
931
931
  }
@@ -948,17 +948,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
948
948
  accessory.context.connectionType = await this.connectionType(device)
949
949
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
950
950
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
951
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
951
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
952
952
  // create the accessory handler for the newly create accessory
953
953
  // this is imported from `platformAccessory.ts`
954
954
  new MeterPlus(this, accessory, device)
955
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
955
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
956
956
 
957
957
  // publish device externally or link the accessory to your platform
958
958
  this.externalOrPlatform(device, accessory)
959
959
  this.accessories.push(accessory)
960
960
  } else {
961
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
961
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
962
962
  }
963
963
  }
964
964
 
@@ -988,7 +988,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
988
988
  // create the accessory handler for the restored accessory
989
989
  // this is imported from `platformAccessory.ts`
990
990
  new MeterPro(this, existingAccessory, device)
991
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
991
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
992
992
  } else {
993
993
  this.unregisterPlatformAccessories(existingAccessory)
994
994
  }
@@ -1011,17 +1011,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1011
1011
  accessory.context.connectionType = await this.connectionType(device)
1012
1012
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1013
1013
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1014
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1014
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1015
1015
  // create the accessory handler for the newly create accessory
1016
1016
  // this is imported from `platformAccessory.ts`
1017
1017
  new MeterPro(this, accessory, device)
1018
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1018
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1019
1019
 
1020
1020
  // publish device externally or link the accessory to your platform
1021
1021
  this.externalOrPlatform(device, accessory)
1022
1022
  this.accessories.push(accessory)
1023
1023
  } else {
1024
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1024
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1025
1025
  }
1026
1026
  }
1027
1027
 
@@ -1051,7 +1051,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1051
1051
  // create the accessory handler for the restored accessory
1052
1052
  // this is imported from `platformAccessory.ts`
1053
1053
  new Hub(this, existingAccessory, device)
1054
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1054
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1055
1055
  } else {
1056
1056
  this.unregisterPlatformAccessories(existingAccessory)
1057
1057
  }
@@ -1074,17 +1074,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1074
1074
  accessory.context.connectionType = await this.connectionType(device)
1075
1075
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1076
1076
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1077
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1077
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1078
1078
  // create the accessory handler for the newly create accessory
1079
1079
  // this is imported from `platformAccessory.ts`
1080
1080
  new Hub(this, accessory, device)
1081
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1081
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1082
1082
 
1083
1083
  // publish device externally or link the accessory to your platform
1084
1084
  this.externalOrPlatform(device, accessory)
1085
1085
  this.accessories.push(accessory)
1086
1086
  } else {
1087
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1087
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1088
1088
  }
1089
1089
  }
1090
1090
 
@@ -1108,12 +1108,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1108
1108
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1109
1109
  existingAccessory.context.connectionType = await this.connectionType(device)
1110
1110
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1111
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1111
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1112
1112
  this.api.updatePlatformAccessories([existingAccessory])
1113
1113
  // create the accessory handler for the restored accessory
1114
1114
  // this is imported from `platformAccessory.ts`
1115
1115
  new IOSensor(this, existingAccessory, device)
1116
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1116
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1117
1117
  } else {
1118
1118
  this.unregisterPlatformAccessories(existingAccessory)
1119
1119
  }
@@ -1136,17 +1136,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1136
1136
  accessory.context.connectionType = await this.connectionType(device)
1137
1137
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1138
1138
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1139
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1139
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1140
1140
  // create the accessory handler for the newly create accessory
1141
1141
  // this is imported from `platformAccessory.ts`
1142
1142
  new IOSensor(this, accessory, device)
1143
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1143
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1144
1144
 
1145
1145
  // publish device externally or link the accessory to your platform
1146
1146
  this.externalOrPlatform(device, accessory)
1147
1147
  this.accessories.push(accessory)
1148
1148
  } else {
1149
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1149
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1150
1150
  }
1151
1151
  }
1152
1152
 
@@ -1175,7 +1175,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1175
1175
  // create the accessory handler for the restored accessory
1176
1176
  // this is imported from `platformAccessory.ts`
1177
1177
  new WaterDetector(this, existingAccessory, device)
1178
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1178
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1179
1179
  } else {
1180
1180
  this.unregisterPlatformAccessories(existingAccessory)
1181
1181
  }
@@ -1198,17 +1198,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1198
1198
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1199
1199
  accessory.context.connectionType = await this.connectionType(device)
1200
1200
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1201
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1201
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1202
1202
  // create the accessory handler for the newly create accessory
1203
1203
  // this is imported from `platformAccessory.ts`
1204
1204
  new WaterDetector(this, accessory, device)
1205
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1205
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1206
1206
 
1207
1207
  // publish device externally or link the accessory to your platform
1208
1208
  this.externalOrPlatform(device, accessory)
1209
1209
  this.accessories.push(accessory)
1210
1210
  } else {
1211
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1211
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1212
1212
  }
1213
1213
  }
1214
1214
 
@@ -1237,7 +1237,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1237
1237
  // create the accessory handler for the restored accessory
1238
1238
  // this is imported from `platformAccessory.ts`
1239
1239
  new Motion(this, existingAccessory, device)
1240
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1240
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1241
1241
  } else {
1242
1242
  this.unregisterPlatformAccessories(existingAccessory)
1243
1243
  }
@@ -1260,17 +1260,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1260
1260
  accessory.context.connectionType = await this.connectionType(device)
1261
1261
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1262
1262
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1263
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1263
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1264
1264
  // create the accessory handler for the newly create accessory
1265
1265
  // this is imported from `platformAccessory.ts`
1266
1266
  new Motion(this, accessory, device)
1267
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1267
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1268
1268
 
1269
1269
  // publish device externally or link the accessory to your platform
1270
1270
  this.externalOrPlatform(device, accessory)
1271
1271
  this.accessories.push(accessory)
1272
1272
  } else {
1273
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1273
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1274
1274
  }
1275
1275
  }
1276
1276
 
@@ -1299,7 +1299,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1299
1299
  // create the accessory handler for the restored accessory
1300
1300
  // this is imported from `platformAccessory.ts`
1301
1301
  new Contact(this, existingAccessory, device)
1302
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1302
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1303
1303
  } else {
1304
1304
  this.unregisterPlatformAccessories(existingAccessory)
1305
1305
  }
@@ -1322,17 +1322,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1322
1322
  accessory.context.connectionType = await this.connectionType(device)
1323
1323
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1324
1324
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1325
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1325
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1326
1326
  // create the accessory handler for the newly create accessory
1327
1327
  // this is imported from `platformAccessory.ts`
1328
1328
  new Contact(this, accessory, device)
1329
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1329
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1330
1330
 
1331
1331
  // publish device externally or link the accessory to your platform
1332
1332
  this.externalOrPlatform(device, accessory)
1333
1333
  this.accessories.push(accessory)
1334
1334
  } else {
1335
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1335
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1336
1336
  }
1337
1337
  }
1338
1338
 
@@ -1361,7 +1361,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1361
1361
  // create the accessory handler for the restored accessory
1362
1362
  // this is imported from `platformAccessory.ts`
1363
1363
  new BlindTilt(this, existingAccessory, device as blindTiltConfig)
1364
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1364
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1365
1365
  } else {
1366
1366
  this.unregisterPlatformAccessories(existingAccessory)
1367
1367
  }
@@ -1399,17 +1399,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1399
1399
  accessory.context.connectionType = await this.connectionType(device)
1400
1400
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1401
1401
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1402
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1402
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1403
1403
  // create the accessory handler for the newly create accessory
1404
1404
  // this is imported from `platformAccessory.ts`
1405
1405
  new BlindTilt(this, accessory, device as blindTiltConfig)
1406
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1406
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1407
1407
 
1408
1408
  // publish device externally or link the accessory to your platform
1409
1409
  this.externalOrPlatform(device, accessory)
1410
1410
  this.accessories.push(accessory)
1411
1411
  } else {
1412
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1412
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1413
1413
  }
1414
1414
  }
1415
1415
 
@@ -1433,12 +1433,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1433
1433
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1434
1434
  existingAccessory.context.connectionType = await this.connectionType(device)
1435
1435
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1436
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1436
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1437
1437
  this.api.updatePlatformAccessories([existingAccessory])
1438
1438
  // create the accessory handler for the restored accessory
1439
1439
  // this is imported from `platformAccessory.ts`
1440
1440
  new Curtain(this, existingAccessory, device as curtainConfig)
1441
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1441
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1442
1442
  } else {
1443
1443
  this.unregisterPlatformAccessories(existingAccessory)
1444
1444
  }
@@ -1476,17 +1476,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1476
1476
  accessory.context.connectionType = await this.connectionType(device)
1477
1477
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1478
1478
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1479
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1479
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1480
1480
  // create the accessory handler for the newly create accessory
1481
1481
  // this is imported from `platformAccessory.ts`
1482
1482
  new Curtain(this, accessory, device as curtainConfig)
1483
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1483
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1484
1484
 
1485
1485
  // publish device externally or link the accessory to your platform
1486
1486
  this.externalOrPlatform(device, accessory)
1487
1487
  this.accessories.push(accessory)
1488
1488
  } else {
1489
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1489
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1490
1490
  }
1491
1491
  }
1492
1492
 
@@ -1514,12 +1514,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1514
1514
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1515
1515
  existingAccessory.context.connectionType = await this.connectionType(device)
1516
1516
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1517
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1517
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1518
1518
  this.api.updatePlatformAccessories([existingAccessory])
1519
1519
  // create the accessory handler for the restored accessory
1520
1520
  // this is imported from `platformAccessory.ts`
1521
1521
  new Plug(this, existingAccessory, device)
1522
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1522
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1523
1523
  } else {
1524
1524
  this.unregisterPlatformAccessories(existingAccessory)
1525
1525
  }
@@ -1546,17 +1546,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1546
1546
  accessory.context.connectionType = await this.connectionType(device)
1547
1547
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1548
1548
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1549
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1549
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1550
1550
  // create the accessory handler for the newly create accessory
1551
1551
  // this is imported from `platformAccessory.ts`
1552
1552
  new Plug(this, accessory, device)
1553
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1553
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1554
1554
 
1555
1555
  // publish device externally or link the accessory to your platform
1556
1556
  this.externalOrPlatform(device, accessory)
1557
1557
  this.accessories.push(accessory)
1558
1558
  } else {
1559
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1559
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1560
1560
  }
1561
1561
  }
1562
1562
 
@@ -1585,7 +1585,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1585
1585
  // create the accessory handler for the restored accessory
1586
1586
  // this is imported from `platformAccessory.ts`
1587
1587
  new Lock(this, existingAccessory, device)
1588
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1588
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1589
1589
  } else {
1590
1590
  this.unregisterPlatformAccessories(existingAccessory)
1591
1591
  }
@@ -1608,17 +1608,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1608
1608
  accessory.context.connectionType = await this.connectionType(device)
1609
1609
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1610
1610
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1611
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1611
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1612
1612
  // create the accessory handler for the newly create accessory
1613
1613
  // this is imported from `platformAccessory.ts`
1614
1614
  new Lock(this, accessory, device)
1615
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1615
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1616
1616
 
1617
1617
  // publish device externally or link the accessory to your platform
1618
1618
  this.externalOrPlatform(device, accessory)
1619
1619
  this.accessories.push(accessory)
1620
1620
  } else {
1621
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1621
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1622
1622
  }
1623
1623
  }
1624
1624
 
@@ -1642,12 +1642,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1642
1642
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1643
1643
  existingAccessory.context.connectionType = await this.connectionType(device)
1644
1644
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1645
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1645
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1646
1646
  this.api.updatePlatformAccessories([existingAccessory])
1647
1647
  // create the accessory handler for the restored accessory
1648
1648
  // this is imported from `platformAccessory.ts`
1649
1649
  new ColorBulb(this, existingAccessory, device)
1650
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1650
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1651
1651
  } else {
1652
1652
  this.unregisterPlatformAccessories(existingAccessory)
1653
1653
  }
@@ -1670,17 +1670,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1670
1670
  accessory.context.connectionType = await this.connectionType(device)
1671
1671
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1672
1672
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1673
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1673
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1674
1674
  // create the accessory handler for the newly create accessory
1675
1675
  // this is imported from `platformAccessory.ts`
1676
1676
  new ColorBulb(this, accessory, device)
1677
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1677
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1678
1678
 
1679
1679
  // publish device externally or link the accessory to your platform
1680
1680
  this.externalOrPlatform(device, accessory)
1681
1681
  this.accessories.push(accessory)
1682
1682
  } else {
1683
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1683
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1684
1684
  }
1685
1685
  }
1686
1686
 
@@ -1704,12 +1704,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1704
1704
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1705
1705
  existingAccessory.context.connectionType = await this.connectionType(device)
1706
1706
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1707
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1707
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1708
1708
  this.api.updatePlatformAccessories([existingAccessory])
1709
1709
  // create the accessory handler for the restored accessory
1710
1710
  // this is imported from `platformAccessory.ts`
1711
1711
  new CeilingLight(this, existingAccessory, device)
1712
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1712
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1713
1713
  } else {
1714
1714
  this.unregisterPlatformAccessories(existingAccessory)
1715
1715
  }
@@ -1732,17 +1732,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1732
1732
  accessory.context.connectionType = await this.connectionType(device)
1733
1733
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1734
1734
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1735
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1735
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1736
1736
  // create the accessory handler for the newly create accessory
1737
1737
  // this is imported from `platformAccessory.ts`
1738
1738
  new CeilingLight(this, accessory, device)
1739
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1739
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1740
1740
 
1741
1741
  // publish device externally or link the accessory to your platform
1742
1742
  this.externalOrPlatform(device, accessory)
1743
1743
  this.accessories.push(accessory)
1744
1744
  } else {
1745
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1745
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1746
1746
  }
1747
1747
  }
1748
1748
 
@@ -1766,12 +1766,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1766
1766
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1767
1767
  existingAccessory.context.connectionType = await this.connectionType(device)
1768
1768
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1769
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1769
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1770
1770
  this.api.updatePlatformAccessories([existingAccessory])
1771
1771
  // create the accessory handler for the restored accessory
1772
1772
  // this is imported from `platformAccessory.ts`
1773
1773
  new StripLight(this, existingAccessory, device)
1774
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1774
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1775
1775
  } else {
1776
1776
  this.unregisterPlatformAccessories(existingAccessory)
1777
1777
  }
@@ -1794,17 +1794,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1794
1794
  accessory.context.connectionType = await this.connectionType(device)
1795
1795
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1796
1796
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1797
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1797
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1798
1798
  // create the accessory handler for the newly create accessory
1799
1799
  // this is imported from `platformAccessory.ts`
1800
1800
  new StripLight(this, accessory, device)
1801
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1801
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1802
1802
 
1803
1803
  // publish device externally or link the accessory to your platform
1804
1804
  this.externalOrPlatform(device, accessory)
1805
1805
  this.accessories.push(accessory)
1806
1806
  } else {
1807
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1807
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1808
1808
  }
1809
1809
  }
1810
1810
 
@@ -1828,12 +1828,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1828
1828
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1829
1829
  existingAccessory.context.connectionType = await this.connectionType(device)
1830
1830
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1831
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1831
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1832
1832
  this.api.updatePlatformAccessories([existingAccessory])
1833
1833
  // create the accessory handler for the restored accessory
1834
1834
  // this is imported from `platformAccessory.ts`
1835
1835
  new Fan(this, existingAccessory, device)
1836
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1836
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1837
1837
  } else {
1838
1838
  this.unregisterPlatformAccessories(existingAccessory)
1839
1839
  }
@@ -1856,17 +1856,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1856
1856
  accessory.context.connectionType = await this.connectionType(device)
1857
1857
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1858
1858
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1859
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1859
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1860
1860
  // create the accessory handler for the newly create accessory
1861
1861
  // this is imported from `platformAccessory.ts`
1862
1862
  new Fan(this, accessory, device)
1863
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1863
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1864
1864
 
1865
1865
  // publish device externally or link the accessory to your platform
1866
1866
  this.externalOrPlatform(device, accessory)
1867
1867
  this.accessories.push(accessory)
1868
1868
  } else {
1869
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1869
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1870
1870
  }
1871
1871
  }
1872
1872
 
@@ -1900,12 +1900,12 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1900
1900
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1901
1901
  existingAccessory.context.connectionType = await this.connectionType(device)
1902
1902
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1903
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1903
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1904
1904
  this.api.updatePlatformAccessories([existingAccessory])
1905
1905
  // create the accessory handler for the restored accessory
1906
1906
  // this is imported from `platformAccessory.ts`
1907
1907
  new RobotVacuumCleaner(this, existingAccessory, device)
1908
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1908
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`)
1909
1909
  } else {
1910
1910
  this.unregisterPlatformAccessories(existingAccessory)
1911
1911
  }
@@ -1938,17 +1938,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1938
1938
  accessory.context.connectionType = await this.connectionType(device)
1939
1939
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0'
1940
1940
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1941
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1941
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1942
1942
  // create the accessory handler for the newly create accessory
1943
1943
  // this is imported from `platformAccessory.ts`
1944
1944
  new RobotVacuumCleaner(this, accessory, device)
1945
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1945
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`)
1946
1946
 
1947
1947
  // publish device externally or link the accessory to your platform
1948
1948
  this.externalOrPlatform(device, accessory)
1949
1949
  this.accessories.push(accessory)
1950
1950
  } else {
1951
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1951
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`)
1952
1952
  }
1953
1953
  }
1954
1954
 
@@ -1968,13 +1968,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1968
1968
  existingAccessory.displayName = device.configDeviceName
1969
1969
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
1970
1970
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
1971
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1971
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
1972
1972
  existingAccessory.context.connectionType = device.connectionType
1973
1973
  this.api.updatePlatformAccessories([existingAccessory])
1974
1974
  // create the accessory handler for the restored accessory
1975
1975
  // this is imported from `platformAccessory.ts`
1976
1976
  new TV(this, existingAccessory, device)
1977
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
1977
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
1978
1978
  } else if (!device.hide_device && device.hubDeviceId) {
1979
1979
  // create a new accessory
1980
1980
  const accessory = new this.api.platformAccessory(device.configDeviceName
@@ -1993,16 +1993,16 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1993
1993
  accessory.context.connectionType = await this.connectionType(device)
1994
1994
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
1995
1995
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
1996
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1996
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
1997
1997
  // create the accessory handler for the newly create accessory
1998
1998
  // this is imported from `platformAccessory.ts`
1999
1999
  new TV(this, accessory, device)
2000
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2000
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2001
2001
 
2002
2002
  this.externalOrPlatform(device, accessory)
2003
2003
  this.accessories.push(accessory)
2004
2004
  } else {
2005
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2005
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2006
2006
  }
2007
2007
  }
2008
2008
 
@@ -2024,13 +2024,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2024
2024
  existingAccessory.displayName = device.configDeviceName
2025
2025
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2026
2026
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
2027
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2027
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2028
2028
  existingAccessory.context.connectionType = device.connectionType
2029
2029
  this.api.updatePlatformAccessories([existingAccessory])
2030
2030
  // create the accessory handler for the restored accessory
2031
2031
  // this is imported from `platformAccessory.ts`
2032
2032
  new IRFan(this, existingAccessory, device)
2033
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2033
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2034
2034
  } else {
2035
2035
  this.unregisterPlatformAccessories(existingAccessory)
2036
2036
  }
@@ -2052,17 +2052,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2052
2052
  accessory.context.connectionType = await this.connectionType(device)
2053
2053
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
2054
2054
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
2055
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2055
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2056
2056
  // create the accessory handler for the newly create accessory
2057
2057
  // this is imported from `platformAccessory.ts`
2058
2058
  new IRFan(this, accessory, device)
2059
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2059
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2060
2060
 
2061
2061
  // publish device externally or link the accessory to your platform
2062
2062
  this.externalOrPlatform(device, accessory)
2063
2063
  this.accessories.push(accessory)
2064
2064
  } else {
2065
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2065
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2066
2066
  }
2067
2067
  }
2068
2068
 
@@ -2084,13 +2084,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2084
2084
  existingAccessory.displayName = device.configDeviceName
2085
2085
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2086
2086
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
2087
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2087
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2088
2088
  existingAccessory.context.connectionType = device.connectionType
2089
2089
  this.api.updatePlatformAccessories([existingAccessory])
2090
2090
  // create the accessory handler for the restored accessory
2091
2091
  // this is imported from `platformAccessory.ts`
2092
2092
  new Light(this, existingAccessory, device)
2093
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2093
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2094
2094
  } else {
2095
2095
  this.unregisterPlatformAccessories(existingAccessory)
2096
2096
  }
@@ -2112,17 +2112,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2112
2112
  accessory.context.connectionType = await this.connectionType(device)
2113
2113
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
2114
2114
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
2115
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2115
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2116
2116
  // create the accessory handler for the newly create accessory
2117
2117
  // this is imported from `platformAccessory.ts`
2118
2118
  new Light(this, accessory, device)
2119
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2119
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2120
2120
 
2121
2121
  // publish device externally or link the accessory to your platform
2122
2122
  this.externalOrPlatform(device, accessory)
2123
2123
  this.accessories.push(accessory)
2124
2124
  } else {
2125
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2125
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2126
2126
  }
2127
2127
  }
2128
2128
 
@@ -2144,13 +2144,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2144
2144
  existingAccessory.displayName = device.configDeviceName
2145
2145
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2146
2146
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
2147
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2147
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2148
2148
  existingAccessory.context.connectionType = device.connectionType
2149
2149
  this.api.updatePlatformAccessories([existingAccessory])
2150
2150
  // create the accessory handler for the restored accessory
2151
2151
  // this is imported from `platformAccessory.ts`
2152
2152
  new AirConditioner(this, existingAccessory, device)
2153
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2153
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2154
2154
  } else {
2155
2155
  this.unregisterPlatformAccessories(existingAccessory)
2156
2156
  }
@@ -2172,17 +2172,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2172
2172
  accessory.context.connectionType = await this.connectionType(device)
2173
2173
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
2174
2174
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
2175
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2175
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2176
2176
  // create the accessory handler for the newly create accessory
2177
2177
  // this is imported from `platformAccessory.ts`
2178
2178
  new AirConditioner(this, accessory, device)
2179
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2179
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2180
2180
 
2181
2181
  // publish device externally or link the accessory to your platform
2182
2182
  this.externalOrPlatform(device, accessory)
2183
2183
  this.accessories.push(accessory)
2184
2184
  } else {
2185
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2185
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2186
2186
  }
2187
2187
  }
2188
2188
 
@@ -2204,13 +2204,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2204
2204
  existingAccessory.displayName = device.configDeviceName
2205
2205
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2206
2206
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
2207
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2207
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2208
2208
  existingAccessory.context.connectionType = device.connectionType
2209
2209
  this.api.updatePlatformAccessories([existingAccessory])
2210
2210
  // create the accessory handler for the restored accessory
2211
2211
  // this is imported from `platformAccessory.ts`
2212
2212
  new AirPurifier(this, existingAccessory, device)
2213
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2213
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2214
2214
  } else {
2215
2215
  this.unregisterPlatformAccessories(existingAccessory)
2216
2216
  }
@@ -2232,17 +2232,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2232
2232
  accessory.context.connectionType = await this.connectionType(device)
2233
2233
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
2234
2234
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
2235
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2235
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2236
2236
  // create the accessory handler for the newly create accessory
2237
2237
  // this is imported from `platformAccessory.ts`
2238
2238
  new AirPurifier(this, accessory, device)
2239
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2239
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2240
2240
 
2241
2241
  // publish device externally or link the accessory to your platform
2242
2242
  this.externalOrPlatform(device, accessory)
2243
2243
  this.accessories.push(accessory)
2244
2244
  } else {
2245
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2245
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2246
2246
  }
2247
2247
  }
2248
2248
 
@@ -2264,13 +2264,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2264
2264
  existingAccessory.displayName = device.configDeviceName
2265
2265
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2266
2266
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
2267
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2267
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2268
2268
  existingAccessory.context.connectionType = device.connectionType
2269
2269
  this.api.updatePlatformAccessories([existingAccessory])
2270
2270
  // create the accessory handler for the restored accessory
2271
2271
  // this is imported from `platformAccessory.ts`
2272
2272
  new WaterHeater(this, existingAccessory, device)
2273
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2273
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2274
2274
  } else {
2275
2275
  this.unregisterPlatformAccessories(existingAccessory)
2276
2276
  }
@@ -2292,17 +2292,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2292
2292
  accessory.context.connectionType = await this.connectionType(device)
2293
2293
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
2294
2294
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
2295
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2295
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2296
2296
  // create the accessory handler for the newly create accessory
2297
2297
  // this is imported from `platformAccessory.ts`
2298
2298
  new WaterHeater(this, accessory, device)
2299
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2299
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2300
2300
 
2301
2301
  // publish device externally or link the accessory to your platform
2302
2302
  this.externalOrPlatform(device, accessory)
2303
2303
  this.accessories.push(accessory)
2304
2304
  } else {
2305
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2305
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2306
2306
  }
2307
2307
  }
2308
2308
 
@@ -2324,13 +2324,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2324
2324
  existingAccessory.displayName = device.configDeviceName
2325
2325
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2326
2326
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
2327
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2327
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2328
2328
  existingAccessory.context.connectionType = device.connectionType
2329
2329
  this.api.updatePlatformAccessories([existingAccessory])
2330
2330
  // create the accessory handler for the restored accessory
2331
2331
  // this is imported from `platformAccessory.ts`
2332
2332
  new VacuumCleaner(this, existingAccessory, device)
2333
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2333
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2334
2334
  } else {
2335
2335
  this.unregisterPlatformAccessories(existingAccessory)
2336
2336
  }
@@ -2352,17 +2352,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2352
2352
  accessory.context.connectionType = await this.connectionType(device)
2353
2353
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
2354
2354
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
2355
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2355
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2356
2356
  // create the accessory handler for the newly create accessory
2357
2357
  // this is imported from `platformAccessory.ts`
2358
2358
  new VacuumCleaner(this, accessory, device)
2359
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2359
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2360
2360
 
2361
2361
  // publish device externally or link the accessory to your platform
2362
2362
  this.externalOrPlatform(device, accessory)
2363
2363
  this.accessories.push(accessory)
2364
2364
  } else {
2365
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2365
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2366
2366
  }
2367
2367
  }
2368
2368
 
@@ -2384,13 +2384,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2384
2384
  existingAccessory.displayName = device.configDeviceName
2385
2385
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2386
2386
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
2387
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2387
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2388
2388
  existingAccessory.context.connectionType = device.connectionType
2389
2389
  this.api.updatePlatformAccessories([existingAccessory])
2390
2390
  // create the accessory handler for the restored accessory
2391
2391
  // this is imported from `platformAccessory.ts`
2392
2392
  new Camera(this, existingAccessory, device)
2393
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2393
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2394
2394
  } else {
2395
2395
  this.unregisterPlatformAccessories(existingAccessory)
2396
2396
  }
@@ -2412,17 +2412,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2412
2412
  accessory.context.connectionType = await this.connectionType(device)
2413
2413
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
2414
2414
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
2415
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2415
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2416
2416
  // create the accessory handler for the newly create accessory
2417
2417
  // this is imported from `platformAccessory.ts`
2418
2418
  new Camera(this, accessory, device)
2419
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2419
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2420
2420
 
2421
2421
  // publish device externally or link the accessory to your platform
2422
2422
  this.externalOrPlatform(device, accessory)
2423
2423
  this.accessories.push(accessory)
2424
2424
  } else {
2425
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2425
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2426
2426
  }
2427
2427
  }
2428
2428
 
@@ -2444,13 +2444,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2444
2444
  existingAccessory.displayName = device.configDeviceName
2445
2445
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2446
2446
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName)
2447
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2447
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`)
2448
2448
  existingAccessory.context.connectionType = device.connectionType
2449
2449
  this.api.updatePlatformAccessories([existingAccessory])
2450
2450
  // create the accessory handler for the restored accessory
2451
2451
  // this is imported from `platformAccessory.ts`
2452
2452
  new Others(this, existingAccessory, device)
2453
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2453
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`)
2454
2454
  } else {
2455
2455
  this.unregisterPlatformAccessories(existingAccessory)
2456
2456
  }
@@ -2472,27 +2472,27 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2472
2472
  accessory.context.connectionType = await this.connectionType(device)
2473
2473
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0'
2474
2474
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external'
2475
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2475
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`)
2476
2476
  // create the accessory handler for the newly create accessory
2477
2477
  // this is imported from `platformAccessory.ts`
2478
2478
  new Others(this, accessory, device)
2479
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2479
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`)
2480
2480
 
2481
2481
  // publish device externally or link the accessory to your platform
2482
2482
  this.externalOrPlatform(device, accessory)
2483
2483
  this.accessories.push(accessory)
2484
2484
  } else {
2485
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2485
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`)
2486
2486
  }
2487
2487
  }
2488
2488
 
2489
2489
  async registerCurtains(device: device & devicesConfig): Promise<boolean> {
2490
2490
  let registerWindowCovering: boolean
2491
2491
  if (isCurtainDevice(device)) {
2492
- await this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, curtainDevicesIds: ${device.curtainDevicesIds},x master: ${device.master}, group: ${device.group}, disable_group: ${(device as blindTiltConfig | curtainConfig).disable_group}, connectionType: ${device.connectionType}`)
2492
+ this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, curtainDevicesIds: ${device.curtainDevicesIds},x master: ${device.master}, group: ${device.group}, disable_group: ${(device as blindTiltConfig | curtainConfig).disable_group}, connectionType: ${device.connectionType}`)
2493
2493
  registerWindowCovering = await this.registerWindowCovering(device)
2494
2494
  } else if (isBlindTiltDevice(device)) {
2495
- await this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, blindTiltDevicesIds: ${device.blindTiltDevicesIds}, master: ${device.master}, group: ${device.group}, disable_group: ${(device as blindTiltConfig | curtainConfig).disable_group}, connectionType: ${device.connectionType}`)
2495
+ this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, blindTiltDevicesIds: ${device.blindTiltDevicesIds}, master: ${device.master}, group: ${device.group}, disable_group: ${(device as blindTiltConfig | curtainConfig).disable_group}, connectionType: ${device.connectionType}`)
2496
2496
  registerWindowCovering = await this.registerWindowCovering(device)
2497
2497
  } else {
2498
2498
  registerWindowCovering = false
@@ -2501,31 +2501,31 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2501
2501
  }
2502
2502
 
2503
2503
  async registerWindowCovering(device: (curtain | curtain3 | blindTilt) & devicesConfig) {
2504
- await this.debugLog(`master: ${device.master}`)
2504
+ this.debugLog(`master: ${device.master}`)
2505
2505
  let registerCurtain: boolean
2506
2506
  if (device.master && device.group) {
2507
2507
  // OpenAPI: Master Curtains/Blind Tilt in Group
2508
2508
  registerCurtain = true
2509
- await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group} connectionType; ${device.connectionType}`)
2510
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`)
2509
+ this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group} connectionType; ${device.connectionType}`)
2510
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`)
2511
2511
  } else if (!device.master && (device as blindTiltConfig | curtainConfig).disable_group) {
2512
2512
  registerCurtain = true
2513
- await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, disable_group: ${(device as blindTiltConfig | curtainConfig).disable_group}, connectionType; ${device.connectionType}`)
2514
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`)
2513
+ this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, disable_group: ${(device as blindTiltConfig | curtainConfig).disable_group}, connectionType; ${device.connectionType}`)
2514
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`)
2515
2515
  } else if (device.master && !device.group) {
2516
2516
  // OpenAPI: Master Curtains/Blind Tilts not in Group
2517
2517
  registerCurtain = true
2518
- await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group} connectionType; ${device.connectionType}`)
2519
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`)
2518
+ this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group} connectionType; ${device.connectionType}`)
2519
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`)
2520
2520
  } else if (device.connectionType === 'BLE') {
2521
2521
  // BLE: Curtains/Blind Tilt
2522
2522
  registerCurtain = true
2523
- await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] connectionType: ${device.connectionType}, group: ${device.group}`)
2524
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`)
2523
+ this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] connectionType: ${device.connectionType}, group: ${device.group}`)
2524
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`)
2525
2525
  } else {
2526
2526
  registerCurtain = false
2527
- await this.debugErrorLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] disable_group: ${(device as blindTiltConfig | curtainConfig).disable_group}, device.master: ${device.master}, device.group: ${device.group}`)
2528
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}, device.connectionType: ${device.connectionType}`)
2527
+ this.debugErrorLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] disable_group: ${(device as blindTiltConfig | curtainConfig).disable_group}, device.master: ${device.master}, device.group: ${device.group}`)
2528
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}, device.connectionType: ${device.connectionType}`)
2529
2529
  }
2530
2530
  return registerCurtain
2531
2531
  }
@@ -2550,7 +2550,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2550
2550
  registerDevice = await this.handleDeviceRegistration(device)
2551
2551
  } else {
2552
2552
  registerDevice = false
2553
- await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, hide_device: ${device.hide_device}, will not display in HomeKit`)
2553
+ this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, hide_device: ${device.hide_device}, will not display in HomeKit`)
2554
2554
  }
2555
2555
 
2556
2556
  return registerDevice
@@ -2564,17 +2564,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2564
2564
  case 'Curtain3':
2565
2565
  case 'Blind Tilt':
2566
2566
  registerDevice = await this.registerCurtains(device)
2567
- await this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`)
2567
+ this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`)
2568
2568
  break
2569
2569
  default:
2570
2570
  registerDevice = true
2571
- await this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`)
2571
+ this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`)
2572
2572
  }
2573
2573
 
2574
2574
  if (registerDevice) {
2575
- await this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`)
2575
+ this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`)
2576
2576
  } else {
2577
- await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`)
2577
+ this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`)
2578
2578
  }
2579
2579
 
2580
2580
  return registerDevice
@@ -2585,10 +2585,10 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2585
2585
  const isExternal = device.external ?? false
2586
2586
 
2587
2587
  if (isExternal) {
2588
- await this.debugWarnLog(`${displayName} External Accessory Mode`)
2588
+ this.debugWarnLog(`${displayName} External Accessory Mode`)
2589
2589
  this.api.publishExternalAccessories(PLUGIN_NAME, [accessory])
2590
2590
  } else {
2591
- await this.debugLog(`${displayName} External Accessory Mode: ${isExternal}`)
2591
+ this.debugLog(`${displayName} External Accessory Mode: ${isExternal}`)
2592
2592
  this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory])
2593
2593
  }
2594
2594
  }
@@ -2636,9 +2636,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2636
2636
  const message = messages[statusCode] ?? `Unknown statusCode, statusCode: ${statusCode}, Submit Bugs Here: https://tinyurl.com/SwitchBotBug`
2637
2637
 
2638
2638
  if ([100, 200].includes(statusCode)) {
2639
- await this.debugLog(message)
2639
+ this.debugLog(message)
2640
2640
  } else {
2641
- await this.errorLog(message)
2641
+ this.errorLog(message)
2642
2642
  }
2643
2643
  }
2644
2644
 
@@ -2649,13 +2649,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2649
2649
  while (retryCount < maxRetries) {
2650
2650
  try {
2651
2651
  const { response, statusCode } = await this.switchBotAPI.getDeviceStatus(deviceId)
2652
- await this.debugLog(`response: ${JSON.stringify(response)}`)
2652
+ this.debugLog(`response: ${JSON.stringify(response)}`)
2653
2653
  return { response, statusCode }
2654
2654
  } catch (error: any) {
2655
- await this.errorLog(`Error making request: ${error.message}`)
2655
+ this.errorLog(`Error making request: ${error.message}`)
2656
2656
  }
2657
2657
  retryCount++
2658
- await this.debugLog(`Retry attempt ${retryCount} of ${maxRetries}`)
2658
+ this.debugLog(`Retry attempt ${retryCount} of ${maxRetries}`)
2659
2659
  await sleep(delayBetweenRetries)
2660
2660
  }
2661
2661
  return { response: {
@@ -2672,10 +2672,10 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2672
2672
  async connectBLE(accessory: PlatformAccessory, device: device & devicesConfig): Promise<any> {
2673
2673
  try {
2674
2674
  queueScheduler.schedule(async () => this.switchBotBLE)
2675
- await this.debugLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' found: ${this.switchBotBLE}`)
2675
+ this.debugLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' found: ${this.switchBotBLE}`)
2676
2676
  return this.switchBotBLE
2677
2677
  } catch (e: any) {
2678
- await this.errorLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' not found, Error: ${e.message ?? e}`)
2678
+ this.errorLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' not found, Error: ${e.message ?? e}`)
2679
2679
  return false
2680
2680
  }
2681
2681
  }
@@ -2687,7 +2687,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2687
2687
  'utf-8',
2688
2688
  ),
2689
2689
  )
2690
- await this.debugLog(`Plugin Version: ${json.version}`)
2690
+ this.debugLog(`Plugin Version: ${json.version}`)
2691
2691
  this.version = json.version
2692
2692
  return json.version
2693
2693
  }
@@ -2705,17 +2705,17 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2705
2705
  this.maxRetries = options.maxRetries || 3
2706
2706
  platformConfig.maxRetries = this.maxRetries
2707
2707
  if (!options.maxRetries) {
2708
- await this.debugWarnLog('Using Default Max Retries')
2708
+ this.debugWarnLog('Using Default Max Retries')
2709
2709
  }
2710
2710
 
2711
2711
  this.delayBetweenRetries = (options.delayBetweenRetries || 3) * 1000
2712
2712
  platformConfig.delayBetweenRetries = this.delayBetweenRetries / 1000
2713
2713
  if (!options.delayBetweenRetries) {
2714
- await this.debugWarnLog('Using Default Delay Between Retries')
2714
+ this.debugWarnLog('Using Default Delay Between Retries')
2715
2715
  }
2716
2716
 
2717
2717
  if (Object.keys(platformConfig).length) {
2718
- await this.debugLog(`Platform Config: ${JSON.stringify(platformConfig)}`)
2718
+ this.debugLog(`Platform Config: ${JSON.stringify(platformConfig)}`)
2719
2719
  }
2720
2720
 
2721
2721
  this.platformConfig = platformConfig
@@ -2726,13 +2726,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2726
2726
  this.debugMode = process.argv.includes('-D') ?? process.argv.includes('--debug')
2727
2727
  if (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard' || this.config.options?.logging === 'none') {
2728
2728
  this.platformLogging = this.config.options.logging
2729
- await this.debugWarnLog(`Using Config Logging: ${this.platformLogging}`)
2729
+ this.debugWarnLog(`Using Config Logging: ${this.platformLogging}`)
2730
2730
  } else if (this.debugMode) {
2731
2731
  this.platformLogging = 'debugMode'
2732
- await this.debugWarnLog(`Using ${this.platformLogging} Logging`)
2732
+ this.debugWarnLog(`Using ${this.platformLogging} Logging`)
2733
2733
  } else {
2734
2734
  this.platformLogging = 'standard'
2735
- await this.debugWarnLog(`Using ${this.platformLogging} Logging`)
2735
+ this.debugWarnLog(`Using ${this.platformLogging} Logging`)
2736
2736
  }
2737
2737
  }
2738
2738
 
@@ -2752,22 +2752,22 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2752
2752
  const invalidStartEndPattern = /^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu
2753
2753
 
2754
2754
  if (typeof value === 'string' && !validPattern.test(value)) {
2755
- await this.warnLog(`WARNING: The accessory '${displayName}' has an invalid '${name}' characteristic ('${value}'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness.`)
2755
+ this.warnLog(`WARNING: The accessory '${displayName}' has an invalid '${name}' characteristic ('${value}'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness.`)
2756
2756
 
2757
2757
  // Remove invalid characters
2758
2758
  if (invalidCharsPattern.test(value)) {
2759
2759
  const before = value
2760
- await this.warnLog(`Removing invalid characters from '${name}' characteristic, if you feel this is incorrect, please enable \'allowInvalidCharacter\' in the config to allow all characters`)
2760
+ this.warnLog(`Removing invalid characters from '${name}' characteristic, if you feel this is incorrect, please enable \'allowInvalidCharacter\' in the config to allow all characters`)
2761
2761
  value = value.replace(invalidCharsPattern, '')
2762
- await this.warnLog(`${name} Before: '${before}' After: '${value}'`)
2762
+ this.warnLog(`${name} Before: '${before}' After: '${value}'`)
2763
2763
  }
2764
2764
 
2765
2765
  // Ensure it starts and ends with an alphanumeric character
2766
2766
  if (invalidStartEndPattern.test(value)) {
2767
2767
  const before = value
2768
- await this.warnLog(`Removing invalid starting or ending characters from '${name}' characteristic, if you feel this is incorrect, please enable \'allowInvalidCharacter\' in the config to allow all characters`)
2768
+ this.warnLog(`Removing invalid starting or ending characters from '${name}' characteristic, if you feel this is incorrect, please enable \'allowInvalidCharacter\' in the config to allow all characters`)
2769
2769
  value = value.replace(invalidStartEndPattern, '')
2770
- await this.warnLog(`${name} Before: '${before}' After: '${value}'`)
2770
+ this.warnLog(`${name} Before: '${before}' After: '${value}'`)
2771
2771
  }
2772
2772
  }
2773
2773