@switchbot/homebridge-switchbot 4.1.8-beta.3 → 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 (92) hide show
  1. package/dist/device/blindtilt.d.ts.map +1 -1
  2. package/dist/device/blindtilt.js +25 -8
  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 +25 -8
  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 +25 -8
  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 +25 -8
  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 +25 -8
  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 +25 -8
  18. package/dist/device/curtain.js.map +1 -1
  19. package/dist/device/device.js +1 -1
  20. package/dist/device/device.js.map +1 -1
  21. package/dist/device/fan.d.ts.map +1 -1
  22. package/dist/device/fan.js +25 -8
  23. package/dist/device/fan.js.map +1 -1
  24. package/dist/device/hub.d.ts.map +1 -1
  25. package/dist/device/hub.js +25 -8
  26. package/dist/device/hub.js.map +1 -1
  27. package/dist/device/humidifier.d.ts.map +1 -1
  28. package/dist/device/humidifier.js +25 -8
  29. package/dist/device/humidifier.js.map +1 -1
  30. package/dist/device/iosensor.d.ts.map +1 -1
  31. package/dist/device/iosensor.js +25 -8
  32. package/dist/device/iosensor.js.map +1 -1
  33. package/dist/device/lightstrip.d.ts.map +1 -1
  34. package/dist/device/lightstrip.js +25 -8
  35. package/dist/device/lightstrip.js.map +1 -1
  36. package/dist/device/lock.d.ts.map +1 -1
  37. package/dist/device/lock.js +25 -8
  38. package/dist/device/lock.js.map +1 -1
  39. package/dist/device/meter.d.ts.map +1 -1
  40. package/dist/device/meter.js +25 -8
  41. package/dist/device/meter.js.map +1 -1
  42. package/dist/device/meterplus.d.ts.map +1 -1
  43. package/dist/device/meterplus.js +25 -8
  44. package/dist/device/meterplus.js.map +1 -1
  45. package/dist/device/meterpro.d.ts.map +1 -1
  46. package/dist/device/meterpro.js +25 -8
  47. package/dist/device/meterpro.js.map +1 -1
  48. package/dist/device/motion.d.ts.map +1 -1
  49. package/dist/device/motion.js +25 -8
  50. package/dist/device/motion.js.map +1 -1
  51. package/dist/device/plug.d.ts.map +1 -1
  52. package/dist/device/plug.js +25 -8
  53. package/dist/device/plug.js.map +1 -1
  54. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  55. package/dist/device/robotvacuumcleaner.js +25 -8
  56. package/dist/device/robotvacuumcleaner.js.map +1 -1
  57. package/dist/device/waterdetector.d.ts.map +1 -1
  58. package/dist/device/waterdetector.js +25 -8
  59. package/dist/device/waterdetector.js.map +1 -1
  60. package/docs/assets/dmt/dmt-component-data.js +1 -0
  61. package/docs/assets/dmt/dmt-components.css +20 -0
  62. package/docs/assets/dmt/dmt-components.js +67 -0
  63. package/docs/assets/dmt/dmt-search.cmp +0 -0
  64. package/docs/assets/dmt/dmt-theme.css +1 -0
  65. package/docs/assets/main.js +1 -1
  66. package/docs/functions/default.html +2 -1
  67. package/docs/index.html +7 -6
  68. package/docs/modules.html +2 -1
  69. package/package.json +5 -3
  70. package/src/device/blindtilt.ts +22 -8
  71. package/src/device/bot.ts +22 -8
  72. package/src/device/ceilinglight.ts +22 -8
  73. package/src/device/colorbulb.ts +22 -8
  74. package/src/device/contact.ts +22 -8
  75. package/src/device/curtain.ts +22 -8
  76. package/src/device/device.ts +1 -1
  77. package/src/device/fan.ts +22 -8
  78. package/src/device/hub.ts +22 -8
  79. package/src/device/humidifier.ts +22 -8
  80. package/src/device/iosensor.ts +22 -8
  81. package/src/device/lightstrip.ts +22 -8
  82. package/src/device/lock.ts +22 -8
  83. package/src/device/meter.ts +22 -8
  84. package/src/device/meterplus.ts +22 -8
  85. package/src/device/meterpro.ts +22 -8
  86. package/src/device/motion.ts +22 -8
  87. package/src/device/plug.ts +22 -8
  88. package/src/device/robotvacuumcleaner.ts +22 -8
  89. package/src/device/waterdetector.ts +22 -8
  90. package/typedoc.json +4 -0
  91. package/docs/assets/navigation.js +0 -1
  92. package/docs/assets/search.js +0 -1
@@ -189,8 +189,13 @@ export class Plug extends deviceBase {
189
189
  if ((serviceData.model === SwitchBotBLEModel.PlugMiniUS || SwitchBotBLEModel.PlugMiniJP)
190
190
  && serviceData.modelName === (SwitchBotBLEModelName.PlugMini || SwitchBotBLEModelName.PlugMini)) {
191
191
  this.serviceData = serviceData
192
- await this.BLEparseStatus()
193
- await this.updateHomeKitCharacteristics()
192
+ if (serviceData !== undefined || serviceData !== null) {
193
+ await this.BLEparseStatus()
194
+ await this.updateHomeKitCharacteristics()
195
+ } else {
196
+ this.errorLog(`serviceData is either undefined or null, serviceData: ${JSON.stringify(serviceData)}`)
197
+ await this.BLERefreshConnection(switchBotBLE)
198
+ }
194
199
  } else {
195
200
  this.errorLog(`failed to get serviceData, serviceData: ${JSON.stringify(serviceData)}`)
196
201
  await this.BLERefreshConnection(switchBotBLE)
@@ -209,10 +214,15 @@ export class Plug extends deviceBase {
209
214
  this.debugLog(`bleMac: ${this.device.bleMac}`)
210
215
  this.platform.bleEventHandler[this.device.bleMac] = async (context: plugMiniUSServiceData | plugMiniJPServiceData) => {
211
216
  try {
212
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
213
217
  this.serviceData = context
214
- await this.BLEparseStatus()
215
- 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
+ }
216
226
  } catch (e: any) {
217
227
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
218
228
  }
@@ -250,10 +260,14 @@ export class Plug extends deviceBase {
250
260
  this.debugLog('is listening webhook.')
251
261
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: plugWebhookContext | plugMiniUSWebhookContext | plugMiniJPWebhookContext) => {
252
262
  try {
253
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
254
263
  this.webhookContext = context
255
- await this.parseStatusWebhook()
256
- 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
+ }
257
271
  } catch (e: any) {
258
272
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
259
273
  }
@@ -277,8 +277,13 @@ export class RobotVacuumCleaner extends deviceBase {
277
277
  // Update HomeKit
278
278
  if (serviceData.model === SwitchBotBLEModel.Unknown && serviceData.modelName === SwitchBotBLEModelName.Unknown) {
279
279
  this.serviceData = serviceData
280
- await this.BLEparseStatus()
281
- await this.updateHomeKitCharacteristics()
280
+ if (serviceData !== undefined || serviceData !== null) {
281
+ await this.BLEparseStatus()
282
+ await this.updateHomeKitCharacteristics()
283
+ } else {
284
+ this.errorLog(`serviceData is either undefined or null, serviceData: ${JSON.stringify(serviceData)}`)
285
+ await this.BLERefreshConnection(switchBotBLE)
286
+ }
282
287
  } else {
283
288
  this.errorLog(`failed to get serviceData, serviceData: ${JSON.stringify(serviceData)}`)
284
289
  await this.BLERefreshConnection(switchBotBLE)
@@ -297,10 +302,15 @@ export class RobotVacuumCleaner extends deviceBase {
297
302
  this.debugLog(`bleMac: ${this.device.bleMac}`)
298
303
  this.platform.bleEventHandler[this.device.bleMac] = async (context: robotVacuumCleanerServiceData) => {
299
304
  try {
300
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
301
305
  this.serviceData = context
302
- await this.BLEparseStatus()
303
- 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
+ }
304
314
  } catch (e: any) {
305
315
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
306
316
  }
@@ -338,10 +348,14 @@ export class RobotVacuumCleaner extends deviceBase {
338
348
  this.debugLog('is listening webhook.')
339
349
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: robotVacuumCleanerS1WebhookContext | robotVacuumCleanerS1PlusWebhookContext | floorCleaningRobotS10WebhookContext) => {
340
350
  try {
341
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
342
351
  this.webhookContext = context
343
- await this.parseStatusWebhook()
344
- 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
+ }
345
359
  } catch (e: any) {
346
360
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
347
361
  }
@@ -271,8 +271,13 @@ export class WaterDetector extends deviceBase {
271
271
  // Update HomeKit
272
272
  if (serviceData.model === SwitchBotBLEModel.Leak && serviceData.modelName === SwitchBotBLEModelName.Leak) {
273
273
  this.serviceData = serviceData
274
- await this.BLEparseStatus()
275
- await this.updateHomeKitCharacteristics()
274
+ if (serviceData !== undefined || serviceData !== null) {
275
+ await this.BLEparseStatus()
276
+ await this.updateHomeKitCharacteristics()
277
+ } else {
278
+ this.errorLog(`serviceData is either undefined or null, serviceData: ${JSON.stringify(serviceData)}`)
279
+ await this.BLERefreshConnection(switchBotBLE)
280
+ }
276
281
  } else {
277
282
  this.errorLog(`failed to get serviceData, serviceData: ${JSON.stringify(serviceData)}`)
278
283
  await this.BLERefreshConnection(switchBotBLE)
@@ -291,10 +296,15 @@ export class WaterDetector extends deviceBase {
291
296
  this.debugLog(`bleMac: ${this.device.bleMac}`)
292
297
  this.platform.bleEventHandler[this.device.bleMac] = async (context: waterLeakDetectorServiceData) => {
293
298
  try {
294
- this.debugLog(`received BLE: ${JSON.stringify(context)}`)
295
299
  this.serviceData = context
296
- await this.BLEparseStatus()
297
- 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
+ }
298
308
  } catch (e: any) {
299
309
  this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
300
310
  }
@@ -332,10 +342,14 @@ export class WaterDetector extends deviceBase {
332
342
  this.debugLog('is listening webhook.')
333
343
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: waterLeakDetectorWebhookContext) => {
334
344
  try {
335
- this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
336
345
  this.webhookContext = context
337
- await this.parseStatusWebhook()
338
- 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
+ }
339
353
  } catch (e: any) {
340
354
  this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
341
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";