homebridge-enphase-envoy 10.2.0 → 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/CHANGELOG.md +7 -1
- package/package.json +1 -1
- package/src/envoydevice.js +74 -107
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
- after update to v10.0.0 and above the accessory and bridge need to be removed from the homebridge / Home.app and added again
|
|
11
11
|
|
|
12
|
-
## [10.2.
|
|
12
|
+
## [10.2.1] - (03.10.2025)
|
|
13
|
+
|
|
14
|
+
## Changes
|
|
15
|
+
|
|
16
|
+
- fix power level not refresh if meter production not enabled [#213](https://github.com/grzegorz914/homebridge-enphase-envoy/issues/213)
|
|
17
|
+
|
|
18
|
+
## [10.2.0] - (03.10.2025)
|
|
13
19
|
|
|
14
20
|
## Changes
|
|
15
21
|
|
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.0",
|
|
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
|
@@ -1242,7 +1242,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1242
1242
|
try {
|
|
1243
1243
|
await this.setOverExternalIntegration('MQTT', key, value);
|
|
1244
1244
|
} catch (error) {
|
|
1245
|
-
if (this.logWarn)
|
|
1245
|
+
if (this.logWarn) this.emit('warn' `MQTT set, error: ${error}`);
|
|
1246
1246
|
};
|
|
1247
1247
|
})
|
|
1248
1248
|
.on('debug', (debug) => this.emit('debug', debug))
|
|
@@ -1252,7 +1252,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1252
1252
|
|
|
1253
1253
|
return true;
|
|
1254
1254
|
} catch (error) {
|
|
1255
|
-
if (this.logWarn)
|
|
1255
|
+
if (this.logWarn) this.emit('warn' `External integration start error: ${error}`);
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
1258
|
|
|
@@ -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`);
|
|
@@ -4151,7 +4153,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4151
4153
|
};
|
|
4152
4154
|
|
|
4153
4155
|
// Update system accessory service
|
|
4154
|
-
if (key === 'production' && this.isValidValue(obj.powerLevel) && !this.feature.liveData.supported) {
|
|
4156
|
+
if (key === 'production' && this.isValidValue(obj.powerLevel) && (!this.feature.liveData.supported || !this.feature.meters.production.enabled)) {
|
|
4155
4157
|
const accessory = this.systemAccessory;
|
|
4156
4158
|
const { characteristicType, characteristicType1 } = accessory;
|
|
4157
4159
|
accessory.state = obj.powerState;
|
|
@@ -5589,10 +5591,6 @@ class EnvoyDevice extends EventEmitter {
|
|
|
5589
5591
|
if (this.feature.meters.consumptionNet.enabled) activeDevices.push({ type: 'Consumption Net', meter: meters.grid });
|
|
5590
5592
|
if (this.feature.meters.consumptionTotal.enabled) activeDevices.push({ type: 'Consumption Total', meter: meters.load });
|
|
5591
5593
|
if (this.feature.meters.storage.enabled || this.pv.inventory.esubs.encharges.installed) activeDevices.push({ type: 'Storage', meter: meters.storage });
|
|
5592
|
-
if (this.feature.meters.backfeed.enabled) activeDevices.push({ type: 'Back Feed', meter: meters.backfeed });
|
|
5593
|
-
if (this.feature.meters.load.enabled) activeDevices.push({ type: 'Load', meter: meters.load });
|
|
5594
|
-
if (this.feature.meters.evse.enabled) activeDevices.push({ type: 'EV Charger', meter: meters.evse });
|
|
5595
|
-
if (this.feature.meters.pv3p.enabled) activeDevices.push({ type: 'PV 3p', meter: meters.load });
|
|
5596
5594
|
if (this.feature.meters.generator.enabled) activeDevices.push({ type: 'Generator', meter: meters.generator });
|
|
5597
5595
|
for (const [index, { type, meter }] of activeDevices.entries()) {
|
|
5598
5596
|
if (!meter) {
|
|
@@ -6068,36 +6066,18 @@ class EnvoyDevice extends EventEmitter {
|
|
|
6068
6066
|
}
|
|
6069
6067
|
|
|
6070
6068
|
// Meters
|
|
6071
|
-
if (this.feature.meters.
|
|
6069
|
+
if (this.feature.meters.supported) {
|
|
6072
6070
|
this.emit('devInfo', `Meters: Yes`);
|
|
6073
6071
|
|
|
6074
|
-
if (this.feature.meters.production.supported) {
|
|
6075
|
-
|
|
6076
|
-
}
|
|
6077
|
-
if (this.feature.meters.
|
|
6078
|
-
|
|
6079
|
-
}
|
|
6080
|
-
if (this.feature.meters.
|
|
6081
|
-
|
|
6082
|
-
}
|
|
6083
|
-
if (this.feature.meters.storage.supported) {
|
|
6084
|
-
this.emit('devInfo', `Storage: ${this.feature.meters.storage.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6085
|
-
}
|
|
6086
|
-
if (this.feature.meters.backfeed.supported) {
|
|
6087
|
-
this.emit('devInfo', `Back Feed: ${this.feature.meters.backfeed.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6088
|
-
}
|
|
6089
|
-
if (this.feature.meters.load.supported) {
|
|
6090
|
-
this.emit('devInfo', `Load: ${this.feature.meters.load.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6091
|
-
}
|
|
6092
|
-
if (this.feature.meters.evse.supported) {
|
|
6093
|
-
this.emit('devInfo', `EV Charger: ${this.feature.meters.evse.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6094
|
-
}
|
|
6095
|
-
if (this.feature.meters.pv3p.supported) {
|
|
6096
|
-
this.emit('devInfo', `PV 3P: ${this.feature.meters.pv3p.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6097
|
-
}
|
|
6098
|
-
if (this.feature.meters.generator.supported) {
|
|
6099
|
-
this.emit('devInfo', `Generator: ${this.feature.meters.generator.enabled ? 'Enabled' : 'Disabled'}`);
|
|
6100
|
-
}
|
|
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'}`);
|
|
6101
6081
|
|
|
6102
6082
|
this.emit('devInfo', `--------------------------------`);
|
|
6103
6083
|
}
|
|
@@ -6105,31 +6085,16 @@ class EnvoyDevice extends EventEmitter {
|
|
|
6105
6085
|
// Ensemble
|
|
6106
6086
|
const ensemble = this.feature.inventory.esubs;
|
|
6107
6087
|
const hasEnsembleInfo = ensemble.enpowers.installed || ensemble.encharges.installed || ensemble.enpowers.dryContacts.installed || ensemble.generator.installed;
|
|
6108
|
-
|
|
6109
6088
|
if (hasEnsembleInfo) {
|
|
6110
6089
|
this.emit('devInfo', `Ensemble: Yes`);
|
|
6111
6090
|
|
|
6112
|
-
if (ensemble.enpowers.installed) {
|
|
6113
|
-
|
|
6114
|
-
}
|
|
6115
|
-
if (ensemble.
|
|
6116
|
-
|
|
6117
|
-
}
|
|
6118
|
-
if (ensemble.
|
|
6119
|
-
this.emit('devInfo', `IQ Battery: ${ensemble.encharges.count}`);
|
|
6120
|
-
}
|
|
6121
|
-
if (ensemble.collars.installed) {
|
|
6122
|
-
this.emit('devInfo', `IQ Meter Collar: ${ensemble.collars.count}`);
|
|
6123
|
-
}
|
|
6124
|
-
if (ensemble.c6CombinerControllers.installed) {
|
|
6125
|
-
this.emit('devInfo', `IQ Combiner Controller C6: ${ensemble.c6CombinerControllers.count}`);
|
|
6126
|
-
}
|
|
6127
|
-
if (ensemble.c6Rgms.installed) {
|
|
6128
|
-
this.emit('devInfo', `IQ Rgm C6: ${ensemble.c6Rgms.count}`);
|
|
6129
|
-
}
|
|
6130
|
-
if (ensemble.generator.installed) {
|
|
6131
|
-
this.emit('devInfo', `Generator: Yes`);
|
|
6132
|
-
}
|
|
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`);
|
|
6133
6098
|
|
|
6134
6099
|
this.emit('devInfo', `--------------------------------`);
|
|
6135
6100
|
}
|
|
@@ -6198,62 +6163,64 @@ class EnvoyDevice extends EventEmitter {
|
|
|
6198
6163
|
.setCharacteristic(Characteristic.FirmwareRevision, this.pv.info.software.replace(/[a-zA-Z]/g, '') ?? '0');
|
|
6199
6164
|
|
|
6200
6165
|
//system
|
|
6201
|
-
if (this.
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
const systemService = accessory.addService(serviceType, accessoryName, `systemService`);
|
|
6205
|
-
systemService.setPrimaryService(true);
|
|
6206
|
-
systemService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
6207
|
-
systemService.setCharacteristic(Characteristic.ConfiguredName, accessoryName);
|
|
6208
|
-
|
|
6209
|
-
// Handle production state characteristic
|
|
6210
|
-
systemService.getCharacteristic(characteristicType)
|
|
6211
|
-
.onGet(async () => {
|
|
6212
|
-
if (this.logInfo) this.emit('info', `Production state: ${state ? 'Enabled' : 'Disabled'}`);
|
|
6213
|
-
return state;
|
|
6214
|
-
})
|
|
6215
|
-
.onSet(async (value) => {
|
|
6216
|
-
if (!productionStateSupported || !pvControl) {
|
|
6217
|
-
if (this.logWarn) this.emit('warn', !productionStateSupported ? `Production state control not supported` : `System control is locked`);
|
|
6218
|
-
setTimeout(() => systemService.updateCharacteristic(characteristicType, !value), 250);
|
|
6219
|
-
return;
|
|
6220
|
-
}
|
|
6166
|
+
if (this.systemAccessory) {
|
|
6167
|
+
if (this.logDebug) this.emit('debug', `Prepare System Service`);
|
|
6168
|
+
const { serviceType, characteristicType, characteristicType1, state, level } = this.systemAccessory;
|
|
6221
6169
|
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
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`);
|
|
6225
6184
|
setTimeout(() => systemService.updateCharacteristic(characteristicType, !value), 250);
|
|
6226
6185
|
return;
|
|
6227
6186
|
}
|
|
6228
6187
|
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
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
|
+
}
|
|
6235
6194
|
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
.onSet(async (value) => {
|
|
6243
|
-
if (!pvControl) {
|
|
6244
|
-
if (this.logWarn) this.emit('warn', `System control is locked`);
|
|
6245
|
-
setTimeout(() => systemService.updateCharacteristic(characteristicType1, level), 250);
|
|
6246
|
-
return;
|
|
6247
|
-
}
|
|
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
|
+
});
|
|
6248
6201
|
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
if (this.
|
|
6253
|
-
|
|
6254
|
-
|
|
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
|
+
}
|
|
6255
6214
|
|
|
6256
|
-
|
|
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
|
+
}
|
|
6257
6224
|
|
|
6258
6225
|
//data refresh control
|
|
6259
6226
|
if (this.dataRefreshActiveControl) {
|