homebridge-lib 6.3.12 → 6.3.14
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/lib/Platform.js
CHANGED
|
@@ -314,7 +314,7 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
314
314
|
this._shuttingDown = true
|
|
315
315
|
this.removeAllListeners('upnpDeviceAlive')
|
|
316
316
|
this.removeAllListeners('upnpDeviceFound')
|
|
317
|
-
if (this._ui
|
|
317
|
+
if (this._ui?.abortController != null) {
|
|
318
318
|
this._ui.abortController.abort()
|
|
319
319
|
}
|
|
320
320
|
for (const id in this._accessoryDelegates) {
|
|
@@ -411,7 +411,7 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
411
411
|
}
|
|
412
412
|
const { body } = await this.npmRegistry.get(
|
|
413
413
|
'/' + name + '/latest', { Accept: 'application/json' })
|
|
414
|
-
if (body
|
|
414
|
+
if (body?.version != null) {
|
|
415
415
|
if (body.version !== version) {
|
|
416
416
|
this.warn('latest version: %s v%s', name, body.version)
|
|
417
417
|
} else {
|
package/lib/PropertyDelegate.js
CHANGED
|
@@ -51,7 +51,7 @@ class PropertyDelegate extends homebridgeLib.Delegate {
|
|
|
51
51
|
this._key = params.key
|
|
52
52
|
this._log = params.silent ? this.debug : this.log
|
|
53
53
|
// this._type = params.type
|
|
54
|
-
this._unit =
|
|
54
|
+
this._unit = params.unit ?? ''
|
|
55
55
|
|
|
56
56
|
// Set initial value.
|
|
57
57
|
if (this.value == null && params.value != null) {
|
|
@@ -46,29 +46,27 @@ class Battery extends ServiceDelegate {
|
|
|
46
46
|
key: 'batteryLevel',
|
|
47
47
|
Characteristic: this.Characteristics.hap.BatteryLevel,
|
|
48
48
|
unit: '%',
|
|
49
|
-
value: params.batteryLevel
|
|
49
|
+
value: params.batteryLevel ?? 100
|
|
50
50
|
}).on('didSet', (value) => {
|
|
51
51
|
this.updateStatusLowBattery()
|
|
52
52
|
})
|
|
53
53
|
this.addCharacteristicDelegate({
|
|
54
54
|
key: 'chargingState',
|
|
55
55
|
Characteristic: this.Characteristics.hap.ChargingState,
|
|
56
|
-
value: params.chargingState
|
|
57
|
-
|
|
58
|
-
: this.Characteristics.hap.ChargingState.NOT_CHARGEABLE
|
|
56
|
+
value: params.chargingState ??
|
|
57
|
+
this.Characteristics.hap.ChargingState.NOT_CHARGEABLE
|
|
59
58
|
})
|
|
60
59
|
this.addCharacteristicDelegate({
|
|
61
60
|
key: 'statusLowBattery',
|
|
62
61
|
Characteristic: this.Characteristics.hap.StatusLowBattery,
|
|
63
|
-
value: params.statusLowBattery
|
|
64
|
-
|
|
65
|
-
: this.Characteristics.hap.StatusLowBattery.BATTERY_LEVEL_NORMAL
|
|
62
|
+
value: params.statusLowBattery ??
|
|
63
|
+
this.Characteristics.hap.StatusLowBattery.BATTERY_LEVEL_NORMAL
|
|
66
64
|
})
|
|
67
65
|
this.addCharacteristicDelegate({
|
|
68
66
|
key: 'lowBatteryThreshold',
|
|
69
|
-
Characteristic: this.Characteristics.my.LowBatteryThreshold,
|
|
67
|
+
// Characteristic: this.Characteristics.my.LowBatteryThreshold,
|
|
70
68
|
unit: '%',
|
|
71
|
-
value: params.lowBatteryThreshold
|
|
69
|
+
value: params.lowBatteryThreshold ?? 20
|
|
72
70
|
}).on('didSet', (value) => {
|
|
73
71
|
this.updateStatusLowBattery()
|
|
74
72
|
})
|
|
@@ -299,6 +299,13 @@ class VocDensityValue extends HistoryValue {
|
|
|
299
299
|
get id () { return 'q' }
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
class ButtonValue extends HistoryValue {
|
|
303
|
+
get tag () { return 0x24 }
|
|
304
|
+
get length () { return 1 }
|
|
305
|
+
get id () { return 'b' }
|
|
306
|
+
writeEntry (entry, buffer, offset) { buffer.writeInt8(entry[this.id], offset) }
|
|
307
|
+
}
|
|
308
|
+
|
|
302
309
|
class LightLevelValue extends HistoryValue {
|
|
303
310
|
get tag () { return 0x30 }
|
|
304
311
|
get id () { return 'l' }
|
|
@@ -320,6 +327,7 @@ const historyValueTypes = {
|
|
|
320
327
|
motion: MotionValue,
|
|
321
328
|
on: OnValue,
|
|
322
329
|
vocDensity: VocDensityValue,
|
|
330
|
+
button: ButtonValue,
|
|
323
331
|
lightLevel: LightLevelValue
|
|
324
332
|
}
|
|
325
333
|
|
|
@@ -47,9 +47,6 @@ class ServiceDelegate extends homebridgeLib.Delegate {
|
|
|
47
47
|
* @params {?ServiceDelegate} params.linkedServiceDelegate - The delegate
|
|
48
48
|
* of the service this service links to.
|
|
49
49
|
* @params {?boolean} params.hidden - Hidden service.
|
|
50
|
-
* @params {?boolean} params.exposeConfiguredName - Expose
|
|
51
|
-
* `Characteristics.hap.ConfiguredName`, so device name can be synced with
|
|
52
|
-
* HomeKit service name.
|
|
53
50
|
*/
|
|
54
51
|
constructor (accessoryDelegate, params = {}) {
|
|
55
52
|
if (!(accessoryDelegate instanceof homebridgeLib.AccessoryDelegate)) {
|
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.3.
|
|
6
|
+
"version": "6.3.14",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"homekit",
|
|
9
9
|
"homebridge"
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"homebridge": "^1.6.0",
|
|
25
|
-
"node": "^18.
|
|
25
|
+
"node": "^18.16.0"
|
|
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.0.7"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",
|