homebridge-enphase-envoy 10.2.1 → 10.2.2-beta.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.
- package/package.json +1 -1
- package/src/envoydevice.js +71 -100
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"displayName": "Enphase Envoy",
|
|
4
4
|
"name": "homebridge-enphase-envoy",
|
|
5
|
-
"version": "10.2.
|
|
5
|
+
"version": "10.2.2-beta.0",
|
|
6
6
|
"description": "Homebridge p7ugin for Photovoltaic Energy System manufactured by Enphase.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "grzegorz914",
|
package/src/envoydevice.js
CHANGED
|
@@ -4065,8 +4065,10 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4065
4065
|
|
|
4066
4066
|
if (this.logInfo) {
|
|
4067
4067
|
this.emit('info', `Power And Energy, ${obj.measurementType}, power: ${obj.powerKw} kW`);
|
|
4068
|
-
|
|
4069
|
-
|
|
4068
|
+
if (key === 'production' && (!this.feature.liveData.supported || !this.feature.meters.production.enabled)) {
|
|
4069
|
+
this.emit('info', `Power And Energy, ${obj.measurementType}, power level: ${obj.powerLevel} %`);
|
|
4070
|
+
this.emit('info', `Power And Energy, ${obj.measurementType}, power state: ${obj.powerState ? 'On' : 'Off'}`);
|
|
4071
|
+
}
|
|
4070
4072
|
this.emit('info', `Power And Energy, ${obj.measurementType}, energy today: ${obj.energyTodayKw} kWh`);
|
|
4071
4073
|
this.emit('info', `Power And Energy, ${obj.measurementType}, energy last seven days: ${obj.energyLastSevenDaysKw} kWh`);
|
|
4072
4074
|
this.emit('info', `Power And Energy, ${obj.measurementType}, energy lifetime: ${obj.energyLifetimeKw} kWh`);
|
|
@@ -6064,36 +6066,18 @@ class EnvoyDevice extends EventEmitter {
|
|
|
6064
6066
|
}
|
|
6065
6067
|
|
|
6066
6068
|
// Meters
|
|
6067
|
-
if (this.feature.meters.
|
|
6069
|
+
if (this.feature.meters.supported) {
|
|
6068
6070
|
this.emit('devInfo', `Meters: Yes`);
|
|
6069
6071
|
|
|
6070
|
-
if (this.feature.meters.production.supported) {
|
|
6071
|
-
|
|
6072
|
-
}
|
|
6073
|
-
if (this.feature.meters.
|
|
6074
|
-
|
|
6075
|
-
}
|
|
6076
|
-
if (this.feature.meters.
|
|
6077
|
-
|
|
6078
|
-
}
|
|
6079
|
-
if (this.feature.meters.storage.supported) {
|
|
6080
|
-
this.emit('devInfo', `Storage: ${this.feature.meters.storage.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6081
|
-
}
|
|
6082
|
-
if (this.feature.meters.backfeed.supported) {
|
|
6083
|
-
this.emit('devInfo', `Back Feed: ${this.feature.meters.backfeed.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6084
|
-
}
|
|
6085
|
-
if (this.feature.meters.load.supported) {
|
|
6086
|
-
this.emit('devInfo', `Load: ${this.feature.meters.load.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6087
|
-
}
|
|
6088
|
-
if (this.feature.meters.evse.supported) {
|
|
6089
|
-
this.emit('devInfo', `EV Charger: ${this.feature.meters.evse.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6090
|
-
}
|
|
6091
|
-
if (this.feature.meters.pv3p.supported) {
|
|
6092
|
-
this.emit('devInfo', `PV 3P: ${this.feature.meters.pv3p.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6093
|
-
}
|
|
6094
|
-
if (this.feature.meters.generator.supported) {
|
|
6095
|
-
this.emit('devInfo', `Generator: ${this.feature.meters.generator.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6096
|
-
}
|
|
6072
|
+
if (this.feature.meters.production.supported) this.emit('devInfo', `Production: ${this.feature.meters.production.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6073
|
+
if (this.feature.meters.consumptionNet.supported) this.emit('devInfo', `Consumption Net: ${this.feature.meters.consumptionNet.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6074
|
+
if (this.feature.meters.consumptionTotal.supported) this.emit('devInfo', `Consumption Total: ${this.feature.meters.consumptionTotal.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6075
|
+
if (this.feature.meters.storage.supported) this.emit('devInfo', `Storage: ${this.feature.meters.storage.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6076
|
+
if (this.feature.meters.backfeed.supported) this.emit('devInfo', `Back Feed: ${this.feature.meters.backfeed.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6077
|
+
if (this.feature.meters.load.supported) this.emit('devInfo', `Load: ${this.feature.meters.load.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6078
|
+
if (this.feature.meters.evse.supported) this.emit('devInfo', `EV Charger: ${this.feature.meters.evse.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6079
|
+
if (this.feature.meters.pv3p.supported) this.emit('devInfo', `PV 3P: ${this.feature.meters.pv3p.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6080
|
+
if (this.feature.meters.generator.supported) this.emit('devInfo', `Generator: ${this.feature.meters.generator.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6097
6081
|
|
|
6098
6082
|
this.emit('devInfo', `--------------------------------`);
|
|
6099
6083
|
}
|
|
@@ -6101,31 +6085,16 @@ class EnvoyDevice extends EventEmitter {
|
|
|
6101
6085
|
// Ensemble
|
|
6102
6086
|
const ensemble = this.feature.inventory.esubs;
|
|
6103
6087
|
const hasEnsembleInfo = ensemble.enpowers.installed || ensemble.encharges.installed || ensemble.enpowers.dryContacts.installed || ensemble.generator.installed;
|
|
6104
|
-
|
|
6105
6088
|
if (hasEnsembleInfo) {
|
|
6106
6089
|
this.emit('devInfo', `Ensemble: Yes`);
|
|
6107
6090
|
|
|
6108
|
-
if (ensemble.enpowers.installed) {
|
|
6109
|
-
|
|
6110
|
-
}
|
|
6111
|
-
if (ensemble.
|
|
6112
|
-
|
|
6113
|
-
}
|
|
6114
|
-
if (ensemble.
|
|
6115
|
-
this.emit('devInfo', `IQ Battery: ${ensemble.encharges.count}`);
|
|
6116
|
-
}
|
|
6117
|
-
if (ensemble.collars.installed) {
|
|
6118
|
-
this.emit('devInfo', `IQ Meter Collar: ${ensemble.collars.count}`);
|
|
6119
|
-
}
|
|
6120
|
-
if (ensemble.c6CombinerControllers.installed) {
|
|
6121
|
-
this.emit('devInfo', `IQ Combiner Controller C6: ${ensemble.c6CombinerControllers.count}`);
|
|
6122
|
-
}
|
|
6123
|
-
if (ensemble.c6Rgms.installed) {
|
|
6124
|
-
this.emit('devInfo', `IQ Rgm C6: ${ensemble.c6Rgms.count}`);
|
|
6125
|
-
}
|
|
6126
|
-
if (ensemble.generator.installed) {
|
|
6127
|
-
this.emit('devInfo', `Generator: Yes`);
|
|
6128
|
-
}
|
|
6091
|
+
if (ensemble.enpowers.installed) this.emit('devInfo', `Enpowers: ${ensemble.enpowers.count}`);
|
|
6092
|
+
if (ensemble.enpowers.dryContacts.installed) this.emit('devInfo', `Dry Contacts: ${ensemble.enpowers.dryContacts.count}`);
|
|
6093
|
+
if (ensemble.encharges.installed) this.emit('devInfo', `IQ Battery: ${ensemble.encharges.count}`);
|
|
6094
|
+
if (ensemble.collars.installed) this.emit('devInfo', `IQ Meter Collar: ${ensemble.collars.count}`);
|
|
6095
|
+
if (ensemble.c6CombinerControllers.installed) this.emit('devInfo', `IQ Combiner Controller C6: ${ensemble.c6CombinerControllers.count}`);
|
|
6096
|
+
if (ensemble.c6Rgms.installed) this.emit('devInfo', `IQ Rgm C6: ${ensemble.c6Rgms.count}`);
|
|
6097
|
+
if (ensemble.generator.installed) this.emit('devInfo', `Generator: Yes`);
|
|
6129
6098
|
|
|
6130
6099
|
this.emit('devInfo', `--------------------------------`);
|
|
6131
6100
|
}
|
|
@@ -6194,62 +6163,64 @@ class EnvoyDevice extends EventEmitter {
|
|
|
6194
6163
|
.setCharacteristic(Characteristic.FirmwareRevision, this.pv.info.software.replace(/[a-zA-Z]/g, '') ?? '0');
|
|
6195
6164
|
|
|
6196
6165
|
//system
|
|
6197
|
-
if (this.
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
const systemService = accessory.addService(serviceType, accessoryName, `systemService`);
|
|
6201
|
-
systemService.setPrimaryService(true);
|
|
6202
|
-
systemService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
6203
|
-
systemService.setCharacteristic(Characteristic.ConfiguredName, accessoryName);
|
|
6204
|
-
|
|
6205
|
-
// Handle production state characteristic
|
|
6206
|
-
systemService.getCharacteristic(characteristicType)
|
|
6207
|
-
.onGet(async () => {
|
|
6208
|
-
if (this.logInfo) this.emit('info', `Production state: ${state ? 'Enabled' : 'Disabled'}`);
|
|
6209
|
-
return state;
|
|
6210
|
-
})
|
|
6211
|
-
.onSet(async (value) => {
|
|
6212
|
-
if (!productionStateSupported || !pvControl) {
|
|
6213
|
-
if (this.logWarn) this.emit('warn', !productionStateSupported ? `Production state control not supported` : `System control is locked`);
|
|
6214
|
-
setTimeout(() => systemService.updateCharacteristic(characteristicType, !value), 250);
|
|
6215
|
-
return;
|
|
6216
|
-
}
|
|
6166
|
+
if (this.systemAccessory) {
|
|
6167
|
+
if (this.logDebug) this.emit('debug', `Prepare System Service`);
|
|
6168
|
+
const { serviceType, characteristicType, characteristicType1, state, level } = this.systemAccessory;
|
|
6217
6169
|
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6170
|
+
const systemService = accessory.addService(serviceType, accessoryName, `systemService`);
|
|
6171
|
+
systemService.setPrimaryService(true);
|
|
6172
|
+
systemService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
6173
|
+
systemService.setCharacteristic(Characteristic.ConfiguredName, accessoryName);
|
|
6174
|
+
|
|
6175
|
+
// Handle production state characteristic
|
|
6176
|
+
systemService.getCharacteristic(characteristicType)
|
|
6177
|
+
.onGet(async () => {
|
|
6178
|
+
if (this.logInfo) this.emit('info', `Production state: ${state ? 'Enabled' : 'Disabled'}`);
|
|
6179
|
+
return state;
|
|
6180
|
+
})
|
|
6181
|
+
.onSet(async (value) => {
|
|
6182
|
+
if (!productionStateSupported || !pvControl) {
|
|
6183
|
+
if (this.logWarn) this.emit('warn', !productionStateSupported ? `Production state control not supported` : `System control is locked`);
|
|
6221
6184
|
setTimeout(() => systemService.updateCharacteristic(characteristicType, !value), 250);
|
|
6222
6185
|
return;
|
|
6223
6186
|
}
|
|
6224
6187
|
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6188
|
+
try {
|
|
6189
|
+
const tokenValid = await this.checkToken();
|
|
6190
|
+
if (!tokenValid || value === this.pv.productionState) {
|
|
6191
|
+
setTimeout(() => systemService.updateCharacteristic(characteristicType, !value), 250);
|
|
6192
|
+
return;
|
|
6193
|
+
}
|
|
6231
6194
|
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
.onSet(async (value) => {
|
|
6239
|
-
if (!pvControl) {
|
|
6240
|
-
if (this.logWarn) this.emit('warn', `System control is locked`);
|
|
6241
|
-
setTimeout(() => systemService.updateCharacteristic(characteristicType1, level), 250);
|
|
6242
|
-
return;
|
|
6243
|
-
}
|
|
6195
|
+
await this.setProductionState(value);
|
|
6196
|
+
if (this.logDebug) this.emit('debug', `Set production state: ${value ? 'Enabled' : 'Disabled'}`);
|
|
6197
|
+
} catch (error) {
|
|
6198
|
+
if (this.logWarn) this.emit('warn', `Set production state error: ${error}`);
|
|
6199
|
+
}
|
|
6200
|
+
});
|
|
6244
6201
|
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
if (this.
|
|
6249
|
-
|
|
6250
|
-
|
|
6202
|
+
// Handle production level characteristic
|
|
6203
|
+
systemService.getCharacteristic(characteristicType1)
|
|
6204
|
+
.onGet(async () => {
|
|
6205
|
+
if (this.logInfo) this.emit('info', `Production level: ${level} %`);
|
|
6206
|
+
return level;
|
|
6207
|
+
})
|
|
6208
|
+
.onSet(async (value) => {
|
|
6209
|
+
if (!pvControl) {
|
|
6210
|
+
if (this.logWarn) this.emit('warn', `System control is locked`);
|
|
6211
|
+
setTimeout(() => systemService.updateCharacteristic(characteristicType1, level), 250);
|
|
6212
|
+
return;
|
|
6213
|
+
}
|
|
6251
6214
|
|
|
6252
|
-
|
|
6215
|
+
try {
|
|
6216
|
+
systemService.updateCharacteristic(characteristicType1, level);
|
|
6217
|
+
} catch (error) {
|
|
6218
|
+
if (this.logWarn) this.emit('warn', `Set production level error: ${error}`);
|
|
6219
|
+
}
|
|
6220
|
+
});
|
|
6221
|
+
|
|
6222
|
+
this.systemService = systemService;
|
|
6223
|
+
}
|
|
6253
6224
|
|
|
6254
6225
|
//data refresh control
|
|
6255
6226
|
if (this.dataRefreshActiveControl) {
|