homebridge-lib 6.4.1 → 6.5.0
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.
|
@@ -347,7 +347,9 @@ class CharacteristicDelegate extends homebridgeLib.Delegate {
|
|
|
347
347
|
let value = this.value
|
|
348
348
|
const timeout = setTimeout(() => {
|
|
349
349
|
timedOut = true
|
|
350
|
-
|
|
350
|
+
try {
|
|
351
|
+
callback(null, this.value)
|
|
352
|
+
} catch (error) { this.warn(error) }
|
|
351
353
|
}, this._timeout)
|
|
352
354
|
try {
|
|
353
355
|
value = await this._getter()
|
|
@@ -361,7 +363,9 @@ class CharacteristicDelegate extends homebridgeLib.Delegate {
|
|
|
361
363
|
} else {
|
|
362
364
|
// Return value to HomeKit.
|
|
363
365
|
this._log('get: return %j%s', value, this._unit)
|
|
364
|
-
|
|
366
|
+
try {
|
|
367
|
+
callback(null, value)
|
|
368
|
+
} catch (error) { this.warn(error) }
|
|
365
369
|
}
|
|
366
370
|
|
|
367
371
|
if (value !== this.value) {
|
|
@@ -394,7 +398,10 @@ class CharacteristicDelegate extends homebridgeLib.Delegate {
|
|
|
394
398
|
* @param {boolean} byHomeKit - Value was set by HomeKit (always true).
|
|
395
399
|
*/
|
|
396
400
|
this.emit('didTouch', value, true)
|
|
397
|
-
|
|
401
|
+
try {
|
|
402
|
+
callback()
|
|
403
|
+
} catch (error) { this.warn(error) }
|
|
404
|
+
return
|
|
398
405
|
}
|
|
399
406
|
|
|
400
407
|
// Invoke setter if defined, but guard with a timeout.
|
|
@@ -403,7 +410,9 @@ class CharacteristicDelegate extends homebridgeLib.Delegate {
|
|
|
403
410
|
const timeout = setTimeout(() => {
|
|
404
411
|
timedOut = true
|
|
405
412
|
this.warn('set: timed out')
|
|
406
|
-
|
|
413
|
+
try {
|
|
414
|
+
callback(new Error('timed out'))
|
|
415
|
+
} catch (error) { this.warn(error) }
|
|
407
416
|
}, this._timeout)
|
|
408
417
|
try {
|
|
409
418
|
result = await this._setter(value)
|
|
@@ -411,7 +420,9 @@ class CharacteristicDelegate extends homebridgeLib.Delegate {
|
|
|
411
420
|
clearTimeout(timeout)
|
|
412
421
|
this.warn('set: %s', error)
|
|
413
422
|
if (!timedOut) {
|
|
414
|
-
|
|
423
|
+
try {
|
|
424
|
+
callback(error)
|
|
425
|
+
} catch (error) { this.warn(error) }
|
|
415
426
|
}
|
|
416
427
|
return
|
|
417
428
|
}
|
|
@@ -423,9 +434,13 @@ class CharacteristicDelegate extends homebridgeLib.Delegate {
|
|
|
423
434
|
|
|
424
435
|
// Return status to HomeKit.
|
|
425
436
|
if (this._writeResponse) {
|
|
426
|
-
|
|
437
|
+
try {
|
|
438
|
+
callback(null, result)
|
|
439
|
+
} catch (error) { this.warn(error) }
|
|
427
440
|
} else {
|
|
428
|
-
|
|
441
|
+
try {
|
|
442
|
+
callback()
|
|
443
|
+
} catch (error) { this.warn(error) }
|
|
429
444
|
}
|
|
430
445
|
|
|
431
446
|
// Update persisted value in ~/.homebridge/accessories/cachedAccessories.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Library for homebridge plugins",
|
|
4
4
|
"author": "Erik Baauw",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"version": "6.
|
|
6
|
+
"version": "6.5.0",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"homekit",
|
|
9
9
|
"homebridge"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@homebridge/plugin-ui-utils": "~0.0.19",
|
|
29
|
-
"hb-lib-tools": "~1.0
|
|
29
|
+
"hb-lib-tools": "~1.1.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",
|