homebridge-enphase-envoy 10.3.0-beta.1 → 10.3.0-beta.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.
- package/package.json +1 -1
- package/src/envoydevice.js +43 -40
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.3.0-beta.
|
|
5
|
+
"version": "10.3.0-beta.2",
|
|
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
|
@@ -2171,7 +2171,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
2171
2171
|
|
|
2172
2172
|
//devices
|
|
2173
2173
|
this.enchargeServices = [];
|
|
2174
|
-
this.
|
|
2174
|
+
this.enchargeBackupLevelServices = [];
|
|
2175
2175
|
|
|
2176
2176
|
for (const encharge of this.pv.inventoryData.esubs.encharges.devices) {
|
|
2177
2177
|
const serialNumber = encharge.serialNumber;
|
|
@@ -2222,7 +2222,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
2222
2222
|
return currentChargeState;
|
|
2223
2223
|
});
|
|
2224
2224
|
|
|
2225
|
-
this.
|
|
2225
|
+
this.enchargeBackupLevelServices.push(controlService);
|
|
2226
2226
|
}
|
|
2227
2227
|
|
|
2228
2228
|
if (this.logDebug) this.emit('debug', `Prepare ${enchargeName} ${serialNumber} Service`);
|
|
@@ -4694,6 +4694,24 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4694
4694
|
gridProfile: encharge.gridProfile
|
|
4695
4695
|
};
|
|
4696
4696
|
|
|
4697
|
+
// Create characteristics
|
|
4698
|
+
const characteristics = [
|
|
4699
|
+
{ type: Characteristic.ChargeState, value: enchargeData.chargeState },
|
|
4700
|
+
{ type: Characteristic.AdminState, value: enchargeData.adminStateStr },
|
|
4701
|
+
{ type: Characteristic.Communicating, value: enchargeData.communicating },
|
|
4702
|
+
{ type: Characteristic.CommLevelSubGhz, value: enchargeData.commLevelSubGhz },
|
|
4703
|
+
{ type: Characteristic.CommLevel24Ghz, value: enchargeData.commLevel24Ghz },
|
|
4704
|
+
{ type: Characteristic.SleepEnabled, value: enchargeData.sleepEnabled },
|
|
4705
|
+
{ type: Characteristic.PercentFull, value: enchargeData.percentFull },
|
|
4706
|
+
{ type: Characteristic.Temperature, value: enchargeData.temperature },
|
|
4707
|
+
{ type: Characteristic.MaxCellTemp, value: enchargeData.maxCellTemp },
|
|
4708
|
+
{ type: Characteristic.LedStatus, value: enchargeData.ledStatus },
|
|
4709
|
+
{ type: Characteristic.Capacity, value: enchargeData.capacity },
|
|
4710
|
+
{ type: Characteristic.DcSwitchOff, value: enchargeData.dcSwitchOff },
|
|
4711
|
+
{ type: Characteristic.Revision, value: enchargeData.rev },
|
|
4712
|
+
{ type: Characteristic.ReadingTime, value: enchargeData.readingTime }
|
|
4713
|
+
];
|
|
4714
|
+
|
|
4697
4715
|
// Add status field
|
|
4698
4716
|
if (enchargesStatusSupported && encharge.status) {
|
|
4699
4717
|
if (this.logDebug) this.emit('debug', `Requesting encharge ${enchargeData.serialNumber} status data`);
|
|
@@ -4725,6 +4743,8 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4725
4743
|
submodulesCount: status.submodulesCount,
|
|
4726
4744
|
submodules: status.submodules
|
|
4727
4745
|
};
|
|
4746
|
+
|
|
4747
|
+
characteristics.push({ type: Characteristic.CommInterface, value: enchargeData.status.commInterfaceStr }, { type: Characteristic.RatedPower, value: enchargeData.status.ratedPowerKw })
|
|
4728
4748
|
}
|
|
4729
4749
|
|
|
4730
4750
|
// Add power field
|
|
@@ -4740,56 +4760,39 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4740
4760
|
apparentPowerKw: power.apparentPower / 1000000,
|
|
4741
4761
|
soc: power.soc,
|
|
4742
4762
|
};
|
|
4763
|
+
|
|
4764
|
+
characteristics.push({ type: Characteristic.RealPower, value: enchargeData.power.realPowerKw });
|
|
4743
4765
|
}
|
|
4744
4766
|
|
|
4745
|
-
//
|
|
4767
|
+
// Add grid profile characteristic
|
|
4768
|
+
if (this.feature.gridProfile.supported) characteristics.push({ type: Characteristic.GridProfile, value: enchargeData.gridProfile });
|
|
4769
|
+
|
|
4770
|
+
for (const { type, value } of characteristics) {
|
|
4771
|
+
if (!this.functions.isValidValue(value)) continue;
|
|
4772
|
+
this.enchargeServices?.[index]?.updateCharacteristic(type, value);
|
|
4773
|
+
};
|
|
4774
|
+
|
|
4775
|
+
// Update encharge backup level accessory
|
|
4746
4776
|
if (this.enchargeBackupLevelAccessory.displayType > 0) {
|
|
4747
4777
|
const accessory = this.enchargeBackupLevelAccessory;
|
|
4748
4778
|
const { minSoc, characteristicType, characteristicType1, characteristicType2 } = accessory;
|
|
4749
4779
|
const state = enchargeData.percentFull < minSoc;
|
|
4750
4780
|
|
|
4751
4781
|
// Create characteristics
|
|
4752
|
-
const
|
|
4782
|
+
const characteristics1 = [
|
|
4753
4783
|
{ type: characteristicType, value: state, valueKey: 'state' },
|
|
4754
4784
|
{ type: characteristicType1, value: enchargeData.percentFull, valueKey: 'backupLevel' },
|
|
4755
4785
|
{ type: characteristicType2, value: enchargeData.chargeStateNum, valueKey: 'chargeState' },
|
|
4756
4786
|
];
|
|
4757
4787
|
|
|
4758
4788
|
// Update acbs services
|
|
4759
|
-
for (const { type, value, valueKey } of
|
|
4789
|
+
for (const { type, value, valueKey } of characteristics1) {
|
|
4760
4790
|
if (!this.functions.isValidValue(value)) continue;
|
|
4761
4791
|
accessory[valueKey] = value;
|
|
4762
|
-
this.
|
|
4792
|
+
this.enchargeBackupLevelServices?.[index]?.updateCharacteristic(type, value);
|
|
4763
4793
|
}
|
|
4764
4794
|
}
|
|
4765
4795
|
|
|
4766
|
-
// Create characteristics
|
|
4767
|
-
const characteristics = [
|
|
4768
|
-
{ type: Characteristic.ChargeState, value: enchargeData.chargeState },
|
|
4769
|
-
{ type: Characteristic.AdminState, value: enchargeData.adminStateStr },
|
|
4770
|
-
{ type: Characteristic.Communicating, value: enchargeData.communicating },
|
|
4771
|
-
{ type: Characteristic.CommLevelSubGhz, value: enchargeData.commLevelSubGhz },
|
|
4772
|
-
{ type: Characteristic.CommLevel24Ghz, value: enchargeData.commLevel24Ghz },
|
|
4773
|
-
{ type: Characteristic.SleepEnabled, value: enchargeData.sleepEnabled },
|
|
4774
|
-
{ type: Characteristic.PercentFull, value: enchargeData.percentFull },
|
|
4775
|
-
{ type: Characteristic.Temperature, value: enchargeData.temperature },
|
|
4776
|
-
{ type: Characteristic.MaxCellTemp, value: enchargeData.maxCellTemp },
|
|
4777
|
-
{ type: Characteristic.LedStatus, value: enchargeData.ledStatus },
|
|
4778
|
-
{ type: Characteristic.Capacity, value: enchargeData.capacity },
|
|
4779
|
-
{ type: Characteristic.DcSwitchOff, value: enchargeData.dcSwitchOff },
|
|
4780
|
-
{ type: Characteristic.Revision, value: enchargeData.rev },
|
|
4781
|
-
{ type: Characteristic.ReadingTime, value: enchargeData.readingTime }
|
|
4782
|
-
];
|
|
4783
|
-
|
|
4784
|
-
if (enchargesStatusSupported && enchargeData.status) characteristics.push({ type: Characteristic.CommInterface, value: enchargeData.status.commInterfaceStr }, { type: Characteristic.RatedPower, value: enchargeData.status.ratedPowerKw });
|
|
4785
|
-
if (enchargesPowerSupported && enchargeData.power) characteristics.push({ type: Characteristic.RealPower, value: enchargeData.power.realPowerKw });
|
|
4786
|
-
if (this.feature.gridProfile.supported) characteristics.push({ type: Characteristic.GridProfile, value: enchargeData.gridProfile });
|
|
4787
|
-
|
|
4788
|
-
for (const { type, value } of characteristics) {
|
|
4789
|
-
if (!this.functions.isValidValue(value)) continue;
|
|
4790
|
-
this.enchargeServices?.[index]?.updateCharacteristic(type, value);
|
|
4791
|
-
};
|
|
4792
|
-
|
|
4793
4796
|
return enchargeData;
|
|
4794
4797
|
}));
|
|
4795
4798
|
|
|
@@ -4914,17 +4917,17 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4914
4917
|
// Encharge profile control updates
|
|
4915
4918
|
for (let i = 0; i < this.enchargeProfileControls.length; i++) {
|
|
4916
4919
|
const accessory = this.enchargeProfileControls[i];
|
|
4917
|
-
const { characteristicType } = accessory;
|
|
4918
|
-
const
|
|
4919
|
-
const
|
|
4920
|
-
const state =
|
|
4920
|
+
const { characteristicType, profile, chargeFromGrid } = accessory;
|
|
4921
|
+
const profileState = profile === tariff.storageSettings.mode;
|
|
4922
|
+
const chargeFromGridState = chargeFromGrid === tariff.storageSettings.chargeFromGrid;
|
|
4923
|
+
const state = profileState && chargeFromGridState;
|
|
4921
4924
|
|
|
4922
4925
|
// Create characteristics
|
|
4923
4926
|
const characteristics = [
|
|
4924
4927
|
{ type: characteristicType, value: state, valueKey: 'state' },
|
|
4925
4928
|
];
|
|
4926
4929
|
|
|
4927
|
-
if (
|
|
4930
|
+
if (profile !== 'backup') {
|
|
4928
4931
|
characteristics.push({ type: Characteristic.Brightness, value: tariff.storageSettings.reservedSoc, valueKey: 'reservedSoc' });
|
|
4929
4932
|
}
|
|
4930
4933
|
|
|
@@ -4939,8 +4942,8 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4939
4942
|
// Encharge profile sensors update
|
|
4940
4943
|
for (let i = 0; i < this.enchargeProfileSensors.length; i++) {
|
|
4941
4944
|
const sensor = this.enchargeProfileSensors[i];
|
|
4942
|
-
const { characteristicType } = sensor;
|
|
4943
|
-
const state = tariff.storageSettings.mode
|
|
4945
|
+
const { characteristicType, profile } = sensor;
|
|
4946
|
+
const state = profile === tariff.storageSettings.mode;
|
|
4944
4947
|
|
|
4945
4948
|
// Create characteristics
|
|
4946
4949
|
const characteristics = [
|