homebridge-lib 6.3.11 → 6.3.12
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/EveHomeKitTypes.js +17 -7
- package/lib/MyHomeKitTypes.js +92 -0
- package/lib/ServiceDelegate/History.js +36 -28
- package/lib/ServiceDelegate/index.js +2 -12
- package/package.json +3 -3
package/lib/EveHomeKitTypes.js
CHANGED
|
@@ -62,9 +62,10 @@ class EveHomeKitTypes extends CustomHomeKitTypes {
|
|
|
62
62
|
* <br> Used by: `History` service.
|
|
63
63
|
* @property {Class} ConfigData - Used by Eve app to read configuration.
|
|
64
64
|
* <br> Used by: `History` service.
|
|
65
|
-
* @property {Class}
|
|
66
|
-
* (in W).
|
|
65
|
+
* @property {Class} Consumption - Current electric power (in W).
|
|
67
66
|
* <br>Used by: Eve Energy.
|
|
67
|
+
* @property {Class} CurrentConsumption - Deprecated. use `Consumption`
|
|
68
|
+
* instead.
|
|
68
69
|
* @property {Class} CurrentTemperature - Current temperature (in °C).
|
|
69
70
|
* This is the same characterisic as `hap.CurrentTemperature`, but with
|
|
70
71
|
* a minimum value of -40°C instead of 0°C (or -270°C).
|
|
@@ -141,7 +142,7 @@ class EveHomeKitTypes extends CustomHomeKitTypes {
|
|
|
141
142
|
* <br>Used by: Eve Thermo.
|
|
142
143
|
* @property {Class} Visibility - Visibility (in km).
|
|
143
144
|
* <br>Used by: weather station.
|
|
144
|
-
* @property {Class} VOCLevel - Volatile Organic Compound level (in
|
|
145
|
+
* @property {Class} VOCLevel - Volatile Organic Compound level (in ppb).
|
|
145
146
|
* <br>Used by: Eve Room (1st gen).
|
|
146
147
|
* @property {Class} Voltage - Electric voltage (in V).
|
|
147
148
|
* <br>Used by: Eve Energy.
|
|
@@ -176,7 +177,7 @@ class EveHomeKitTypes extends CustomHomeKitTypes {
|
|
|
176
177
|
|
|
177
178
|
this.createCharacteristicClass('VOCLevel', uuid('10B'), {
|
|
178
179
|
format: this.Formats.INT16,
|
|
179
|
-
unit: '
|
|
180
|
+
unit: 'ppb',
|
|
180
181
|
minValue: 5,
|
|
181
182
|
maxValue: 5000,
|
|
182
183
|
minStep: 5,
|
|
@@ -192,6 +193,15 @@ class EveHomeKitTypes extends CustomHomeKitTypes {
|
|
|
192
193
|
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
193
194
|
}, 'Total Consumption')
|
|
194
195
|
|
|
196
|
+
this.createCharacteristicClass('Consumption', uuid('10D'), {
|
|
197
|
+
format: this.Formats.FLOAT,
|
|
198
|
+
unit: 'W',
|
|
199
|
+
minValue: 0,
|
|
200
|
+
maxValue: 12000,
|
|
201
|
+
minStep: 0.1,
|
|
202
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
203
|
+
}, 'Consumption')
|
|
204
|
+
|
|
195
205
|
this.createCharacteristicClass('CurrentConsumption', uuid('10D'), {
|
|
196
206
|
format: this.Formats.FLOAT,
|
|
197
207
|
unit: 'W',
|
|
@@ -199,7 +209,7 @@ class EveHomeKitTypes extends CustomHomeKitTypes {
|
|
|
199
209
|
maxValue: 12000,
|
|
200
210
|
minStep: 0.1,
|
|
201
211
|
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
202
|
-
}, '
|
|
212
|
+
}, 'Consumption')
|
|
203
213
|
|
|
204
214
|
this.createCharacteristicClass('AirPressure', uuid('10F'), {
|
|
205
215
|
format: this.Formats.FLOAT,
|
|
@@ -601,7 +611,7 @@ class EveHomeKitTypes extends CustomHomeKitTypes {
|
|
|
601
611
|
this.createServiceClass('Consumption', uuid('008'), [
|
|
602
612
|
this.Characteristics.Voltage, // 10A
|
|
603
613
|
this.Characteristics.TotalConsumption, // 10C
|
|
604
|
-
this.Characteristics.
|
|
614
|
+
this.Characteristics.Consumption, // 10D
|
|
605
615
|
this.Characteristics.ElectricCurrent, // 126
|
|
606
616
|
this.hapCharacteristics.StatusFault,
|
|
607
617
|
this.hapCharacteristics.LockPhysicalControls
|
|
@@ -642,7 +652,7 @@ class EveHomeKitTypes extends CustomHomeKitTypes {
|
|
|
642
652
|
this.hapCharacteristics.InUse,
|
|
643
653
|
this.Characteristics.Voltage,
|
|
644
654
|
this.Characteristics.ElectricCurrent,
|
|
645
|
-
this.Characteristics.
|
|
655
|
+
this.Characteristics.Consumption,
|
|
646
656
|
this.Characteristics.TotalConsumption
|
|
647
657
|
]
|
|
648
658
|
)
|
package/lib/MyHomeKitTypes.js
CHANGED
|
@@ -32,6 +32,8 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
32
32
|
* <br>Used by: homebridge-hue in for group LightBulb or Outlet service.
|
|
33
33
|
* @property {Class} ApparentTemperature - Apparent temperature.
|
|
34
34
|
* <br>Used by: homebridge-ws.
|
|
35
|
+
* @property {Class} AverageConsumption - Average electrical power (in W).
|
|
36
|
+
* <br>Used by: homebridge-p1.
|
|
35
37
|
* @property {Class} Balance - Audio balance.
|
|
36
38
|
* <br>Used by: homebridge-zp in Speaker service.
|
|
37
39
|
* @property {Class} Bass - Audio bass.
|
|
@@ -43,6 +45,10 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
43
45
|
* <br>Used by: homebridge-otgw.
|
|
44
46
|
* @property {Class} BurnerStarts - Number of burner starts.
|
|
45
47
|
* <br>Used by: homebridge-otgw.
|
|
48
|
+
* @property {Class} CampfireEffect - Enabled/disable campfire dynamic effect.
|
|
49
|
+
* <br>Used by: homebridge-deconz.
|
|
50
|
+
* @property {Class} CandleEffect - Enabled/disable candle dynamic effect.
|
|
51
|
+
* <br>Used by: homebridge-deconz, homebridge-hue2.
|
|
46
52
|
* @property {Class} ChangeInput - For relative changes to `InputSource`.
|
|
47
53
|
* <br>Used by: homebridge-zp in Sonos service.
|
|
48
54
|
* @property {Class} ChangeTrack - For relative changes to `CurrentTrack`.
|
|
@@ -93,6 +99,8 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
93
99
|
* <br>Used by: homebridge-deconz, homebridge-hue2.
|
|
94
100
|
* @property {Class} ExposeSensors - Expose sensors devices to HomeKit.
|
|
95
101
|
* <br>Used by: homebridge-deconz, homebridge-hue2.
|
|
102
|
+
* @property {Class} FireplaceEffect - Enabled/disable fireplace dynamic effect.
|
|
103
|
+
* <br>Used by: homebridge-deconz, homebridge-hue2.
|
|
96
104
|
* @property {Class} Heartrate - Refresh rate.
|
|
97
105
|
* <br>Used by: homebridge-hue in HueBridge service,
|
|
98
106
|
* by Homebridge-soma, by Homebridge-rpi, by Homebridge-ws.
|
|
@@ -113,6 +121,8 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
113
121
|
* <br>Deprecated - use `hap.LockPhysicalControls`.
|
|
114
122
|
* <br>Previously used by homebridge-hue for Thermostat sensor.
|
|
115
123
|
* @property {Class} LogLevel - Level of logging.
|
|
124
|
+
* @property {Class} LoopEffect - Enabled/disable loop dynamic effect.
|
|
125
|
+
* <br>Used by: homebridge-deconz, homebridge-hue2.
|
|
116
126
|
* @property {Class} Loudness - Audio loudness.
|
|
117
127
|
* <br>Used by: homebridge-zp in Speaker service.
|
|
118
128
|
* @property {Class} LowBatteryThreshold - Threshold value for setting
|
|
@@ -122,10 +132,14 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
122
132
|
* @property {Class} MorningMode - Move the blinds slowly, making less
|
|
123
133
|
* noise.
|
|
124
134
|
* <br>Used by: homebridge-sc, homebridge-soma in Window Covering service.
|
|
135
|
+
* @property {Class} NightlightEffect - Enabled/disable nightlight dynamic effect.
|
|
136
|
+
* <br>Used by: homebridge-deconz.
|
|
125
137
|
* @property {Class} NightSound - Audio night sound.
|
|
126
138
|
* <br>Used by: homebridge-zp in Speaker service.
|
|
127
139
|
* @property {Class} Offset - Temperature offset.
|
|
128
140
|
* <br>Used by: homebridge-hue in Temperature service.
|
|
141
|
+
* @property {Class} PartyEffect - Enabled/disable party dynamic effect.
|
|
142
|
+
* <br>Used by: homebridge-deconz.
|
|
129
143
|
* @property {Class} Period - Daylight period (e.g. Dawn).
|
|
130
144
|
* <br>Used by: homebridge-hue for Daylight sensor.
|
|
131
145
|
* @property {Class} PumpHours - Pump run time (in hours).
|
|
@@ -147,6 +161,8 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
147
161
|
* <br>Used by: homebridge-otgw.
|
|
148
162
|
* @property {Class} RingToOpen - Ring to Open active.
|
|
149
163
|
* <br> Used by: homebridge-nb.
|
|
164
|
+
* @property {Class} RomanceEffect - Enabled/disable romance dynamic effect.
|
|
165
|
+
* <br>Used by: homebridge-deconz.
|
|
150
166
|
* @property {Class} Search - Search for new devices.
|
|
151
167
|
* <br>Used by: homebridge-hue.
|
|
152
168
|
* @property {Class} Sensitivity - Motion sensor sensitivity.
|
|
@@ -160,6 +176,8 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
160
176
|
* @property {Class} SonosGroup - Current Sonos group to which zone player
|
|
161
177
|
* belongs.
|
|
162
178
|
* <br>Used by: homebridge-zp in Sonos service.
|
|
179
|
+
* @property {Class} SparkleEffect - Enabled/disable sparkle dynamic effect.
|
|
180
|
+
* <br>Used by: homebridge-deconz, homebridge-hue2.
|
|
163
181
|
* @property {Class} SpeechEnhancement - Audio speech enhancement setting.
|
|
164
182
|
* <br>Used by: homebridge-zp in Speaker service.
|
|
165
183
|
* @property {Class} Status - Generic status.
|
|
@@ -172,8 +190,12 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
172
190
|
* <br>Used by: homebridge-zp in Speaker service.
|
|
173
191
|
* @property {Class} Sunrise - Date/time of today's sun rise.
|
|
174
192
|
* <br>Used by: homebridge-hue, homebridge-ws.
|
|
193
|
+
* @property {Class} SunriseEffect - Enabled/disable sunrise dynamic effect.
|
|
194
|
+
* <br>Used by: homebridge-deconz, homebridge-hue2.
|
|
175
195
|
* @property {Class} Sunset - Date/time of today's sun set.
|
|
176
196
|
* <br>Used by: homebridge-hue, homebridge-ws.
|
|
197
|
+
* @property {Class} SunsetEffect - Enabled/disable sunset dynamic effect.
|
|
198
|
+
* <br>Used by: homebridge-deconz.
|
|
177
199
|
* @property {Class} Tariff - Electricity tariff (normal vs low).
|
|
178
200
|
* <br>Used by: homebridge-p1 in Electricity service.
|
|
179
201
|
* @property {Class} TemperatureMax - Maximum temperature.
|
|
@@ -208,6 +230,8 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
208
230
|
* @property {Class} WaterPressure - Water pressure (in bar) of the central
|
|
209
231
|
* heating system.
|
|
210
232
|
* <br>Used by: homebridge-otgw.
|
|
233
|
+
* @property {Class} WorklightEffect - Enabled/disable worklight dynamic effect.
|
|
234
|
+
* <br>Used by: homebridge-deconz.
|
|
211
235
|
*/
|
|
212
236
|
|
|
213
237
|
this.createCharacteristicClass('Resource', uuid('021'), {
|
|
@@ -759,6 +783,74 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
|
|
|
759
783
|
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
760
784
|
}, 'Sub Level')
|
|
761
785
|
|
|
786
|
+
this.createCharacteristicClass('AverageConsumption', uuid('07E'), {
|
|
787
|
+
format: this.Formats.FLOAT,
|
|
788
|
+
unit: 'W',
|
|
789
|
+
minValue: 0,
|
|
790
|
+
maxValue: 12000,
|
|
791
|
+
minStep: 0.1,
|
|
792
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
793
|
+
}, 'Average Consumption')
|
|
794
|
+
|
|
795
|
+
// Dynamic effects for Hue lights.
|
|
796
|
+
|
|
797
|
+
this.createCharacteristicClass('CandleEffect', uuid('07F'), {
|
|
798
|
+
format: this.Formats.BOOL,
|
|
799
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
800
|
+
}, 'Candle')
|
|
801
|
+
|
|
802
|
+
this.createCharacteristicClass('FireplaceEffect', uuid('080'), {
|
|
803
|
+
format: this.Formats.BOOL,
|
|
804
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
805
|
+
}, 'Fire Place')
|
|
806
|
+
|
|
807
|
+
this.createCharacteristicClass('LoopEffect', uuid('081'), {
|
|
808
|
+
format: this.Formats.BOOL,
|
|
809
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
810
|
+
}, 'Loop')
|
|
811
|
+
|
|
812
|
+
this.createCharacteristicClass('SunriseEffect', uuid('082'), {
|
|
813
|
+
format: this.Formats.BOOL,
|
|
814
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
815
|
+
}, 'Sunrise')
|
|
816
|
+
|
|
817
|
+
this.createCharacteristicClass('SparkleEffect', uuid('083'), {
|
|
818
|
+
format: this.Formats.BOOL,
|
|
819
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
820
|
+
}, 'Sparkle')
|
|
821
|
+
|
|
822
|
+
// Dynamic effects for MLI lights.
|
|
823
|
+
|
|
824
|
+
this.createCharacteristicClass('SunsetEffect', uuid('084'), {
|
|
825
|
+
format: this.Formats.BOOL,
|
|
826
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
827
|
+
}, 'Sunset')
|
|
828
|
+
|
|
829
|
+
this.createCharacteristicClass('PartyEffect', uuid('085'), {
|
|
830
|
+
format: this.Formats.BOOL,
|
|
831
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
832
|
+
}, 'Party')
|
|
833
|
+
|
|
834
|
+
this.createCharacteristicClass('WorklightEffect', uuid('086'), {
|
|
835
|
+
format: this.Formats.BOOL,
|
|
836
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
837
|
+
}, 'Work Light')
|
|
838
|
+
|
|
839
|
+
this.createCharacteristicClass('CampfireEffect', uuid('087'), {
|
|
840
|
+
format: this.Formats.BOOL,
|
|
841
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
842
|
+
}, 'Camp Fire')
|
|
843
|
+
|
|
844
|
+
this.createCharacteristicClass('RomanceEffect', uuid('088'), {
|
|
845
|
+
format: this.Formats.BOOL,
|
|
846
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
847
|
+
}, 'Romance')
|
|
848
|
+
|
|
849
|
+
this.createCharacteristicClass('NightlightEffect', uuid('089'), {
|
|
850
|
+
format: this.Formats.BOOL,
|
|
851
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
852
|
+
}, 'Night Light')
|
|
853
|
+
|
|
762
854
|
// Characteristic for Unique ID, used by homebridge-hue.
|
|
763
855
|
// Source: as exposed by the Philips Hue bridge. This characteristic is
|
|
764
856
|
// used by the Hue app to select the accessories when syncing Hue bridge
|
|
@@ -132,8 +132,9 @@ class ContactValue extends HistoryValue {
|
|
|
132
132
|
// Eve history entries for _Total Consumption_ actually contain the (average) power,
|
|
133
133
|
// in 0.1 W, since the previous entry. Eve computes the displayed consumption in Wh.
|
|
134
134
|
|
|
135
|
-
// Device delivers
|
|
136
|
-
|
|
135
|
+
// Device delivers _Total Consumption_ in kWh.
|
|
136
|
+
// We compute average power, and, optionally, update _Consumption_ (power).
|
|
137
|
+
class TotalConsumptionValue extends HistoryValue {
|
|
137
138
|
get tag () { return 0x07 }
|
|
138
139
|
get id () { return 'p' }
|
|
139
140
|
|
|
@@ -153,20 +154,22 @@ class ConsumptionValue extends HistoryValue {
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
prepareEntry (entry) {
|
|
156
|
-
const consumption =
|
|
157
|
+
const consumption =
|
|
158
|
+
(this._delegate.value - this._parent.values.consumption) * 1000 * 3600 // Ws
|
|
157
159
|
const period = entry.time - this._parent.values.time // s
|
|
158
160
|
const power = consumption / period // W
|
|
159
161
|
entry[this.id] = Math.round(power * 10) // 0.1 W
|
|
160
|
-
if (this._parent.
|
|
161
|
-
this._parent.
|
|
162
|
+
if (this._parent.computedConsumptionDelegate != null) {
|
|
163
|
+
this._parent.computedConsumptionDelegate.value = Math.round(power * 10) / 10 // W
|
|
162
164
|
}
|
|
163
165
|
this._parent.values.consumption = this._delegate.value
|
|
164
166
|
this._parent.values.time = entry.time
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
// Device delivers power in W.
|
|
169
|
-
|
|
170
|
+
// Device delivers _Consumption_ (power) in W.
|
|
171
|
+
// We compute _Total Consumption_ and average power, and update _Total Consumption_.
|
|
172
|
+
class ConsumptionValue extends HistoryValue {
|
|
170
173
|
get tag () { return 0x07 }
|
|
171
174
|
get id () { return 'p' }
|
|
172
175
|
|
|
@@ -174,7 +177,7 @@ class PowerValue extends HistoryValue {
|
|
|
174
177
|
super(parent, delegate)
|
|
175
178
|
this._consumption = 0 // Ws
|
|
176
179
|
this._period = 0 // s
|
|
177
|
-
this._totalConsumption = parent.
|
|
180
|
+
this._totalConsumption = parent.computedTotalConsumptionDelegate.value * 1000 * 3600 // Ws
|
|
178
181
|
this._power = delegate.value // W
|
|
179
182
|
this._time = History.now()
|
|
180
183
|
delegate.on('didSet', (value) => {
|
|
@@ -186,7 +189,7 @@ class PowerValue extends HistoryValue {
|
|
|
186
189
|
Characteristic: parent.Characteristics.eve.ResetTotal
|
|
187
190
|
}).on('didSet', (value) => {
|
|
188
191
|
this._totalConsumption = 0 // Ws
|
|
189
|
-
parent.
|
|
192
|
+
parent.computedTotalConsumptionDelegate.value = 0 // kWh
|
|
190
193
|
})
|
|
191
194
|
}
|
|
192
195
|
|
|
@@ -196,7 +199,8 @@ class PowerValue extends HistoryValue {
|
|
|
196
199
|
const power = this._period === 0 ? 0 : this._consumption / this._period // W
|
|
197
200
|
entry[this.id] = Math.round(power * 10) // 0.1 W
|
|
198
201
|
const totalConsumption = this._totalConsumption / (1000 * 3600) // kWh
|
|
199
|
-
this._parent.
|
|
202
|
+
this._parent.computedTotalConsumptionDelegate.value =
|
|
203
|
+
Math.round(totalConsumption * 100) / 100 // kWh
|
|
200
204
|
|
|
201
205
|
this._consumption = 0
|
|
202
206
|
this._period = 0
|
|
@@ -212,8 +216,8 @@ class PowerValue extends HistoryValue {
|
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
218
|
|
|
215
|
-
// Device delivers (running)
|
|
216
|
-
class
|
|
219
|
+
// Device delivers (running) average _Consumption_ (power) in W.
|
|
220
|
+
class AverageConsumptionValue extends HistoryValue {
|
|
217
221
|
get tag () { return 0x07 }
|
|
218
222
|
get id () { return 'p' }
|
|
219
223
|
prepareEntry (entry) { entry[this.id] = this._delegate.value * 10 }
|
|
@@ -232,7 +236,7 @@ class SwitchOnValue extends HistoryValue {
|
|
|
232
236
|
const now = History.now()
|
|
233
237
|
const entry = { time: now }
|
|
234
238
|
entry[this.id] = this._delegate.value ? 1 : 0
|
|
235
|
-
|
|
239
|
+
parent.addEntry(entry)
|
|
236
240
|
parent.lastSwitchOnDelegate.value = parent.lastActivationValue(now)
|
|
237
241
|
})
|
|
238
242
|
}
|
|
@@ -284,7 +288,7 @@ class OnValue extends HistoryValue {
|
|
|
284
288
|
const now = History.now()
|
|
285
289
|
const entry = { time: now }
|
|
286
290
|
entry[this.id] = this._delegate.value ? 1 : 0
|
|
287
|
-
|
|
291
|
+
parent.addEntry(entry)
|
|
288
292
|
parent.lastOnDelegate.value = parent.lastActivationValue(now)
|
|
289
293
|
})
|
|
290
294
|
}
|
|
@@ -307,10 +311,10 @@ const historyValueTypes = {
|
|
|
307
311
|
vocLevel: VocLevelValue,
|
|
308
312
|
airPressure: AirPressureValue,
|
|
309
313
|
contact: ContactValue,
|
|
310
|
-
|
|
311
|
-
averagePower: AveragePowerValue,
|
|
312
|
-
switchOn: SwitchOnValue,
|
|
314
|
+
totalConsumption: TotalConsumptionValue,
|
|
313
315
|
consumption: ConsumptionValue,
|
|
316
|
+
averageConsumption: AverageConsumptionValue,
|
|
317
|
+
switchOn: SwitchOnValue,
|
|
314
318
|
valvePosition: ValvePositionValue,
|
|
315
319
|
targetTemperature: TargetTemperatureValue,
|
|
316
320
|
motion: MotionValue,
|
|
@@ -327,8 +331,8 @@ const historyDerivedTypes = {
|
|
|
327
331
|
lastOn: 'on',
|
|
328
332
|
lastLightOn: 'lightOn',
|
|
329
333
|
lastSwitchOn: 'switchOn',
|
|
330
|
-
computedConsumption: '
|
|
331
|
-
|
|
334
|
+
computedConsumption: 'totalConsumption',
|
|
335
|
+
computedTotalConsumption: 'consumption'
|
|
332
336
|
}
|
|
333
337
|
|
|
334
338
|
/** Class for an Eve _History_ service delegate.
|
|
@@ -394,22 +398,26 @@ class History extends ServiceDelegate {
|
|
|
394
398
|
* @param {?CharacteristicDelegate} params.lastOnDelegate - The
|
|
395
399
|
* `.eve.LastActivation` characteristic delegate
|
|
396
400
|
* for a `hap.Outlet` service.
|
|
397
|
-
* @param {?CharacteristicDelegate} params.
|
|
398
|
-
* `.eve.
|
|
401
|
+
* @param {?CharacteristicDelegate} params.consumptionDelegate - The
|
|
402
|
+
* `.eve.Consumption` characteristic delegate
|
|
399
403
|
* for a `hap.Outlet` or `eve.Consumption` service
|
|
400
|
-
* for a device that reports
|
|
401
|
-
* @param {?CharacteristicDelegate} params.
|
|
404
|
+
* for a device that reports power.
|
|
405
|
+
* @param {?CharacteristicDelegate} params.computedTotalConsumptionDelegate - The
|
|
402
406
|
* `eve.TotalConsumption` characteristic delegate
|
|
403
407
|
* for a `hap.Outlet` or `eve.Consumption` service
|
|
404
|
-
* for a device that reports
|
|
405
|
-
* @param {?CharacteristicDelegate} params.
|
|
408
|
+
* for a device that reports power, but not total consumption.
|
|
409
|
+
* @param {?CharacteristicDelegate} params.totalConsumptionDelegate - The
|
|
406
410
|
* `.eve.TotalConsumption` characteristic delegate
|
|
407
411
|
* for a `hap.Outlet` or `eve.Consumption` service
|
|
408
412
|
* for a device that reports total consumption.
|
|
409
|
-
* @param {?CharacteristicDelegate} params.
|
|
410
|
-
* `.eve.
|
|
413
|
+
* @param {?CharacteristicDelegate} params.computedConsumptionDelegate - The
|
|
414
|
+
* `.eve.Consumption` characteristic delegate
|
|
415
|
+
* for a `hap.Outlet` or `eve.Consumption` service
|
|
416
|
+
* for a device that reports total consumption but not power.
|
|
417
|
+
* @param {?CharacteristicDelegate} params.avarageConsumptionDelegate - The
|
|
418
|
+
* `.eve.Consumption` characteristic delegate
|
|
411
419
|
* for a `hap.Outlet` or `eve.Consumption` service
|
|
412
|
-
* for a device that reports
|
|
420
|
+
* for a device that reports runing average for power.
|
|
413
421
|
* @param {?CharacteristicDelegate} params.lightOnDelegate - The
|
|
414
422
|
* `Characteristics.hap.On` characteristic delegate
|
|
415
423
|
* for a `hap.Lightbulb` service.
|
|
@@ -88,18 +88,6 @@ class ServiceDelegate extends homebridgeLib.Delegate {
|
|
|
88
88
|
}
|
|
89
89
|
this._service.setHiddenService(!!params.hidden)
|
|
90
90
|
|
|
91
|
-
// Fix bug in homebridge-lib@<4.3.0 that caused the service context in
|
|
92
|
-
// ~/.homebridge/accessories/cachedAccessories to be stored under the
|
|
93
|
-
// wrong key.
|
|
94
|
-
if (
|
|
95
|
-
params.subtype == null &&
|
|
96
|
-
this._accessory.context[this._key + '.'] != null
|
|
97
|
-
) {
|
|
98
|
-
this._accessory.context[this._key] =
|
|
99
|
-
this._accessory.context[this._key + '.']
|
|
100
|
-
delete this._accessory.context[this._key + '.']
|
|
101
|
-
}
|
|
102
|
-
|
|
103
91
|
// Setup persisted storage in ~/.homebridge/accessories/cachedAccessories.
|
|
104
92
|
if (this._accessory.context[this._key] == null) {
|
|
105
93
|
this._accessory.context[this._key] = {}
|
|
@@ -118,6 +106,7 @@ class ServiceDelegate extends homebridgeLib.Delegate {
|
|
|
118
106
|
Characteristic: this.Characteristics.hap.Name,
|
|
119
107
|
value: params.name
|
|
120
108
|
})
|
|
109
|
+
this.name = this.values.name
|
|
121
110
|
if (this._service.constructor.name !== 'AccessoryInformation') {
|
|
122
111
|
this.addCharacteristicDelegate({
|
|
123
112
|
key: 'configuredName',
|
|
@@ -138,6 +127,7 @@ class ServiceDelegate extends homebridgeLib.Delegate {
|
|
|
138
127
|
}
|
|
139
128
|
}).on('didSet', (value) => {
|
|
140
129
|
this.name = value
|
|
130
|
+
this.values.name = value
|
|
141
131
|
if (params.primaryService) {
|
|
142
132
|
accessoryDelegate.values.name = value
|
|
143
133
|
}
|
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.12",
|
|
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.15.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.5"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",
|