homebridge-lib 6.2.0 → 6.2.2
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.
|
@@ -75,9 +75,9 @@ class Power extends History {
|
|
|
75
75
|
this._runningConsumption = 0 // 10-min-interval running value
|
|
76
76
|
this._totalConsumption = params.consumptionDelegate.value // life-time value
|
|
77
77
|
this._power = params.powerDelegate.value // current power
|
|
78
|
-
this._time = History.now // start time of current power
|
|
78
|
+
this._time = History.now() // start time of current power
|
|
79
79
|
params.powerDelegate.on('didSet', (value) => {
|
|
80
|
-
const now = History.now
|
|
80
|
+
const now = History.now()
|
|
81
81
|
if (this._time != null) {
|
|
82
82
|
const delta = this._power * (now - this._time) // Ws
|
|
83
83
|
this._runningConsumption += Math.round(delta / 60.0) // 0.1W * 10 min
|
|
@@ -100,7 +100,7 @@ class Power extends History {
|
|
|
100
100
|
if (params.onDelegate != null) {
|
|
101
101
|
this.entry.o = params.onDelegate.value ? 1 : 0
|
|
102
102
|
params.onDelegate.on('didSet', (value) => {
|
|
103
|
-
const now = History.now
|
|
103
|
+
const now = History.now()
|
|
104
104
|
if (params.lastActivationDelegate != null) {
|
|
105
105
|
params.lastActivationDelegate.value = this.lastActivationValue(now)
|
|
106
106
|
}
|
|
@@ -208,7 +208,7 @@ class History extends ServiceDelegate {
|
|
|
208
208
|
*/
|
|
209
209
|
addEntry (entry) {
|
|
210
210
|
if (this._h.memorySize > 0) {
|
|
211
|
-
if (this._h.lastEntry >= this._h.memorySize) {
|
|
211
|
+
if (this._h.lastEntry - this._h.entryOffset >= this._h.memorySize) {
|
|
212
212
|
this._h.firstEntry++
|
|
213
213
|
}
|
|
214
214
|
this._h.lastEntry++
|