homebridge-lib 6.6.5 → 6.7.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.
|
@@ -120,10 +120,7 @@ class ContactValue extends HistoryValue {
|
|
|
120
120
|
parent.lastContactDelegate.value = parent.lastActivationValue(now)
|
|
121
121
|
parent.timesOpenedDelegate.value += value
|
|
122
122
|
})
|
|
123
|
-
parent.
|
|
124
|
-
key: 'resetTotal',
|
|
125
|
-
Characteristic: parent.Characteristics.eve.ResetTotal
|
|
126
|
-
}).on('didSet', (value) => {
|
|
123
|
+
parent.resetTotalHandlers.push((value) => {
|
|
127
124
|
parent.timesOpenedDelegate.value = 0
|
|
128
125
|
})
|
|
129
126
|
}
|
|
@@ -184,10 +181,7 @@ class ConsumptionValue extends HistoryValue {
|
|
|
184
181
|
this.updateRunningTotals()
|
|
185
182
|
this._power = value // W
|
|
186
183
|
})
|
|
187
|
-
parent.
|
|
188
|
-
key: 'resetTotal',
|
|
189
|
-
Characteristic: parent.Characteristics.eve.ResetTotal
|
|
190
|
-
}).on('didSet', (value) => {
|
|
184
|
+
parent.resetTotalHandlers.push((value) => {
|
|
191
185
|
this._totalConsumption = 0 // Ws
|
|
192
186
|
parent.computedTotalConsumptionDelegate.value = 0 // kWh
|
|
193
187
|
})
|
|
@@ -421,6 +415,7 @@ class History extends ServiceDelegate {
|
|
|
421
415
|
params.Service = accessoryDelegate.Services.eve.History
|
|
422
416
|
params.hidden = true
|
|
423
417
|
super(accessoryDelegate, params)
|
|
418
|
+
this.resetTotalHandlers = []
|
|
424
419
|
|
|
425
420
|
const delegates = []
|
|
426
421
|
let i = 0
|
|
@@ -551,6 +546,17 @@ class History extends ServiceDelegate {
|
|
|
551
546
|
silent: true
|
|
552
547
|
})
|
|
553
548
|
|
|
549
|
+
if (this.resetTotalHandlers.length > 0) {
|
|
550
|
+
this.addCharacteristicDelegate({
|
|
551
|
+
key: 'resetTotal',
|
|
552
|
+
Characteristic: this.Characteristics.eve.ResetTotal
|
|
553
|
+
}).on('didSet', (value) => {
|
|
554
|
+
for (const handler of this.resetTotalHandlers) {
|
|
555
|
+
handler(value)
|
|
556
|
+
}
|
|
557
|
+
})
|
|
558
|
+
}
|
|
559
|
+
|
|
554
560
|
if (params.config) {
|
|
555
561
|
this.addCharacteristicDelegate({
|
|
556
562
|
key: 'configCommand',
|
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.7.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": "~1.0.0",
|
|
29
|
-
"hb-lib-tools": "~1.
|
|
29
|
+
"hb-lib-tools": "~1.2.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",
|