@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.
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +25 -8
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +25 -8
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +25 -8
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +25 -8
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +25 -8
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +25 -8
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.js +1 -1
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +25 -8
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +25 -8
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +25 -8
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +25 -8
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +25 -8
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +25 -8
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +25 -8
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +25 -8
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/meterpro.d.ts.map +1 -1
- package/dist/device/meterpro.js +25 -8
- package/dist/device/meterpro.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +25 -8
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +25 -8
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +25 -8
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +25 -8
- package/dist/device/waterdetector.js.map +1 -1
- package/docs/assets/dmt/dmt-component-data.js +1 -0
- package/docs/assets/dmt/dmt-components.css +20 -0
- package/docs/assets/dmt/dmt-components.js +67 -0
- package/docs/assets/dmt/dmt-search.cmp +0 -0
- package/docs/assets/dmt/dmt-theme.css +1 -0
- package/docs/assets/main.js +1 -1
- package/docs/functions/default.html +2 -1
- package/docs/index.html +7 -6
- package/docs/modules.html +2 -1
- package/package.json +5 -3
- package/src/device/blindtilt.ts +22 -8
- package/src/device/bot.ts +22 -8
- package/src/device/ceilinglight.ts +22 -8
- package/src/device/colorbulb.ts +22 -8
- package/src/device/contact.ts +22 -8
- package/src/device/curtain.ts +22 -8
- package/src/device/device.ts +1 -1
- package/src/device/fan.ts +22 -8
- package/src/device/hub.ts +22 -8
- package/src/device/humidifier.ts +22 -8
- package/src/device/iosensor.ts +22 -8
- package/src/device/lightstrip.ts +22 -8
- package/src/device/lock.ts +22 -8
- package/src/device/meter.ts +22 -8
- package/src/device/meterplus.ts +22 -8
- package/src/device/meterpro.ts +22 -8
- package/src/device/motion.ts +22 -8
- package/src/device/plug.ts +22 -8
- package/src/device/robotvacuumcleaner.ts +22 -8
- package/src/device/waterdetector.ts +22 -8
- package/typedoc.json +4 -0
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
package/src/device/plug.ts
CHANGED
|
@@ -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
|
-
|
|
193
|
-
|
|
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
|
-
|
|
215
|
-
|
|
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
|
-
|
|
256
|
-
|
|
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
|
-
|
|
281
|
-
|
|
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
|
-
|
|
303
|
-
|
|
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
|
-
|
|
344
|
-
|
|
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
|
-
|
|
275
|
-
|
|
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
|
-
|
|
297
|
-
|
|
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
|
-
|
|
338
|
-
|
|
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 +0,0 @@
|
|
|
1
|
-
window.navigationData = "eJyLrlYqSa0oUbJSSklNSyzNKVHSUSpILMlQslJKK81LLsnMzyvWh0rpZZTk5ijpKGVn5qUoWZmZ1MYCAKPQFUI="
|
package/docs/assets/search.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
window.searchData = "eJxNj11qwzAQhO8yz8IxaWjSvUEukBchipHWRFSWgiQnBaG7F/mH9G2Znd35piCGVwLJgh/rDejzJOCHiUEwPA6zyxCYowNhnL3ONvh02DbdPU8OAtoNKXECAVUJWG/4F1Tw5Jhs8CAcu4/uCwKjZWda3JohoMM0sW8ZJuh5GdVmu7HOITbz6j70ELIXx+5yPisl5H676Iuwv9iUBeXJMbO5rkhSvksVfG+g/d64oAeVWt9YVOo/srZrXx/2wc56BklV6x95cGof";
|