@switchbot/homebridge-switchbot 4.1.8-beta.4 → 4.1.8-beta.5

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 (89) hide show
  1. package/dist/device/blindtilt.d.ts.map +1 -1
  2. package/dist/device/blindtilt.js +17 -6
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.d.ts.map +1 -1
  5. package/dist/device/bot.js +17 -6
  6. package/dist/device/bot.js.map +1 -1
  7. package/dist/device/ceilinglight.d.ts.map +1 -1
  8. package/dist/device/ceilinglight.js +17 -6
  9. package/dist/device/ceilinglight.js.map +1 -1
  10. package/dist/device/colorbulb.d.ts.map +1 -1
  11. package/dist/device/colorbulb.js +17 -6
  12. package/dist/device/colorbulb.js.map +1 -1
  13. package/dist/device/contact.d.ts.map +1 -1
  14. package/dist/device/contact.js +17 -6
  15. package/dist/device/contact.js.map +1 -1
  16. package/dist/device/curtain.d.ts.map +1 -1
  17. package/dist/device/curtain.js +17 -6
  18. package/dist/device/curtain.js.map +1 -1
  19. package/dist/device/fan.d.ts.map +1 -1
  20. package/dist/device/fan.js +17 -6
  21. package/dist/device/fan.js.map +1 -1
  22. package/dist/device/hub.d.ts.map +1 -1
  23. package/dist/device/hub.js +17 -6
  24. package/dist/device/hub.js.map +1 -1
  25. package/dist/device/humidifier.d.ts.map +1 -1
  26. package/dist/device/humidifier.js +17 -6
  27. package/dist/device/humidifier.js.map +1 -1
  28. package/dist/device/iosensor.d.ts.map +1 -1
  29. package/dist/device/iosensor.js +17 -6
  30. package/dist/device/iosensor.js.map +1 -1
  31. package/dist/device/lightstrip.d.ts.map +1 -1
  32. package/dist/device/lightstrip.js +17 -6
  33. package/dist/device/lightstrip.js.map +1 -1
  34. package/dist/device/lock.d.ts.map +1 -1
  35. package/dist/device/lock.js +17 -6
  36. package/dist/device/lock.js.map +1 -1
  37. package/dist/device/meter.d.ts.map +1 -1
  38. package/dist/device/meter.js +17 -6
  39. package/dist/device/meter.js.map +1 -1
  40. package/dist/device/meterplus.d.ts.map +1 -1
  41. package/dist/device/meterplus.js +17 -6
  42. package/dist/device/meterplus.js.map +1 -1
  43. package/dist/device/meterpro.d.ts.map +1 -1
  44. package/dist/device/meterpro.js +17 -6
  45. package/dist/device/meterpro.js.map +1 -1
  46. package/dist/device/motion.d.ts.map +1 -1
  47. package/dist/device/motion.js +17 -6
  48. package/dist/device/motion.js.map +1 -1
  49. package/dist/device/plug.d.ts.map +1 -1
  50. package/dist/device/plug.js +17 -6
  51. package/dist/device/plug.js.map +1 -1
  52. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  53. package/dist/device/robotvacuumcleaner.js +17 -6
  54. package/dist/device/robotvacuumcleaner.js.map +1 -1
  55. package/dist/device/waterdetector.d.ts.map +1 -1
  56. package/dist/device/waterdetector.js +17 -6
  57. package/dist/device/waterdetector.js.map +1 -1
  58. package/docs/assets/dmt/dmt-component-data.js +1 -0
  59. package/docs/assets/dmt/dmt-components.css +20 -0
  60. package/docs/assets/dmt/dmt-components.js +67 -0
  61. package/docs/assets/dmt/dmt-search.cmp +0 -0
  62. package/docs/assets/dmt/dmt-theme.css +1 -0
  63. package/docs/assets/main.js +1 -1
  64. package/docs/functions/default.html +2 -1
  65. package/docs/index.html +7 -6
  66. package/docs/modules.html +2 -1
  67. package/package.json +5 -3
  68. package/src/device/blindtilt.ts +15 -6
  69. package/src/device/bot.ts +15 -6
  70. package/src/device/ceilinglight.ts +15 -6
  71. package/src/device/colorbulb.ts +15 -6
  72. package/src/device/contact.ts +15 -6
  73. package/src/device/curtain.ts +15 -6
  74. package/src/device/fan.ts +15 -6
  75. package/src/device/hub.ts +15 -6
  76. package/src/device/humidifier.ts +15 -6
  77. package/src/device/iosensor.ts +15 -6
  78. package/src/device/lightstrip.ts +15 -6
  79. package/src/device/lock.ts +15 -6
  80. package/src/device/meter.ts +15 -6
  81. package/src/device/meterplus.ts +15 -6
  82. package/src/device/meterpro.ts +15 -6
  83. package/src/device/motion.ts +15 -6
  84. package/src/device/plug.ts +15 -6
  85. package/src/device/robotvacuumcleaner.ts +15 -6
  86. package/src/device/waterdetector.ts +15 -6
  87. package/typedoc.json +4 -0
  88. package/docs/assets/navigation.js +0 -1
  89. package/docs/assets/search.js +0 -1
package/src/device/fan.ts CHANGED
@@ -356,10 +356,15 @@ export class Fan extends deviceBase {
356
356
  this.debugLog(`bleMac: ${this.device.bleMac}`)
357
357
  this.platform.bleEventHandler[this.device.bleMac] = async (context: batteryCirculatorFanServiceData) => {
358
358
  try {
359
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
360
359
  this.serviceData = context
361
- await this.BLEparseStatus()
362
- await this.updateHomeKitCharacteristics()
360
+ if (context !== undefined || context !== null) {
361
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
362
+ await this.BLEparseStatus()
363
+ await this.updateHomeKitCharacteristics()
364
+ } else {
365
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
366
+ await this.BLERefreshConnection(context)
367
+ }
363
368
  } catch (e: any) {
364
369
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
365
370
  }
@@ -397,10 +402,14 @@ export class Fan extends deviceBase {
397
402
  this.debugLog('is listening webhook.')
398
403
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: batteryCirculatorFanWebhookContext) => {
399
404
  try {
400
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
401
405
  this.webhookContext = context
402
- await this.parseStatusWebhook()
403
- await this.updateHomeKitCharacteristics()
406
+ if (context !== undefined || context !== null) {
407
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
408
+ await this.parseStatusWebhook()
409
+ await this.updateHomeKitCharacteristics()
410
+ } else {
411
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
412
+ }
404
413
  } catch (e: any) {
405
414
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
406
415
  }
package/src/device/hub.ts CHANGED
@@ -323,10 +323,15 @@ export class Hub extends deviceBase {
323
323
  this.debugLog(`bleMac: ${this.device.bleMac}`)
324
324
  this.platform.bleEventHandler[this.device.bleMac] = async (context: hub2ServiceData) => {
325
325
  try {
326
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
327
326
  this.serviceData = context
328
- await this.BLEparseStatus()
329
- await this.updateHomeKitCharacteristics()
327
+ if (context !== undefined || context !== null) {
328
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
329
+ await this.BLEparseStatus()
330
+ await this.updateHomeKitCharacteristics()
331
+ } else {
332
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
333
+ await this.BLERefreshConnection(context)
334
+ }
330
335
  } catch (e: any) {
331
336
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
332
337
  }
@@ -364,10 +369,14 @@ export class Hub extends deviceBase {
364
369
  this.debugLog('is listening webhook.')
365
370
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: hub2WebhookContext) => {
366
371
  try {
367
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
368
372
  this.webhookContext = context
369
- await this.parseStatusWebhook()
370
- await this.updateHomeKitCharacteristics()
373
+ if (context !== undefined || context !== null) {
374
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
375
+ await this.parseStatusWebhook()
376
+ await this.updateHomeKitCharacteristics()
377
+ } else {
378
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
379
+ }
371
380
  } catch (e: any) {
372
381
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
373
382
  }
@@ -353,10 +353,15 @@ export class Humidifier extends deviceBase {
353
353
  this.debugLog(`bleMac: ${this.device.bleMac}`)
354
354
  this.platform.bleEventHandler[this.device.bleMac] = async (context: humidifierServiceData | humidifier2ServiceData) => {
355
355
  try {
356
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
357
356
  this.serviceData = context
358
- await this.BLEparseStatus()
359
- await this.updateHomeKitCharacteristics()
357
+ if (context !== undefined || context !== null) {
358
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
359
+ await this.BLEparseStatus()
360
+ await this.updateHomeKitCharacteristics()
361
+ } else {
362
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
363
+ await this.BLERefreshConnection(context)
364
+ }
360
365
  } catch (e: any) {
361
366
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
362
367
  }
@@ -394,10 +399,14 @@ export class Humidifier extends deviceBase {
394
399
  this.debugLog('is listening webhook.')
395
400
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: humidifierWebhookContext | humidifier2WebhookContext) => {
396
401
  try {
397
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
398
402
  this.webhookContext = context
399
- await this.parseStatusWebhook()
400
- await this.updateHomeKitCharacteristics()
403
+ if (context !== undefined || context !== null) {
404
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
405
+ await this.parseStatusWebhook()
406
+ await this.updateHomeKitCharacteristics()
407
+ } else {
408
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
409
+ }
401
410
  } catch (e: any) {
402
411
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
403
412
  }
@@ -317,10 +317,15 @@ export class IOSensor extends deviceBase {
317
317
  this.debugLog(`bleMac: ${this.device.bleMac}`)
318
318
  this.platform.bleEventHandler[this.device.bleMac] = async (context: outdoorMeterServiceData) => {
319
319
  try {
320
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
321
320
  this.serviceData = context
322
- await this.BLEparseStatus()
323
- await this.updateHomeKitCharacteristics()
321
+ if (context !== undefined || context !== null) {
322
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
323
+ await this.BLEparseStatus()
324
+ await this.updateHomeKitCharacteristics()
325
+ } else {
326
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
327
+ await this.BLERefreshConnection(context)
328
+ }
324
329
  } catch (e: any) {
325
330
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
326
331
  }
@@ -358,10 +363,14 @@ export class IOSensor extends deviceBase {
358
363
  this.debugLog('is listening webhook.')
359
364
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: outdoorMeterWebhookContext) => {
360
365
  try {
361
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
362
366
  this.webhookContext = context
363
- await this.parseStatusWebhook()
364
- await this.updateHomeKitCharacteristics()
367
+ if (context !== undefined || context !== null) {
368
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
369
+ await this.parseStatusWebhook()
370
+ await this.updateHomeKitCharacteristics()
371
+ } else {
372
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
373
+ }
365
374
  } catch (e: any) {
366
375
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
367
376
  }
@@ -345,10 +345,15 @@ export class StripLight extends deviceBase {
345
345
  this.debugLog(`bleMac: ${this.device.bleMac}`)
346
346
  this.platform.bleEventHandler[this.device.bleMac] = async (context: stripLightServiceData) => {
347
347
  try {
348
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
349
348
  this.serviceData = context
350
- await this.BLEparseStatus()
351
- await this.updateHomeKitCharacteristics()
349
+ if (context !== undefined || context !== null) {
350
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
351
+ await this.BLEparseStatus()
352
+ await this.updateHomeKitCharacteristics()
353
+ } else {
354
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
355
+ await this.BLERefreshConnection(context)
356
+ }
352
357
  } catch (e: any) {
353
358
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
354
359
  }
@@ -386,10 +391,14 @@ export class StripLight extends deviceBase {
386
391
  this.debugLog('is listening webhook.')
387
392
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: stripLightWebhookContext) => {
388
393
  try {
389
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
390
394
  this.webhookContext = context
391
- await this.parseStatusWebhook()
392
- await this.updateHomeKitCharacteristics()
395
+ if (context !== undefined || context !== null) {
396
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
397
+ await this.parseStatusWebhook()
398
+ await this.updateHomeKitCharacteristics()
399
+ } else {
400
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
401
+ }
393
402
  } catch (e: any) {
394
403
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
395
404
  }
@@ -359,10 +359,15 @@ export class Lock extends deviceBase {
359
359
  this.debugLog(`bleMac: ${this.device.bleMac}`)
360
360
  this.platform.bleEventHandler[this.device.bleMac] = async (context: lockServiceData | lockProServiceData) => {
361
361
  try {
362
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
363
362
  this.serviceData = context
364
- await this.BLEparseStatus()
365
- await this.updateHomeKitCharacteristics()
363
+ if (context !== undefined || context !== null) {
364
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
365
+ await this.BLEparseStatus()
366
+ await this.updateHomeKitCharacteristics()
367
+ } else {
368
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
369
+ await this.BLERefreshConnection(context)
370
+ }
366
371
  } catch (e: any) {
367
372
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
368
373
  }
@@ -400,10 +405,14 @@ export class Lock extends deviceBase {
400
405
  this.debugLog('is listening webhook.')
401
406
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: lockWebhookContext | lockProWebhookContext) => {
402
407
  try {
403
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
404
408
  this.webhookContext = context
405
- await this.parseStatusWebhook()
406
- await this.updateHomeKitCharacteristics()
409
+ if (context !== undefined || context !== null) {
410
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
411
+ await this.parseStatusWebhook()
412
+ await this.updateHomeKitCharacteristics()
413
+ } else {
414
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
415
+ }
407
416
  } catch (e: any) {
408
417
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
409
418
  }
@@ -314,10 +314,15 @@ export class Meter extends deviceBase {
314
314
  this.debugLog(`bleMac: ${this.device.bleMac}`)
315
315
  this.platform.bleEventHandler[this.device.bleMac] = async (context: meterServiceData) => {
316
316
  try {
317
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
318
317
  this.serviceData = context
319
- await this.BLEparseStatus()
320
- await this.updateHomeKitCharacteristics()
318
+ if (context !== undefined || context !== null) {
319
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
320
+ await this.BLEparseStatus()
321
+ await this.updateHomeKitCharacteristics()
322
+ } else {
323
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
324
+ await this.BLERefreshConnection(context)
325
+ }
321
326
  } catch (e: any) {
322
327
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
323
328
  }
@@ -355,10 +360,14 @@ export class Meter extends deviceBase {
355
360
  this.debugLog('is listening webhook.')
356
361
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: meterWebhookContext) => {
357
362
  try {
358
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
359
363
  this.webhookContext = context
360
- await this.parseStatusWebhook()
361
- await this.updateHomeKitCharacteristics()
364
+ if (context !== undefined || context !== null) {
365
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
366
+ await this.parseStatusWebhook()
367
+ await this.updateHomeKitCharacteristics()
368
+ } else {
369
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
370
+ }
362
371
  } catch (e: any) {
363
372
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
364
373
  }
@@ -318,10 +318,15 @@ export class MeterPlus extends deviceBase {
318
318
  this.debugLog(`bleMac: ${this.device.bleMac}`)
319
319
  this.platform.bleEventHandler[this.device.bleMac] = async (context: meterPlusServiceData) => {
320
320
  try {
321
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
322
321
  this.serviceData = context
323
- await this.BLEparseStatus()
324
- await this.updateHomeKitCharacteristics()
322
+ if (context !== undefined || context !== null) {
323
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
324
+ await this.BLEparseStatus()
325
+ await this.updateHomeKitCharacteristics()
326
+ } else {
327
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
328
+ await this.BLERefreshConnection(context)
329
+ }
325
330
  } catch (e: any) {
326
331
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
327
332
  }
@@ -359,10 +364,14 @@ export class MeterPlus extends deviceBase {
359
364
  this.debugLog('is listening webhook.')
360
365
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: meterPlusWebhookContext) => {
361
366
  try {
362
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
363
367
  this.webhookContext = context
364
- await this.parseStatusWebhook()
365
- await this.updateHomeKitCharacteristics()
368
+ if (context !== undefined || context !== null) {
369
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
370
+ await this.parseStatusWebhook()
371
+ await this.updateHomeKitCharacteristics()
372
+ } else {
373
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
374
+ }
366
375
  } catch (e: any) {
367
376
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
368
377
  }
@@ -394,10 +394,15 @@ export class MeterPro extends deviceBase {
394
394
  this.debugLog(`bleMac: ${this.device.bleMac}`)
395
395
  this.platform.bleEventHandler[this.device.bleMac] = async (context: meterProServiceData) => {
396
396
  try {
397
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
398
397
  this.serviceData = context
399
- await this.BLEparseStatus()
400
- await this.updateHomeKitCharacteristics()
398
+ if (context !== undefined || context !== null) {
399
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
400
+ await this.BLEparseStatus()
401
+ await this.updateHomeKitCharacteristics()
402
+ } else {
403
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
404
+ await this.BLERefreshConnection(context)
405
+ }
401
406
  } catch (e: any) {
402
407
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
403
408
  }
@@ -435,10 +440,14 @@ export class MeterPro extends deviceBase {
435
440
  this.debugLog('is listening webhook.')
436
441
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: meterProWebhookContext) => {
437
442
  try {
438
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
439
443
  this.webhookContext = context
440
- await this.parseStatusWebhook()
441
- await this.updateHomeKitCharacteristics()
444
+ if (context !== undefined || context !== null) {
445
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
446
+ await this.parseStatusWebhook()
447
+ await this.updateHomeKitCharacteristics()
448
+ } else {
449
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
450
+ }
442
451
  } catch (e: any) {
443
452
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
444
453
  }
@@ -289,10 +289,15 @@ export class Motion extends deviceBase {
289
289
  this.debugLog(`bleMac: ${this.device.bleMac}`)
290
290
  this.platform.bleEventHandler[this.device.bleMac] = async (context: motionSensorServiceData) => {
291
291
  try {
292
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
293
292
  this.serviceData = context
294
- await this.BLEparseStatus()
295
- await this.updateHomeKitCharacteristics()
293
+ if (context !== undefined || context !== null) {
294
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
295
+ await this.BLEparseStatus()
296
+ await this.updateHomeKitCharacteristics()
297
+ } else {
298
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
299
+ await this.BLERefreshConnection(context)
300
+ }
296
301
  } catch (e: any) {
297
302
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
298
303
  }
@@ -330,10 +335,14 @@ export class Motion extends deviceBase {
330
335
  this.debugLog('is listening webhook.')
331
336
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: motionSensorWebhookContext) => {
332
337
  try {
333
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
334
338
  this.webhookContext = context
335
- await this.parseStatusWebhook()
336
- await this.updateHomeKitCharacteristics()
339
+ if (context !== undefined || context !== null) {
340
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
341
+ await this.parseStatusWebhook()
342
+ await this.updateHomeKitCharacteristics()
343
+ } else {
344
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
345
+ }
337
346
  } catch (e: any) {
338
347
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
339
348
  }
@@ -214,10 +214,15 @@ export class Plug extends deviceBase {
214
214
  this.debugLog(`bleMac: ${this.device.bleMac}`)
215
215
  this.platform.bleEventHandler[this.device.bleMac] = async (context: plugMiniUSServiceData | plugMiniJPServiceData) => {
216
216
  try {
217
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
218
217
  this.serviceData = context
219
- await this.BLEparseStatus()
220
- await this.updateHomeKitCharacteristics()
218
+ if (context !== undefined || context !== null) {
219
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
220
+ await this.BLEparseStatus()
221
+ await this.updateHomeKitCharacteristics()
222
+ } else {
223
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
224
+ await this.BLERefreshConnection(context)
225
+ }
221
226
  } catch (e: any) {
222
227
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
223
228
  }
@@ -255,10 +260,14 @@ export class Plug extends deviceBase {
255
260
  this.debugLog('is listening webhook.')
256
261
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: plugWebhookContext | plugMiniUSWebhookContext | plugMiniJPWebhookContext) => {
257
262
  try {
258
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
259
263
  this.webhookContext = context
260
- await this.parseStatusWebhook()
261
- await this.updateHomeKitCharacteristics()
264
+ if (context !== undefined || context !== null) {
265
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
266
+ await this.parseStatusWebhook()
267
+ await this.updateHomeKitCharacteristics()
268
+ } else {
269
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
270
+ }
262
271
  } catch (e: any) {
263
272
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
264
273
  }
@@ -302,10 +302,15 @@ export class RobotVacuumCleaner extends deviceBase {
302
302
  this.debugLog(`bleMac: ${this.device.bleMac}`)
303
303
  this.platform.bleEventHandler[this.device.bleMac] = async (context: robotVacuumCleanerServiceData) => {
304
304
  try {
305
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
306
305
  this.serviceData = context
307
- await this.BLEparseStatus()
308
- await this.updateHomeKitCharacteristics()
306
+ if (context !== undefined || context !== null) {
307
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
308
+ await this.BLEparseStatus()
309
+ await this.updateHomeKitCharacteristics()
310
+ } else {
311
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
312
+ await this.BLERefreshConnection(context)
313
+ }
309
314
  } catch (e: any) {
310
315
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
311
316
  }
@@ -343,10 +348,14 @@ export class RobotVacuumCleaner extends deviceBase {
343
348
  this.debugLog('is listening webhook.')
344
349
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: robotVacuumCleanerS1WebhookContext | robotVacuumCleanerS1PlusWebhookContext | floorCleaningRobotS10WebhookContext) => {
345
350
  try {
346
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
347
351
  this.webhookContext = context
348
- await this.parseStatusWebhook()
349
- await this.updateHomeKitCharacteristics()
352
+ if (context !== undefined || context !== null) {
353
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
354
+ await this.parseStatusWebhook()
355
+ await this.updateHomeKitCharacteristics()
356
+ } else {
357
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
358
+ }
350
359
  } catch (e: any) {
351
360
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
352
361
  }
@@ -296,10 +296,15 @@ export class WaterDetector extends deviceBase {
296
296
  this.debugLog(`bleMac: ${this.device.bleMac}`)
297
297
  this.platform.bleEventHandler[this.device.bleMac] = async (context: waterLeakDetectorServiceData) => {
298
298
  try {
299
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
300
299
  this.serviceData = context
301
- await this.BLEparseStatus()
302
- await this.updateHomeKitCharacteristics()
300
+ if (context !== undefined || context !== null) {
301
+ this.debugLog(`received BLE: ${JSON.stringify(context)}`)
302
+ await this.BLEparseStatus()
303
+ await this.updateHomeKitCharacteristics()
304
+ } else {
305
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
306
+ await this.BLERefreshConnection(context)
307
+ }
303
308
  } catch (e: any) {
304
309
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
305
310
  }
@@ -337,10 +342,14 @@ export class WaterDetector extends deviceBase {
337
342
  this.debugLog('is listening webhook.')
338
343
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: waterLeakDetectorWebhookContext) => {
339
344
  try {
340
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
341
345
  this.webhookContext = context
342
- await this.parseStatusWebhook()
343
- await this.updateHomeKitCharacteristics()
346
+ if (context !== undefined || context !== null) {
347
+ this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
348
+ await this.parseStatusWebhook()
349
+ await this.updateHomeKitCharacteristics()
350
+ } else {
351
+ this.errorLog(`context is either undefined or null, context: ${JSON.stringify(context)}`)
352
+ }
344
353
  } catch (e: any) {
345
354
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
346
355
  }
package/typedoc.json CHANGED
@@ -1,4 +1,8 @@
1
1
  {
2
+ "plugin": [
3
+ "@typhonjs-typedoc/typedoc-theme-dmt"
4
+ ],
5
+ "theme": "default-modern",
2
6
  "out": "docs",
3
7
  "exclude": ["src/**/*.spec.ts"],
4
8
  "entryPoints": [
@@ -1 +0,0 @@
1
- window.navigationData = "eJyLrlYqSa0oUbJSSklNSyzNKVHSUSpILMlQslJKK81LLsnMzyvWh0rpZZTk5ijpKGVn5qUoWZmZ1MYCAKPQFUI="
@@ -1 +0,0 @@
1
- window.searchData = "eJxNj11qwzAQhO8yz8IxaWjSvUEukBchipHWRFSWgiQnBaG7F/mH9G2Znd35piCGVwLJgh/rDejzJOCHiUEwPA6zyxCYowNhnL3ONvh02DbdPU8OAtoNKXECAVUJWG/4F1Tw5Jhs8CAcu4/uCwKjZWda3JohoMM0sW8ZJuh5GdVmu7HOITbz6j70ELIXx+5yPisl5H676Iuwv9iUBeXJMbO5rkhSvksVfG+g/d64oAeVWt9YVOo/srZrXx/2wc56BklV6x95cGof";