@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/dist/platform.js CHANGED
@@ -149,14 +149,14 @@ export class SwitchBotPlatform {
149
149
  // in order to ensure they weren't added to homebridge already. This event can also be used
150
150
  // to start discovery of new accessories.
151
151
  this.api.on('didFinishLaunching', async () => {
152
- await this.debugLog('Executed didFinishLaunching callback');
152
+ this.debugLog('Executed didFinishLaunching callback');
153
153
  // run the method to discover / register your devices as accessories
154
154
  try {
155
155
  await this.discoverDevices();
156
156
  }
157
157
  catch (e) {
158
- await this.errorLog(`Failed to Discover, Error Message: ${e.message ?? e}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
159
- await this.debugErrorLog(`Failed to Discover, Error: ${e.message ?? e}`);
158
+ this.errorLog(`Failed to Discover, Error Message: ${e.message ?? e}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
159
+ this.debugErrorLog(`Failed to Discover, Error: ${e.message ?? e}`);
160
160
  }
161
161
  });
162
162
  try {
@@ -183,29 +183,29 @@ export class SwitchBotPlatform {
183
183
  try {
184
184
  const { connectAsync } = asyncmqtt;
185
185
  this.mqttClient = await connectAsync(this.config.options?.mqttURL, this.config.options.mqttOptions || {});
186
- await this.debugLog('MQTT connection has been established successfully.');
186
+ this.debugLog('MQTT connection has been established successfully.');
187
187
  this.mqttClient.on('error', async (e) => {
188
- await this.errorLog(`Failed to publish MQTT messages. ${e.message ?? e}`);
188
+ this.errorLog(`Failed to publish MQTT messages. ${e.message ?? e}`);
189
189
  });
190
190
  if (!this.config.options?.webhookURL) {
191
191
  // receive webhook events via MQTT
192
- await this.infoLog(`Webhook is configured to be received through ${this.config.options.mqttURL}/homebridge-switchbot/webhook.`);
192
+ this.infoLog(`Webhook is configured to be received through ${this.config.options.mqttURL}/homebridge-switchbot/webhook.`);
193
193
  this.mqttClient.subscribe('homebridge-switchbot/webhook/+');
194
194
  this.mqttClient.on('message', async (topic, message) => {
195
195
  try {
196
- await this.debugLog(`Received Webhook via MQTT: ${topic}=${message}`);
196
+ this.debugLog(`Received Webhook via MQTT: ${topic}=${message}`);
197
197
  const context = JSON.parse(message.toString());
198
198
  this.webhookEventHandler[context.deviceMac]?.(context);
199
199
  }
200
200
  catch (e) {
201
- await this.errorLog(`Failed to handle webhook event. Error:${e.message ?? e}`);
201
+ this.errorLog(`Failed to handle webhook event. Error:${e.message ?? e}`);
202
202
  }
203
203
  });
204
204
  }
205
205
  }
206
206
  catch (e) {
207
207
  this.mqttClient = null;
208
- await this.errorLog(`Failed to establish MQTT connection. ${e.message ?? e}`);
208
+ this.errorLog(`Failed to establish MQTT connection. ${e.message ?? e}`);
209
209
  }
210
210
  }
211
211
  }
@@ -226,14 +226,14 @@ export class SwitchBotPlatform {
226
226
  });
227
227
  }
228
228
  catch (e) {
229
- await this.errorLog(`Failed to setup webhook. Error:${e.message ?? e}`);
229
+ this.errorLog(`Failed to setup webhook. Error:${e.message ?? e}`);
230
230
  }
231
231
  this.api.on('shutdown', async () => {
232
232
  try {
233
233
  this.switchBotAPI.deleteWebhook(url);
234
234
  }
235
235
  catch (e) {
236
- await this.errorLog(`Failed to delete webhook. Error:${e.message ?? e}`);
236
+ this.errorLog(`Failed to delete webhook. Error:${e.message ?? e}`);
237
237
  }
238
238
  });
239
239
  }
@@ -272,20 +272,20 @@ export class SwitchBotPlatform {
272
272
  });
273
273
  }
274
274
  if (this.config.options?.BLE) {
275
- await this.debugLog('setupBLE');
275
+ this.debugLog('setupBLE');
276
276
  if (this.switchBotBLE === undefined) {
277
- await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(this.switchBotBLE)}`);
277
+ this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(this.switchBotBLE)}`);
278
278
  }
279
279
  else {
280
280
  // Start to monitor advertisement packets
281
281
  (async () => {
282
282
  // Start to monitor advertisement packets
283
- await this.debugLog('Scanning for BLE SwitchBot devices...');
283
+ this.debugLog('Scanning for BLE SwitchBot devices...');
284
284
  try {
285
285
  await this.switchBotBLE.startScan();
286
286
  }
287
287
  catch (e) {
288
- await this.errorLog(`Failed to start BLE scanning. Error:${e.message ?? e}`);
288
+ this.errorLog(`Failed to start BLE scanning. Error:${e.message ?? e}`);
289
289
  }
290
290
  // Set an event handler to monitor advertisement packets
291
291
  this.switchBotBLE.onadvertisement = async (ad) => {
@@ -293,23 +293,23 @@ export class SwitchBotPlatform {
293
293
  this.bleEventHandler[ad.address]?.(ad.serviceData);
294
294
  }
295
295
  catch (e) {
296
- await this.errorLog(`Failed to handle BLE event. Error:${e.message ?? e}`);
296
+ this.errorLog(`Failed to handle BLE event. Error:${e.message ?? e}`);
297
297
  }
298
298
  };
299
299
  })();
300
300
  this.api.on('shutdown', async () => {
301
301
  try {
302
302
  // this.switchBotBLE.stopScan()
303
- await this.infoLog('Stopped BLE scanning to close listening.');
303
+ this.infoLog('Stopped BLE scanning to close listening.');
304
304
  }
305
305
  catch (e) {
306
- await this.errorLog(`Failed to stop Platform BLE scanning. Error:${e.message ?? e}`);
306
+ this.errorLog(`Failed to stop Platform BLE scanning. Error:${e.message ?? e}`);
307
307
  }
308
308
  });
309
309
  }
310
310
  }
311
311
  else {
312
- await this.debugLog('Platform BLE is not enabled');
312
+ this.debugLog('Platform BLE is not enabled');
313
313
  }
314
314
  }
315
315
  /**
@@ -318,7 +318,7 @@ export class SwitchBotPlatform {
318
318
  */
319
319
  async configureAccessory(accessory) {
320
320
  const { displayName } = accessory;
321
- await this.debugLog(`Loading accessory from cache: ${displayName}`);
321
+ this.debugLog(`Loading accessory from cache: ${displayName}`);
322
322
  // add the restored accessory to the accessories cache so we can track if it has already been registered
323
323
  this.accessories.push(accessory);
324
324
  }
@@ -326,7 +326,7 @@ export class SwitchBotPlatform {
326
326
  * Verify the config passed to the plugin is valid
327
327
  */
328
328
  async verifyConfig() {
329
- await this.debugLog('Verifying Config');
329
+ this.debugLog('Verifying Config');
330
330
  this.config = this.config || {};
331
331
  this.config.options = this.config.options || {};
332
332
  const platformConfig = {};
@@ -340,7 +340,7 @@ export class SwitchBotPlatform {
340
340
  platformConfig.pushRate = this.config.options.pushRate;
341
341
  }
342
342
  if (Object.entries(platformConfig).length !== 0) {
343
- await this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
343
+ this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
344
344
  }
345
345
  if (this.config.options) {
346
346
  // Device Config
@@ -361,10 +361,10 @@ export class SwitchBotPlatform {
361
361
  for (const irDeviceConfig of this.config.options.irdevices) {
362
362
  if (!irDeviceConfig.hide_device) {
363
363
  if (!irDeviceConfig.deviceId) {
364
- await this.errorLog('The devices config section is missing the *Device ID* in the config. Please check your config.');
364
+ this.errorLog('The devices config section is missing the *Device ID* in the config. Please check your config.');
365
365
  }
366
366
  if (!irDeviceConfig.deviceId && !irDeviceConfig.configRemoteType) {
367
- await this.errorLog('The devices config section is missing the *Device Type* in the config. Please check your config.');
367
+ this.errorLog('The devices config section is missing the *Device Type* in the config. Please check your config.');
368
368
  }
369
369
  }
370
370
  }
@@ -376,16 +376,16 @@ export class SwitchBotPlatform {
376
376
  if (!this.config.options.refreshRate) {
377
377
  // default 120 seconds (2 minutes)
378
378
  this.config.options.refreshRate = 120;
379
- await this.debugWarnLog('Using Default Refresh Rate (2 minutes).');
379
+ this.debugWarnLog('Using Default Refresh Rate (2 minutes).');
380
380
  }
381
381
  if (!this.config.options.pushRate) {
382
382
  // default 100 milliseconds
383
383
  this.config.options.pushRate = 0.1;
384
- await this.debugWarnLog('Using Default Push Rate.');
384
+ this.debugWarnLog('Using Default Push Rate.');
385
385
  }
386
386
  if (!this.config.options.maxRetries) {
387
387
  this.config.options.maxRetries = 5;
388
- await this.debugWarnLog('Using Default Max Retries.');
388
+ this.debugWarnLog('Using Default Max Retries.');
389
389
  }
390
390
  else {
391
391
  this.maxRetries = this.config.options.maxRetries;
@@ -393,23 +393,23 @@ export class SwitchBotPlatform {
393
393
  if (!this.config.options.delayBetweenRetries) {
394
394
  // default 3 seconds
395
395
  this.config.options.delayBetweenRetries = 3000;
396
- await this.debugWarnLog('Using Default Delay Between Retries.');
396
+ this.debugWarnLog('Using Default Delay Between Retries.');
397
397
  }
398
398
  else {
399
399
  this.delayBetweenRetries = this.config.options.delayBetweenRetries * 1000;
400
400
  }
401
401
  if (!this.config.credentials && !this.config.options) {
402
- await this.debugWarnLog('Missing Credentials');
402
+ this.debugWarnLog('Missing Credentials');
403
403
  }
404
404
  else if (this.config.credentials && !this.config.credentials.notice) {
405
405
  if (!this.config.credentials?.token) {
406
- await this.debugErrorLog('Missing token');
407
- await this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
406
+ this.debugErrorLog('Missing token');
407
+ this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
408
408
  }
409
409
  if (this.config.credentials?.token) {
410
410
  if (!this.config.credentials?.secret) {
411
- await this.debugErrorLog('Missing secret');
412
- await this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
411
+ this.debugErrorLog('Missing secret');
412
+ this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
413
413
  }
414
414
  }
415
415
  }
@@ -421,13 +421,13 @@ export class SwitchBotPlatform {
421
421
  let retryCount = 0;
422
422
  const maxRetries = this.maxRetries;
423
423
  const delayBetweenRetries = this.delayBetweenRetries;
424
- await this.debugWarnLog(`Retry Count: ${retryCount}`);
425
- await this.debugWarnLog(`Max Retries: ${maxRetries}`);
426
- await this.debugWarnLog(`Delay Between Retries: ${delayBetweenRetries}`);
424
+ this.debugWarnLog(`Retry Count: ${retryCount}`);
425
+ this.debugWarnLog(`Max Retries: ${maxRetries}`);
426
+ this.debugWarnLog(`Delay Between Retries: ${delayBetweenRetries}`);
427
427
  while (retryCount < maxRetries) {
428
428
  try {
429
429
  const { response, statusCode } = await this.switchBotAPI.getDevices();
430
- await this.debugLog(`response: ${JSON.stringify(response)}`);
430
+ this.debugLog(`response: ${JSON.stringify(response)}`);
431
431
  if (this.isSuccessfulResponse(statusCode)) {
432
432
  await this.handleDevices(Array.isArray(response.body.deviceList) ? response.body.deviceList : []);
433
433
  await this.handleIRDevices(Array.isArray(response.body.infraredRemoteList) ? response.body.infraredRemoteList : []);
@@ -440,32 +440,32 @@ export class SwitchBotPlatform {
440
440
  }
441
441
  catch (e) {
442
442
  retryCount++;
443
- await this.debugErrorLog(`Failed to Discover Devices, Error Message: ${JSON.stringify(e.message)}, Submit Bugs Here: https://tinyurl.com/SwitchBotBug`);
444
- await this.debugErrorLog(`Failed to Discover Devices, Error: ${e.message ?? e}`);
443
+ this.debugErrorLog(`Failed to Discover Devices, Error Message: ${JSON.stringify(e.message)}, Submit Bugs Here: https://tinyurl.com/SwitchBotBug`);
444
+ this.debugErrorLog(`Failed to Discover Devices, Error: ${e.message ?? e}`);
445
445
  }
446
446
  }
447
447
  }
448
448
  async handleManualConfig() {
449
449
  if (this.config.options?.devices) {
450
- await this.debugLog(`SwitchBot Device Manual Config Set: ${JSON.stringify(this.config.options?.devices)}`);
450
+ this.debugLog(`SwitchBot Device Manual Config Set: ${JSON.stringify(this.config.options?.devices)}`);
451
451
  const devices = this.config.options.devices.map((v) => v);
452
452
  for (const device of devices) {
453
453
  device.deviceType = device.configDeviceType;
454
454
  device.deviceName = device.configDeviceName;
455
455
  try {
456
456
  device.deviceId = formatDeviceIdAsMac(device.deviceId, true);
457
- await this.debugLog(`deviceId: ${device.deviceId}`);
457
+ this.debugLog(`deviceId: ${device.deviceId}`);
458
458
  if (device.deviceType) {
459
459
  await this.createDevice(device);
460
460
  }
461
461
  }
462
462
  catch (error) {
463
- await this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
463
+ this.errorLog(`failed to format device ID as MAC, Error: ${error}`);
464
464
  }
465
465
  }
466
466
  }
467
467
  else {
468
- await this.errorLog('Neither SwitchBot Token or Device Config are set.');
468
+ this.errorLog('Neither SwitchBot Token or Device Config are set.');
469
469
  }
470
470
  }
471
471
  isSuccessfulResponse(apiStatusCode) {
@@ -473,9 +473,9 @@ export class SwitchBotPlatform {
473
473
  }
474
474
  async handleDevices(deviceLists) {
475
475
  if (!this.config.options?.devices && !this.config.options?.deviceConfig) {
476
- await this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
476
+ this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
477
477
  if (deviceLists.length === 0) {
478
- await this.debugLog('SwitchBot API Has No Devices With Cloud Services Enabled');
478
+ this.debugLog('SwitchBot API Has No Devices With Cloud Services Enabled');
479
479
  }
480
480
  else {
481
481
  for (const device of deviceLists) {
@@ -489,15 +489,15 @@ export class SwitchBotPlatform {
489
489
  }
490
490
  }
491
491
  else if (this.config.options?.devices || this.config.options?.deviceConfig) {
492
- await this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
492
+ this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
493
493
  // Step 1: Check and assign configDeviceType to deviceType if deviceType is not present
494
494
  const devicesWithTypeConfigPromises = deviceLists.map(async (device) => {
495
495
  if (!device.deviceType && device.configDeviceType) {
496
496
  device.deviceType = device.configDeviceType;
497
- await this.warnLog(`API is displaying no deviceType: ${device.deviceType}, So using configDeviceType: ${device.configDeviceType}`);
497
+ this.warnLog(`API is displaying no deviceType: ${device.deviceType}, So using configDeviceType: ${device.configDeviceType}`);
498
498
  }
499
499
  else if (!device.deviceType && !device.configDeviceName) {
500
- await this.errorLog('No deviceType or configDeviceType for device. No device will be created.');
500
+ this.errorLog('No deviceType or configDeviceType for device. No device will be created.');
501
501
  return null; // Skip this device
502
502
  }
503
503
  // Retrieve deviceTypeConfig for each device and merge it
@@ -507,7 +507,7 @@ export class SwitchBotPlatform {
507
507
  // Wait for all promises to resolve
508
508
  const devicesWithTypeConfig = (await Promise.all(devicesWithTypeConfigPromises)).filter(device => device !== null); // Filter out skipped devices
509
509
  const devices = this.mergeByDeviceId(this.config.options.devices ?? [], devicesWithTypeConfig ?? []);
510
- await this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
510
+ this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
511
511
  for (const device of devices) {
512
512
  const deviceIdConfig = this.config.options?.devices?.[device.deviceId] || {};
513
513
  const deviceWithConfig = Object.assign({}, device, deviceIdConfig);
@@ -521,7 +521,7 @@ export class SwitchBotPlatform {
521
521
  }
522
522
  async handleIRDevices(irDeviceLists) {
523
523
  if (!this.config.options?.irdevices && !this.config.options?.irdeviceConfig) {
524
- await this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`);
524
+ this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`);
525
525
  for (const device of irDeviceLists) {
526
526
  if (device.remoteType) {
527
527
  await this.createIRDevice(device);
@@ -529,15 +529,15 @@ export class SwitchBotPlatform {
529
529
  }
530
530
  }
531
531
  else if (this.config.options?.irdevices || this.config.options?.irdeviceConfig) {
532
- await this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`);
532
+ this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`);
533
533
  // Step 1: Check and assign configRemoteType to remoteType if remoteType is not present
534
534
  const devicesWithTypeConfigPromises = irDeviceLists.map(async (device) => {
535
535
  if (!device.remoteType && device.configRemoteType) {
536
536
  device.remoteType = device.configRemoteType;
537
- await this.warnLog(`API is displaying no remoteType: ${device.remoteType}, So using configRemoteType: ${device.configRemoteType}`);
537
+ this.warnLog(`API is displaying no remoteType: ${device.remoteType}, So using configRemoteType: ${device.configRemoteType}`);
538
538
  }
539
539
  else if (!device.remoteType && !device.configDeviceName) {
540
- await this.errorLog('No remoteType or configRemoteType for device. No device will be created.');
540
+ this.errorLog('No remoteType or configRemoteType for device. No device will be created.');
541
541
  return null; // Skip this device
542
542
  }
543
543
  // Retrieve remoteTypeConfig for each device and merge it
@@ -547,7 +547,7 @@ export class SwitchBotPlatform {
547
547
  // Wait for all promises to resolve
548
548
  const devicesWithRemoteTypeConfig = (await Promise.all(devicesWithTypeConfigPromises)).filter(device => device !== null); // Filter out skipped devices
549
549
  const devices = this.mergeByDeviceId(this.config.options.irdevices ?? [], devicesWithRemoteTypeConfig ?? []);
550
- await this.debugLog(`IR Devices: ${JSON.stringify(devices)}`);
550
+ this.debugLog(`IR Devices: ${JSON.stringify(devices)}`);
551
551
  for (const device of devices) {
552
552
  const irdeviceIdConfig = this.config.options?.irdevices?.[device.deviceId] || {};
553
553
  const irdeviceWithConfig = Object.assign({}, device, irdeviceIdConfig);
@@ -609,14 +609,14 @@ export class SwitchBotPlatform {
609
609
  'Battery Circulator Fan': this.createFan.bind(this),
610
610
  };
611
611
  if (deviceTypeHandlers[device.deviceType]) {
612
- await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
612
+ this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
613
613
  await deviceTypeHandlers[device.deviceType](device);
614
614
  }
615
615
  else if (['Hub Mini', 'Hub Plus', 'Remote', 'Indoor Cam', 'remote with screen'].includes(device.deviceType)) {
616
- await this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}, is currently not supported, device: ${JSON.stringify(device)}`);
616
+ this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}, is currently not supported, device: ${JSON.stringify(device)}`);
617
617
  }
618
618
  else {
619
- 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)}`);
619
+ 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)}`);
620
620
  }
621
621
  }
622
622
  async createIRDevice(device) {
@@ -651,14 +651,14 @@ export class SwitchBotPlatform {
651
651
  'Others': this.createOthers.bind(this),
652
652
  };
653
653
  if (deviceTypeHandlers[device.remoteType]) {
654
- await this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
654
+ this.debugLog(`Discovered ${device.remoteType}: ${device.deviceId}`);
655
655
  if (device.remoteType.startsWith('DIY') && device.external === undefined) {
656
656
  device.external = true;
657
657
  }
658
658
  await deviceTypeHandlers[device.remoteType](device);
659
659
  }
660
660
  else {
661
- 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)}`);
661
+ 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)}`);
662
662
  }
663
663
  }
664
664
  async createHumidifier(device) {
@@ -679,12 +679,12 @@ export class SwitchBotPlatform {
679
679
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
680
680
  existingAccessory.context.connectionType = await this.connectionType(device);
681
681
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
682
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
682
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
683
683
  this.api.updatePlatformAccessories([existingAccessory]);
684
684
  // create the accessory handler for the restored accessory
685
685
  // this is imported from `platformAccessory.ts`
686
686
  new Humidifier(this, existingAccessory, device);
687
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
687
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
688
688
  }
689
689
  else {
690
690
  this.unregisterPlatformAccessories(existingAccessory);
@@ -707,17 +707,17 @@ export class SwitchBotPlatform {
707
707
  accessory.context.connectionType = await this.connectionType(device);
708
708
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
709
709
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
710
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
710
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
711
711
  // create the accessory handler for the newly create accessory
712
712
  // this is imported from `platformAccessory.ts`
713
713
  new Humidifier(this, accessory, device);
714
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
714
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
715
715
  // publish device externally or link the accessory to your platform
716
716
  this.externalOrPlatform(device, accessory);
717
717
  this.accessories.push(accessory);
718
718
  }
719
719
  else {
720
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
720
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
721
721
  }
722
722
  }
723
723
  async createBot(device) {
@@ -743,7 +743,7 @@ export class SwitchBotPlatform {
743
743
  // create the accessory handler for the restored accessory
744
744
  // this is imported from `platformAccessory.ts`
745
745
  new Bot(this, existingAccessory, device);
746
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
746
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
747
747
  }
748
748
  else {
749
749
  this.unregisterPlatformAccessories(existingAccessory);
@@ -767,18 +767,18 @@ export class SwitchBotPlatform {
767
767
  accessory.context.connectionType = await this.connectionType(device);
768
768
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
769
769
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
770
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
770
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
771
771
  // accessory.context.version = findaccessories.accessoryAttribute.softwareRevision;
772
772
  // create the accessory handler for the newly create accessory
773
773
  // this is imported from `platformAccessory.ts`
774
774
  new Bot(this, accessory, device);
775
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
775
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
776
776
  // publish device externally or link the accessory to your platform
777
777
  this.externalOrPlatform(device, accessory);
778
778
  this.accessories.push(accessory);
779
779
  }
780
780
  else {
781
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
781
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
782
782
  }
783
783
  }
784
784
  async createMeter(device) {
@@ -804,7 +804,7 @@ export class SwitchBotPlatform {
804
804
  // create the accessory handler for the restored accessory
805
805
  // this is imported from `platformAccessory.ts`
806
806
  new Meter(this, existingAccessory, device);
807
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
807
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
808
808
  }
809
809
  else {
810
810
  this.unregisterPlatformAccessories(existingAccessory);
@@ -828,17 +828,17 @@ export class SwitchBotPlatform {
828
828
  accessory.context.connectionType = await this.connectionType(device);
829
829
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
830
830
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
831
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
831
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
832
832
  // create the accessory handler for the newly create accessory
833
833
  // this is imported from `platformAccessory.ts`
834
834
  new Meter(this, accessory, device);
835
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
835
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
836
836
  // publish device externally or link the accessory to your platform
837
837
  this.externalOrPlatform(device, accessory);
838
838
  this.accessories.push(accessory);
839
839
  }
840
840
  else {
841
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
841
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
842
842
  }
843
843
  }
844
844
  async createMeterPlus(device) {
@@ -865,7 +865,7 @@ export class SwitchBotPlatform {
865
865
  // create the accessory handler for the restored accessory
866
866
  // this is imported from `platformAccessory.ts`
867
867
  new MeterPlus(this, existingAccessory, device);
868
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
868
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
869
869
  }
870
870
  else {
871
871
  this.unregisterPlatformAccessories(existingAccessory);
@@ -889,17 +889,17 @@ export class SwitchBotPlatform {
889
889
  accessory.context.connectionType = await this.connectionType(device);
890
890
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
891
891
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
892
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
892
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
893
893
  // create the accessory handler for the newly create accessory
894
894
  // this is imported from `platformAccessory.ts`
895
895
  new MeterPlus(this, accessory, device);
896
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
896
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
897
897
  // publish device externally or link the accessory to your platform
898
898
  this.externalOrPlatform(device, accessory);
899
899
  this.accessories.push(accessory);
900
900
  }
901
901
  else {
902
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
902
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
903
903
  }
904
904
  }
905
905
  async createMeterPro(device) {
@@ -926,7 +926,7 @@ export class SwitchBotPlatform {
926
926
  // create the accessory handler for the restored accessory
927
927
  // this is imported from `platformAccessory.ts`
928
928
  new MeterPro(this, existingAccessory, device);
929
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
929
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
930
930
  }
931
931
  else {
932
932
  this.unregisterPlatformAccessories(existingAccessory);
@@ -950,17 +950,17 @@ export class SwitchBotPlatform {
950
950
  accessory.context.connectionType = await this.connectionType(device);
951
951
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
952
952
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
953
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
953
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
954
954
  // create the accessory handler for the newly create accessory
955
955
  // this is imported from `platformAccessory.ts`
956
956
  new MeterPro(this, accessory, device);
957
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
957
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
958
958
  // publish device externally or link the accessory to your platform
959
959
  this.externalOrPlatform(device, accessory);
960
960
  this.accessories.push(accessory);
961
961
  }
962
962
  else {
963
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
963
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
964
964
  }
965
965
  }
966
966
  async createHub2(device) {
@@ -987,7 +987,7 @@ export class SwitchBotPlatform {
987
987
  // create the accessory handler for the restored accessory
988
988
  // this is imported from `platformAccessory.ts`
989
989
  new Hub(this, existingAccessory, device);
990
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
990
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
991
991
  }
992
992
  else {
993
993
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1011,17 +1011,17 @@ export class SwitchBotPlatform {
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 Hub(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
  // publish device externally or link the accessory to your platform
1020
1020
  this.externalOrPlatform(device, accessory);
1021
1021
  this.accessories.push(accessory);
1022
1022
  }
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
  async createIOSensor(device) {
@@ -1042,12 +1042,12 @@ export class SwitchBotPlatform {
1042
1042
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1043
1043
  existingAccessory.context.connectionType = await this.connectionType(device);
1044
1044
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1045
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1045
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1046
1046
  this.api.updatePlatformAccessories([existingAccessory]);
1047
1047
  // create the accessory handler for the restored accessory
1048
1048
  // this is imported from `platformAccessory.ts`
1049
1049
  new IOSensor(this, existingAccessory, device);
1050
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1050
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1051
1051
  }
1052
1052
  else {
1053
1053
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1071,17 +1071,17 @@ export class SwitchBotPlatform {
1071
1071
  accessory.context.connectionType = await this.connectionType(device);
1072
1072
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1073
1073
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1074
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1074
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1075
1075
  // create the accessory handler for the newly create accessory
1076
1076
  // this is imported from `platformAccessory.ts`
1077
1077
  new IOSensor(this, accessory, device);
1078
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1078
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1079
1079
  // publish device externally or link the accessory to your platform
1080
1080
  this.externalOrPlatform(device, accessory);
1081
1081
  this.accessories.push(accessory);
1082
1082
  }
1083
1083
  else {
1084
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1084
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1085
1085
  }
1086
1086
  }
1087
1087
  async createWaterDetector(device) {
@@ -1107,7 +1107,7 @@ export class SwitchBotPlatform {
1107
1107
  // create the accessory handler for the restored accessory
1108
1108
  // this is imported from `platformAccessory.ts`
1109
1109
  new WaterDetector(this, existingAccessory, device);
1110
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1110
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1111
1111
  }
1112
1112
  else {
1113
1113
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1131,17 +1131,17 @@ export class SwitchBotPlatform {
1131
1131
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1132
1132
  accessory.context.connectionType = await this.connectionType(device);
1133
1133
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1134
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1134
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1135
1135
  // create the accessory handler for the newly create accessory
1136
1136
  // this is imported from `platformAccessory.ts`
1137
1137
  new WaterDetector(this, accessory, device);
1138
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1138
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1139
1139
  // publish device externally or link the accessory to your platform
1140
1140
  this.externalOrPlatform(device, accessory);
1141
1141
  this.accessories.push(accessory);
1142
1142
  }
1143
1143
  else {
1144
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1144
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1145
1145
  }
1146
1146
  }
1147
1147
  async createMotion(device) {
@@ -1167,7 +1167,7 @@ export class SwitchBotPlatform {
1167
1167
  // create the accessory handler for the restored accessory
1168
1168
  // this is imported from `platformAccessory.ts`
1169
1169
  new Motion(this, existingAccessory, device);
1170
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1170
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1171
1171
  }
1172
1172
  else {
1173
1173
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1191,17 +1191,17 @@ export class SwitchBotPlatform {
1191
1191
  accessory.context.connectionType = await this.connectionType(device);
1192
1192
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1193
1193
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1194
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1194
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1195
1195
  // create the accessory handler for the newly create accessory
1196
1196
  // this is imported from `platformAccessory.ts`
1197
1197
  new Motion(this, accessory, device);
1198
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1198
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1199
1199
  // publish device externally or link the accessory to your platform
1200
1200
  this.externalOrPlatform(device, accessory);
1201
1201
  this.accessories.push(accessory);
1202
1202
  }
1203
1203
  else {
1204
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1204
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1205
1205
  }
1206
1206
  }
1207
1207
  async createContact(device) {
@@ -1227,7 +1227,7 @@ export class SwitchBotPlatform {
1227
1227
  // create the accessory handler for the restored accessory
1228
1228
  // this is imported from `platformAccessory.ts`
1229
1229
  new Contact(this, existingAccessory, device);
1230
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1230
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1231
1231
  }
1232
1232
  else {
1233
1233
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1251,17 +1251,17 @@ export class SwitchBotPlatform {
1251
1251
  accessory.context.connectionType = await this.connectionType(device);
1252
1252
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1253
1253
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1254
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1254
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1255
1255
  // create the accessory handler for the newly create accessory
1256
1256
  // this is imported from `platformAccessory.ts`
1257
1257
  new Contact(this, accessory, device);
1258
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1258
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1259
1259
  // publish device externally or link the accessory to your platform
1260
1260
  this.externalOrPlatform(device, accessory);
1261
1261
  this.accessories.push(accessory);
1262
1262
  }
1263
1263
  else {
1264
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1264
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1265
1265
  }
1266
1266
  }
1267
1267
  async createBlindTilt(device) {
@@ -1287,7 +1287,7 @@ export class SwitchBotPlatform {
1287
1287
  // create the accessory handler for the restored accessory
1288
1288
  // this is imported from `platformAccessory.ts`
1289
1289
  new BlindTilt(this, existingAccessory, device);
1290
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1290
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1291
1291
  }
1292
1292
  else {
1293
1293
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1325,17 +1325,17 @@ export class SwitchBotPlatform {
1325
1325
  accessory.context.connectionType = await this.connectionType(device);
1326
1326
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1327
1327
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1328
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1328
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1329
1329
  // create the accessory handler for the newly create accessory
1330
1330
  // this is imported from `platformAccessory.ts`
1331
1331
  new BlindTilt(this, accessory, device);
1332
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1332
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1333
1333
  // publish device externally or link the accessory to your platform
1334
1334
  this.externalOrPlatform(device, accessory);
1335
1335
  this.accessories.push(accessory);
1336
1336
  }
1337
1337
  else {
1338
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1338
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1339
1339
  }
1340
1340
  }
1341
1341
  async createCurtain(device) {
@@ -1356,12 +1356,12 @@ export class SwitchBotPlatform {
1356
1356
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1357
1357
  existingAccessory.context.connectionType = await this.connectionType(device);
1358
1358
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1359
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1359
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1360
1360
  this.api.updatePlatformAccessories([existingAccessory]);
1361
1361
  // create the accessory handler for the restored accessory
1362
1362
  // this is imported from `platformAccessory.ts`
1363
1363
  new Curtain(this, existingAccessory, device);
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
  }
1366
1366
  else {
1367
1367
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1399,17 +1399,17 @@ export class SwitchBotPlatform {
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 Curtain(this, accessory, device);
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
  // publish device externally or link the accessory to your platform
1408
1408
  this.externalOrPlatform(device, accessory);
1409
1409
  this.accessories.push(accessory);
1410
1410
  }
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
  async createPlug(device) {
@@ -1434,12 +1434,12 @@ export class SwitchBotPlatform {
1434
1434
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1435
1435
  existingAccessory.context.connectionType = await this.connectionType(device);
1436
1436
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1437
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1437
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1438
1438
  this.api.updatePlatformAccessories([existingAccessory]);
1439
1439
  // create the accessory handler for the restored accessory
1440
1440
  // this is imported from `platformAccessory.ts`
1441
1441
  new Plug(this, existingAccessory, device);
1442
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1442
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1443
1443
  }
1444
1444
  else {
1445
1445
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1467,17 +1467,17 @@ export class SwitchBotPlatform {
1467
1467
  accessory.context.connectionType = await this.connectionType(device);
1468
1468
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1469
1469
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1470
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1470
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1471
1471
  // create the accessory handler for the newly create accessory
1472
1472
  // this is imported from `platformAccessory.ts`
1473
1473
  new Plug(this, accessory, device);
1474
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1474
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1475
1475
  // publish device externally or link the accessory to your platform
1476
1476
  this.externalOrPlatform(device, accessory);
1477
1477
  this.accessories.push(accessory);
1478
1478
  }
1479
1479
  else {
1480
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1480
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1481
1481
  }
1482
1482
  }
1483
1483
  async createLock(device) {
@@ -1503,7 +1503,7 @@ export class SwitchBotPlatform {
1503
1503
  // create the accessory handler for the restored accessory
1504
1504
  // this is imported from `platformAccessory.ts`
1505
1505
  new Lock(this, existingAccessory, device);
1506
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1506
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1507
1507
  }
1508
1508
  else {
1509
1509
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1527,17 +1527,17 @@ export class SwitchBotPlatform {
1527
1527
  accessory.context.connectionType = await this.connectionType(device);
1528
1528
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1529
1529
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1530
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1530
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1531
1531
  // create the accessory handler for the newly create accessory
1532
1532
  // this is imported from `platformAccessory.ts`
1533
1533
  new Lock(this, accessory, device);
1534
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1534
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1535
1535
  // publish device externally or link the accessory to your platform
1536
1536
  this.externalOrPlatform(device, accessory);
1537
1537
  this.accessories.push(accessory);
1538
1538
  }
1539
1539
  else {
1540
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1540
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1541
1541
  }
1542
1542
  }
1543
1543
  async createColorBulb(device) {
@@ -1558,12 +1558,12 @@ export class SwitchBotPlatform {
1558
1558
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1559
1559
  existingAccessory.context.connectionType = await this.connectionType(device);
1560
1560
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1561
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1561
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1562
1562
  this.api.updatePlatformAccessories([existingAccessory]);
1563
1563
  // create the accessory handler for the restored accessory
1564
1564
  // this is imported from `platformAccessory.ts`
1565
1565
  new ColorBulb(this, existingAccessory, device);
1566
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1566
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1567
1567
  }
1568
1568
  else {
1569
1569
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1587,17 +1587,17 @@ export class SwitchBotPlatform {
1587
1587
  accessory.context.connectionType = await this.connectionType(device);
1588
1588
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1589
1589
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1590
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1590
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1591
1591
  // create the accessory handler for the newly create accessory
1592
1592
  // this is imported from `platformAccessory.ts`
1593
1593
  new ColorBulb(this, accessory, device);
1594
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1594
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1595
1595
  // publish device externally or link the accessory to your platform
1596
1596
  this.externalOrPlatform(device, accessory);
1597
1597
  this.accessories.push(accessory);
1598
1598
  }
1599
1599
  else {
1600
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1600
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1601
1601
  }
1602
1602
  }
1603
1603
  async createCeilingLight(device) {
@@ -1618,12 +1618,12 @@ export class SwitchBotPlatform {
1618
1618
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1619
1619
  existingAccessory.context.connectionType = await this.connectionType(device);
1620
1620
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1621
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1621
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1622
1622
  this.api.updatePlatformAccessories([existingAccessory]);
1623
1623
  // create the accessory handler for the restored accessory
1624
1624
  // this is imported from `platformAccessory.ts`
1625
1625
  new CeilingLight(this, existingAccessory, device);
1626
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1626
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1627
1627
  }
1628
1628
  else {
1629
1629
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1647,17 +1647,17 @@ export class SwitchBotPlatform {
1647
1647
  accessory.context.connectionType = await this.connectionType(device);
1648
1648
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1649
1649
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1650
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1650
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1651
1651
  // create the accessory handler for the newly create accessory
1652
1652
  // this is imported from `platformAccessory.ts`
1653
1653
  new CeilingLight(this, accessory, device);
1654
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1654
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1655
1655
  // publish device externally or link the accessory to your platform
1656
1656
  this.externalOrPlatform(device, accessory);
1657
1657
  this.accessories.push(accessory);
1658
1658
  }
1659
1659
  else {
1660
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1660
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1661
1661
  }
1662
1662
  }
1663
1663
  async createStripLight(device) {
@@ -1678,12 +1678,12 @@ export class SwitchBotPlatform {
1678
1678
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1679
1679
  existingAccessory.context.connectionType = await this.connectionType(device);
1680
1680
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1681
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1681
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1682
1682
  this.api.updatePlatformAccessories([existingAccessory]);
1683
1683
  // create the accessory handler for the restored accessory
1684
1684
  // this is imported from `platformAccessory.ts`
1685
1685
  new StripLight(this, existingAccessory, device);
1686
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1686
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1687
1687
  }
1688
1688
  else {
1689
1689
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1707,17 +1707,17 @@ export class SwitchBotPlatform {
1707
1707
  accessory.context.connectionType = await this.connectionType(device);
1708
1708
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1709
1709
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1710
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1710
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1711
1711
  // create the accessory handler for the newly create accessory
1712
1712
  // this is imported from `platformAccessory.ts`
1713
1713
  new StripLight(this, accessory, device);
1714
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1714
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1715
1715
  // publish device externally or link the accessory to your platform
1716
1716
  this.externalOrPlatform(device, accessory);
1717
1717
  this.accessories.push(accessory);
1718
1718
  }
1719
1719
  else {
1720
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1720
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1721
1721
  }
1722
1722
  }
1723
1723
  async createFan(device) {
@@ -1738,12 +1738,12 @@ export class SwitchBotPlatform {
1738
1738
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1739
1739
  existingAccessory.context.connectionType = await this.connectionType(device);
1740
1740
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1741
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1741
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1742
1742
  this.api.updatePlatformAccessories([existingAccessory]);
1743
1743
  // create the accessory handler for the restored accessory
1744
1744
  // this is imported from `platformAccessory.ts`
1745
1745
  new Fan(this, existingAccessory, device);
1746
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1746
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1747
1747
  }
1748
1748
  else {
1749
1749
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1767,17 +1767,17 @@ export class SwitchBotPlatform {
1767
1767
  accessory.context.connectionType = await this.connectionType(device);
1768
1768
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1769
1769
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1770
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1770
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1771
1771
  // create the accessory handler for the newly create accessory
1772
1772
  // this is imported from `platformAccessory.ts`
1773
1773
  new Fan(this, accessory, device);
1774
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1774
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1775
1775
  // publish device externally or link the accessory to your platform
1776
1776
  this.externalOrPlatform(device, accessory);
1777
1777
  this.accessories.push(accessory);
1778
1778
  }
1779
1779
  else {
1780
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1780
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1781
1781
  }
1782
1782
  }
1783
1783
  async createRobotVacuumCleaner(device) {
@@ -1808,12 +1808,12 @@ export class SwitchBotPlatform {
1808
1808
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1809
1809
  existingAccessory.context.connectionType = await this.connectionType(device);
1810
1810
  existingAccessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1811
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1811
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1812
1812
  this.api.updatePlatformAccessories([existingAccessory]);
1813
1813
  // create the accessory handler for the restored accessory
1814
1814
  // this is imported from `platformAccessory.ts`
1815
1815
  new RobotVacuumCleaner(this, existingAccessory, device);
1816
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1816
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${existingAccessory.UUID})`);
1817
1817
  }
1818
1818
  else {
1819
1819
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1847,17 +1847,17 @@ export class SwitchBotPlatform {
1847
1847
  accessory.context.connectionType = await this.connectionType(device);
1848
1848
  accessory.context.version = device.firmware ?? device.version ?? this.version ?? '0.0.0';
1849
1849
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1850
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1850
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1851
1851
  // create the accessory handler for the newly create accessory
1852
1852
  // this is imported from `platformAccessory.ts`
1853
1853
  new RobotVacuumCleaner(this, accessory, device);
1854
- await this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1854
+ this.debugLog(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}, (${accessory.UUID})`);
1855
1855
  // publish device externally or link the accessory to your platform
1856
1856
  this.externalOrPlatform(device, accessory);
1857
1857
  this.accessories.push(accessory);
1858
1858
  }
1859
1859
  else {
1860
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1860
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.deviceType} deviceId: ${device.deviceId}`);
1861
1861
  }
1862
1862
  }
1863
1863
  async createTV(device) {
@@ -1874,13 +1874,13 @@ export class SwitchBotPlatform {
1874
1874
  existingAccessory.displayName = device.configDeviceName
1875
1875
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
1876
1876
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1877
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1877
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1878
1878
  existingAccessory.context.connectionType = device.connectionType;
1879
1879
  this.api.updatePlatformAccessories([existingAccessory]);
1880
1880
  // create the accessory handler for the restored accessory
1881
1881
  // this is imported from `platformAccessory.ts`
1882
1882
  new TV(this, existingAccessory, device);
1883
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
1883
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
1884
1884
  }
1885
1885
  else if (!device.hide_device && device.hubDeviceId) {
1886
1886
  // create a new accessory
@@ -1899,16 +1899,16 @@ export class SwitchBotPlatform {
1899
1899
  accessory.context.connectionType = await this.connectionType(device);
1900
1900
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
1901
1901
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1902
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1902
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1903
1903
  // create the accessory handler for the newly create accessory
1904
1904
  // this is imported from `platformAccessory.ts`
1905
1905
  new TV(this, accessory, device);
1906
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
1906
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
1907
1907
  this.externalOrPlatform(device, accessory);
1908
1908
  this.accessories.push(accessory);
1909
1909
  }
1910
1910
  else {
1911
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
1911
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
1912
1912
  }
1913
1913
  }
1914
1914
  async createIRFan(device) {
@@ -1927,13 +1927,13 @@ export class SwitchBotPlatform {
1927
1927
  existingAccessory.displayName = device.configDeviceName
1928
1928
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
1929
1929
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1930
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1930
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1931
1931
  existingAccessory.context.connectionType = device.connectionType;
1932
1932
  this.api.updatePlatformAccessories([existingAccessory]);
1933
1933
  // create the accessory handler for the restored accessory
1934
1934
  // this is imported from `platformAccessory.ts`
1935
1935
  new IRFan(this, existingAccessory, device);
1936
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
1936
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
1937
1937
  }
1938
1938
  else {
1939
1939
  this.unregisterPlatformAccessories(existingAccessory);
@@ -1956,17 +1956,17 @@ export class SwitchBotPlatform {
1956
1956
  accessory.context.connectionType = await this.connectionType(device);
1957
1957
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
1958
1958
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
1959
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1959
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
1960
1960
  // create the accessory handler for the newly create accessory
1961
1961
  // this is imported from `platformAccessory.ts`
1962
1962
  new IRFan(this, accessory, device);
1963
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
1963
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
1964
1964
  // publish device externally or link the accessory to your platform
1965
1965
  this.externalOrPlatform(device, accessory);
1966
1966
  this.accessories.push(accessory);
1967
1967
  }
1968
1968
  else {
1969
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
1969
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
1970
1970
  }
1971
1971
  }
1972
1972
  async createLight(device) {
@@ -1985,13 +1985,13 @@ export class SwitchBotPlatform {
1985
1985
  existingAccessory.displayName = device.configDeviceName
1986
1986
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
1987
1987
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
1988
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1988
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
1989
1989
  existingAccessory.context.connectionType = device.connectionType;
1990
1990
  this.api.updatePlatformAccessories([existingAccessory]);
1991
1991
  // create the accessory handler for the restored accessory
1992
1992
  // this is imported from `platformAccessory.ts`
1993
1993
  new Light(this, existingAccessory, device);
1994
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
1994
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
1995
1995
  }
1996
1996
  else {
1997
1997
  this.unregisterPlatformAccessories(existingAccessory);
@@ -2014,17 +2014,17 @@ export class SwitchBotPlatform {
2014
2014
  accessory.context.connectionType = await this.connectionType(device);
2015
2015
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
2016
2016
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
2017
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2017
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2018
2018
  // create the accessory handler for the newly create accessory
2019
2019
  // this is imported from `platformAccessory.ts`
2020
2020
  new Light(this, accessory, device);
2021
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2021
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2022
2022
  // publish device externally or link the accessory to your platform
2023
2023
  this.externalOrPlatform(device, accessory);
2024
2024
  this.accessories.push(accessory);
2025
2025
  }
2026
2026
  else {
2027
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2027
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2028
2028
  }
2029
2029
  }
2030
2030
  async createAirConditioner(device) {
@@ -2043,13 +2043,13 @@ export class SwitchBotPlatform {
2043
2043
  existingAccessory.displayName = device.configDeviceName
2044
2044
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2045
2045
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
2046
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2046
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2047
2047
  existingAccessory.context.connectionType = device.connectionType;
2048
2048
  this.api.updatePlatformAccessories([existingAccessory]);
2049
2049
  // create the accessory handler for the restored accessory
2050
2050
  // this is imported from `platformAccessory.ts`
2051
2051
  new AirConditioner(this, existingAccessory, device);
2052
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2052
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2053
2053
  }
2054
2054
  else {
2055
2055
  this.unregisterPlatformAccessories(existingAccessory);
@@ -2072,17 +2072,17 @@ export class SwitchBotPlatform {
2072
2072
  accessory.context.connectionType = await this.connectionType(device);
2073
2073
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
2074
2074
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
2075
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2075
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2076
2076
  // create the accessory handler for the newly create accessory
2077
2077
  // this is imported from `platformAccessory.ts`
2078
2078
  new AirConditioner(this, accessory, device);
2079
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2079
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2080
2080
  // publish device externally or link the accessory to your platform
2081
2081
  this.externalOrPlatform(device, accessory);
2082
2082
  this.accessories.push(accessory);
2083
2083
  }
2084
2084
  else {
2085
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2085
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2086
2086
  }
2087
2087
  }
2088
2088
  async createAirPurifier(device) {
@@ -2101,13 +2101,13 @@ export class SwitchBotPlatform {
2101
2101
  existingAccessory.displayName = device.configDeviceName
2102
2102
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2103
2103
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
2104
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2104
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2105
2105
  existingAccessory.context.connectionType = device.connectionType;
2106
2106
  this.api.updatePlatformAccessories([existingAccessory]);
2107
2107
  // create the accessory handler for the restored accessory
2108
2108
  // this is imported from `platformAccessory.ts`
2109
2109
  new AirPurifier(this, existingAccessory, device);
2110
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2110
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2111
2111
  }
2112
2112
  else {
2113
2113
  this.unregisterPlatformAccessories(existingAccessory);
@@ -2130,17 +2130,17 @@ export class SwitchBotPlatform {
2130
2130
  accessory.context.connectionType = await this.connectionType(device);
2131
2131
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
2132
2132
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
2133
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2133
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2134
2134
  // create the accessory handler for the newly create accessory
2135
2135
  // this is imported from `platformAccessory.ts`
2136
2136
  new AirPurifier(this, accessory, device);
2137
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2137
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2138
2138
  // publish device externally or link the accessory to your platform
2139
2139
  this.externalOrPlatform(device, accessory);
2140
2140
  this.accessories.push(accessory);
2141
2141
  }
2142
2142
  else {
2143
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2143
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2144
2144
  }
2145
2145
  }
2146
2146
  async createWaterHeater(device) {
@@ -2159,13 +2159,13 @@ export class SwitchBotPlatform {
2159
2159
  existingAccessory.displayName = device.configDeviceName
2160
2160
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2161
2161
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
2162
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2162
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2163
2163
  existingAccessory.context.connectionType = device.connectionType;
2164
2164
  this.api.updatePlatformAccessories([existingAccessory]);
2165
2165
  // create the accessory handler for the restored accessory
2166
2166
  // this is imported from `platformAccessory.ts`
2167
2167
  new WaterHeater(this, existingAccessory, device);
2168
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2168
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2169
2169
  }
2170
2170
  else {
2171
2171
  this.unregisterPlatformAccessories(existingAccessory);
@@ -2188,17 +2188,17 @@ export class SwitchBotPlatform {
2188
2188
  accessory.context.connectionType = await this.connectionType(device);
2189
2189
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
2190
2190
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
2191
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2191
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2192
2192
  // create the accessory handler for the newly create accessory
2193
2193
  // this is imported from `platformAccessory.ts`
2194
2194
  new WaterHeater(this, accessory, device);
2195
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2195
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2196
2196
  // publish device externally or link the accessory to your platform
2197
2197
  this.externalOrPlatform(device, accessory);
2198
2198
  this.accessories.push(accessory);
2199
2199
  }
2200
2200
  else {
2201
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2201
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2202
2202
  }
2203
2203
  }
2204
2204
  async createVacuumCleaner(device) {
@@ -2217,13 +2217,13 @@ export class SwitchBotPlatform {
2217
2217
  existingAccessory.displayName = device.configDeviceName
2218
2218
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2219
2219
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
2220
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2220
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2221
2221
  existingAccessory.context.connectionType = device.connectionType;
2222
2222
  this.api.updatePlatformAccessories([existingAccessory]);
2223
2223
  // create the accessory handler for the restored accessory
2224
2224
  // this is imported from `platformAccessory.ts`
2225
2225
  new VacuumCleaner(this, existingAccessory, device);
2226
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2226
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2227
2227
  }
2228
2228
  else {
2229
2229
  this.unregisterPlatformAccessories(existingAccessory);
@@ -2246,17 +2246,17 @@ export class SwitchBotPlatform {
2246
2246
  accessory.context.connectionType = await this.connectionType(device);
2247
2247
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
2248
2248
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
2249
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2249
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2250
2250
  // create the accessory handler for the newly create accessory
2251
2251
  // this is imported from `platformAccessory.ts`
2252
2252
  new VacuumCleaner(this, accessory, device);
2253
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2253
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2254
2254
  // publish device externally or link the accessory to your platform
2255
2255
  this.externalOrPlatform(device, accessory);
2256
2256
  this.accessories.push(accessory);
2257
2257
  }
2258
2258
  else {
2259
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2259
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2260
2260
  }
2261
2261
  }
2262
2262
  async createCamera(device) {
@@ -2275,13 +2275,13 @@ export class SwitchBotPlatform {
2275
2275
  existingAccessory.displayName = device.configDeviceName
2276
2276
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2277
2277
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
2278
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2278
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2279
2279
  existingAccessory.context.connectionType = device.connectionType;
2280
2280
  this.api.updatePlatformAccessories([existingAccessory]);
2281
2281
  // create the accessory handler for the restored accessory
2282
2282
  // this is imported from `platformAccessory.ts`
2283
2283
  new Camera(this, existingAccessory, device);
2284
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2284
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2285
2285
  }
2286
2286
  else {
2287
2287
  this.unregisterPlatformAccessories(existingAccessory);
@@ -2304,17 +2304,17 @@ export class SwitchBotPlatform {
2304
2304
  accessory.context.connectionType = await this.connectionType(device);
2305
2305
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
2306
2306
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
2307
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2307
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2308
2308
  // create the accessory handler for the newly create accessory
2309
2309
  // this is imported from `platformAccessory.ts`
2310
2310
  new Camera(this, accessory, device);
2311
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2311
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2312
2312
  // publish device externally or link the accessory to your platform
2313
2313
  this.externalOrPlatform(device, accessory);
2314
2314
  this.accessories.push(accessory);
2315
2315
  }
2316
2316
  else {
2317
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2317
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2318
2318
  }
2319
2319
  }
2320
2320
  async createOthers(device) {
@@ -2333,13 +2333,13 @@ export class SwitchBotPlatform {
2333
2333
  existingAccessory.displayName = device.configDeviceName
2334
2334
  ? await this.validateAndCleanDisplayName(device.configDeviceName, 'configDeviceName', device.configDeviceName)
2335
2335
  : await this.validateAndCleanDisplayName(device.deviceName, 'deviceName', device.deviceName);
2336
- await this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2336
+ this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} deviceId: ${device.deviceId}`);
2337
2337
  existingAccessory.context.connectionType = device.connectionType;
2338
2338
  this.api.updatePlatformAccessories([existingAccessory]);
2339
2339
  // create the accessory handler for the restored accessory
2340
2340
  // this is imported from `platformAccessory.ts`
2341
2341
  new Others(this, existingAccessory, device);
2342
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2342
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${existingAccessory.UUID})`);
2343
2343
  }
2344
2344
  else {
2345
2345
  this.unregisterPlatformAccessories(existingAccessory);
@@ -2362,27 +2362,27 @@ export class SwitchBotPlatform {
2362
2362
  accessory.context.connectionType = await this.connectionType(device);
2363
2363
  accessory.context.version = device.firmware ?? this.version ?? '0.0.0';
2364
2364
  const newOrExternal = !device.external ? 'Adding new' : 'Loading external';
2365
- await this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2365
+ this.infoLog(`${newOrExternal} accessory: ${accessory.displayName} deviceId: ${device.deviceId}`);
2366
2366
  // create the accessory handler for the newly create accessory
2367
2367
  // this is imported from `platformAccessory.ts`
2368
2368
  new Others(this, accessory, device);
2369
- await this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2369
+ this.debugLog(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}, (${accessory.UUID})`);
2370
2370
  // publish device externally or link the accessory to your platform
2371
2371
  this.externalOrPlatform(device, accessory);
2372
2372
  this.accessories.push(accessory);
2373
2373
  }
2374
2374
  else {
2375
- await this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2375
+ this.debugLog(`Device not registered: ${device.deviceName} ${device.remoteType} deviceId: ${device.deviceId}`);
2376
2376
  }
2377
2377
  }
2378
2378
  async registerCurtains(device) {
2379
2379
  let registerWindowCovering;
2380
2380
  if (isCurtainDevice(device)) {
2381
- await this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, curtainDevicesIds: ${device.curtainDevicesIds},x master: ${device.master}, group: ${device.group}, disable_group: ${device.disable_group}, connectionType: ${device.connectionType}`);
2381
+ this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, curtainDevicesIds: ${device.curtainDevicesIds},x master: ${device.master}, group: ${device.group}, disable_group: ${device.disable_group}, connectionType: ${device.connectionType}`);
2382
2382
  registerWindowCovering = await this.registerWindowCovering(device);
2383
2383
  }
2384
2384
  else if (isBlindTiltDevice(device)) {
2385
- await this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, blindTiltDevicesIds: ${device.blindTiltDevicesIds}, master: ${device.master}, group: ${device.group}, disable_group: ${device.disable_group}, connectionType: ${device.connectionType}`);
2385
+ this.debugWarnLog(`deviceName: ${device.deviceName} deviceId: ${device.deviceId}, blindTiltDevicesIds: ${device.blindTiltDevicesIds}, master: ${device.master}, group: ${device.group}, disable_group: ${device.disable_group}, connectionType: ${device.connectionType}`);
2386
2386
  registerWindowCovering = await this.registerWindowCovering(device);
2387
2387
  }
2388
2388
  else {
@@ -2391,35 +2391,35 @@ export class SwitchBotPlatform {
2391
2391
  return registerWindowCovering;
2392
2392
  }
2393
2393
  async registerWindowCovering(device) {
2394
- await this.debugLog(`master: ${device.master}`);
2394
+ this.debugLog(`master: ${device.master}`);
2395
2395
  let registerCurtain;
2396
2396
  if (device.master && device.group) {
2397
2397
  // OpenAPI: Master Curtains/Blind Tilt in Group
2398
2398
  registerCurtain = true;
2399
- await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group} connectionType; ${device.connectionType}`);
2400
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2399
+ this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group} connectionType; ${device.connectionType}`);
2400
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2401
2401
  }
2402
2402
  else if (!device.master && device.disable_group) {
2403
2403
  registerCurtain = true;
2404
- await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, disable_group: ${device.disable_group}, connectionType; ${device.connectionType}`);
2405
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2404
+ this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, disable_group: ${device.disable_group}, connectionType; ${device.connectionType}`);
2405
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2406
2406
  }
2407
2407
  else if (device.master && !device.group) {
2408
2408
  // OpenAPI: Master Curtains/Blind Tilts not in Group
2409
2409
  registerCurtain = true;
2410
- await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group} connectionType; ${device.connectionType}`);
2411
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2410
+ this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] device.master: ${device.master}, device.group: ${device.group} connectionType; ${device.connectionType}`);
2411
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2412
2412
  }
2413
2413
  else if (device.connectionType === 'BLE') {
2414
2414
  // BLE: Curtains/Blind Tilt
2415
2415
  registerCurtain = true;
2416
- await this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] connectionType: ${device.connectionType}, group: ${device.group}`);
2417
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2416
+ this.debugLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] connectionType: ${device.connectionType}, group: ${device.group}`);
2417
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}`);
2418
2418
  }
2419
2419
  else {
2420
2420
  registerCurtain = false;
2421
- await this.debugErrorLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] disable_group: ${device.disable_group}, device.master: ${device.master}, device.group: ${device.group}`);
2422
- await this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}, device.connectionType: ${device.connectionType}`);
2421
+ this.debugErrorLog(`deviceName: ${device.deviceName} [${device.deviceType} Config] disable_group: ${device.disable_group}, device.master: ${device.master}, device.group: ${device.group}`);
2422
+ this.debugWarnLog(`Device: ${device.deviceName} registerCurtains: ${registerCurtain}, device.connectionType: ${device.connectionType}`);
2423
2423
  }
2424
2424
  return registerCurtain;
2425
2425
  }
@@ -2442,7 +2442,7 @@ export class SwitchBotPlatform {
2442
2442
  }
2443
2443
  else {
2444
2444
  registerDevice = false;
2445
- await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, hide_device: ${device.hide_device}, will not display in HomeKit`);
2445
+ this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, hide_device: ${device.hide_device}, will not display in HomeKit`);
2446
2446
  }
2447
2447
  return registerDevice;
2448
2448
  }
@@ -2453,17 +2453,17 @@ export class SwitchBotPlatform {
2453
2453
  case 'Curtain3':
2454
2454
  case 'Blind Tilt':
2455
2455
  registerDevice = await this.registerCurtains(device);
2456
- await this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2456
+ this.debugWarnLog(`Device: ${device.deviceName} ${device.deviceType} registerDevice: ${registerDevice}`);
2457
2457
  break;
2458
2458
  default:
2459
2459
  registerDevice = true;
2460
- await this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2460
+ this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2461
2461
  }
2462
2462
  if (registerDevice) {
2463
- await this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2463
+ this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2464
2464
  }
2465
2465
  else {
2466
- await this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2466
+ this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2467
2467
  }
2468
2468
  return registerDevice;
2469
2469
  }
@@ -2471,11 +2471,11 @@ export class SwitchBotPlatform {
2471
2471
  const { displayName } = accessory;
2472
2472
  const isExternal = device.external ?? false;
2473
2473
  if (isExternal) {
2474
- await this.debugWarnLog(`${displayName} External Accessory Mode`);
2474
+ this.debugWarnLog(`${displayName} External Accessory Mode`);
2475
2475
  this.api.publishExternalAccessories(PLUGIN_NAME, [accessory]);
2476
2476
  }
2477
2477
  else {
2478
- await this.debugLog(`${displayName} External Accessory Mode: ${isExternal}`);
2478
+ this.debugLog(`${displayName} External Accessory Mode: ${isExternal}`);
2479
2479
  this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
2480
2480
  }
2481
2481
  }
@@ -2519,10 +2519,10 @@ export class SwitchBotPlatform {
2519
2519
  };
2520
2520
  const message = messages[statusCode] ?? `Unknown statusCode, statusCode: ${statusCode}, Submit Bugs Here: https://tinyurl.com/SwitchBotBug`;
2521
2521
  if ([100, 200].includes(statusCode)) {
2522
- await this.debugLog(message);
2522
+ this.debugLog(message);
2523
2523
  }
2524
2524
  else {
2525
- await this.errorLog(message);
2525
+ this.errorLog(message);
2526
2526
  }
2527
2527
  }
2528
2528
  async retryRequest(deviceId, deviceMaxRetries, deviceDelayBetweenRetries) {
@@ -2532,14 +2532,14 @@ export class SwitchBotPlatform {
2532
2532
  while (retryCount < maxRetries) {
2533
2533
  try {
2534
2534
  const { response, statusCode } = await this.switchBotAPI.getDeviceStatus(deviceId);
2535
- await this.debugLog(`response: ${JSON.stringify(response)}`);
2535
+ this.debugLog(`response: ${JSON.stringify(response)}`);
2536
2536
  return { response, statusCode };
2537
2537
  }
2538
2538
  catch (error) {
2539
- await this.errorLog(`Error making request: ${error.message}`);
2539
+ this.errorLog(`Error making request: ${error.message}`);
2540
2540
  }
2541
2541
  retryCount++;
2542
- await this.debugLog(`Retry attempt ${retryCount} of ${maxRetries}`);
2542
+ this.debugLog(`Retry attempt ${retryCount} of ${maxRetries}`);
2543
2543
  await sleep(delayBetweenRetries);
2544
2544
  }
2545
2545
  return { response: {
@@ -2555,17 +2555,17 @@ export class SwitchBotPlatform {
2555
2555
  async connectBLE(accessory, device) {
2556
2556
  try {
2557
2557
  queueScheduler.schedule(async () => this.switchBotBLE);
2558
- await this.debugLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' found: ${this.switchBotBLE}`);
2558
+ this.debugLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' found: ${this.switchBotBLE}`);
2559
2559
  return this.switchBotBLE;
2560
2560
  }
2561
2561
  catch (e) {
2562
- await this.errorLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' not found, Error: ${e.message ?? e}`);
2562
+ this.errorLog(`${device.deviceType}: ${accessory.displayName} 'node-switchbot' not found, Error: ${e.message ?? e}`);
2563
2563
  return false;
2564
2564
  }
2565
2565
  }
2566
2566
  async getVersion() {
2567
2567
  const json = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));
2568
- await this.debugLog(`Plugin Version: ${json.version}`);
2568
+ this.debugLog(`Plugin Version: ${json.version}`);
2569
2569
  this.version = json.version;
2570
2570
  return json.version;
2571
2571
  }
@@ -2580,15 +2580,15 @@ export class SwitchBotPlatform {
2580
2580
  this.maxRetries = options.maxRetries || 3;
2581
2581
  platformConfig.maxRetries = this.maxRetries;
2582
2582
  if (!options.maxRetries) {
2583
- await this.debugWarnLog('Using Default Max Retries');
2583
+ this.debugWarnLog('Using Default Max Retries');
2584
2584
  }
2585
2585
  this.delayBetweenRetries = (options.delayBetweenRetries || 3) * 1000;
2586
2586
  platformConfig.delayBetweenRetries = this.delayBetweenRetries / 1000;
2587
2587
  if (!options.delayBetweenRetries) {
2588
- await this.debugWarnLog('Using Default Delay Between Retries');
2588
+ this.debugWarnLog('Using Default Delay Between Retries');
2589
2589
  }
2590
2590
  if (Object.keys(platformConfig).length) {
2591
- await this.debugLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
2591
+ this.debugLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
2592
2592
  }
2593
2593
  this.platformConfig = platformConfig;
2594
2594
  }
@@ -2597,15 +2597,15 @@ export class SwitchBotPlatform {
2597
2597
  this.debugMode = process.argv.includes('-D') ?? process.argv.includes('--debug');
2598
2598
  if (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard' || this.config.options?.logging === 'none') {
2599
2599
  this.platformLogging = this.config.options.logging;
2600
- await this.debugWarnLog(`Using Config Logging: ${this.platformLogging}`);
2600
+ this.debugWarnLog(`Using Config Logging: ${this.platformLogging}`);
2601
2601
  }
2602
2602
  else if (this.debugMode) {
2603
2603
  this.platformLogging = 'debugMode';
2604
- await this.debugWarnLog(`Using ${this.platformLogging} Logging`);
2604
+ this.debugWarnLog(`Using ${this.platformLogging} Logging`);
2605
2605
  }
2606
2606
  else {
2607
2607
  this.platformLogging = 'standard';
2608
- await this.debugWarnLog(`Using ${this.platformLogging} Logging`);
2608
+ this.debugWarnLog(`Using ${this.platformLogging} Logging`);
2609
2609
  }
2610
2610
  }
2611
2611
  /**
@@ -2624,20 +2624,20 @@ export class SwitchBotPlatform {
2624
2624
  const invalidCharsPattern = /[^\p{L}\p{N} ']/gu;
2625
2625
  const invalidStartEndPattern = /^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu;
2626
2626
  if (typeof value === 'string' && !validPattern.test(value)) {
2627
- 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.`);
2627
+ 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.`);
2628
2628
  // Remove invalid characters
2629
2629
  if (invalidCharsPattern.test(value)) {
2630
2630
  const before = value;
2631
- 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`);
2631
+ this.warnLog(`Removing invalid characters from '${name}' characteristic, if you feel this is incorrect, please enable \'allowInvalidCharacter\' in the config to allow all characters`);
2632
2632
  value = value.replace(invalidCharsPattern, '');
2633
- await this.warnLog(`${name} Before: '${before}' After: '${value}'`);
2633
+ this.warnLog(`${name} Before: '${before}' After: '${value}'`);
2634
2634
  }
2635
2635
  // Ensure it starts and ends with an alphanumeric character
2636
2636
  if (invalidStartEndPattern.test(value)) {
2637
2637
  const before = value;
2638
- 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`);
2638
+ 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`);
2639
2639
  value = value.replace(invalidStartEndPattern, '');
2640
- await this.warnLog(`${name} Before: '${before}' After: '${value}'`);
2640
+ this.warnLog(`${name} Before: '${before}' After: '${value}'`);
2641
2641
  }
2642
2642
  }
2643
2643
  return value;