homebridge-enphase-envoy 10.3.0 → 10.3.1-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/README.md CHANGED
@@ -24,7 +24,7 @@ The `homebridge-enphase-envoy` plugin integrates Enphase Envoy solar energy moni
24
24
  | Package | Installation | Role | Required |
25
25
  | --- | --- | --- | --- |
26
26
  | [Homebridge](https://github.com/homebridge/homebridge) | [Homebridge Wiki](https://github.com/homebridge/homebridge/wiki) | HomeKit Bridge | Required |
27
- | [Config UI X](https://github.com/homebridge/homebridge-config-ui-x) | [Config UI X Wiki](https://github.com/homebridge/homebridge-config-ui-x/wiki) | Homebridge Web User Interface | Recommended |
27
+ | [Homebridge UI](https://github.com/homebridge/homebridge-config-ui-x) | [Homebridge UI Wiki](https://github.com/homebridge/homebridge-config-ui-x/wiki) | Homebridge Web User Interface | Recommended |
28
28
  | [Enphase Envoy](https://www.npmjs.com/package/homebridge-enphase-envoy) | [Plug-In Wiki](https://github.com/grzegorz914/homebridge-enphase-envoy/wiki) | Homebridge Plug-In | Required |
29
29
 
30
30
  ## Supported hardware
@@ -90,7 +90,7 @@ The `homebridge-enphase-envoy` plugin integrates Enphase Envoy solar energy moni
90
90
  ### Configuration
91
91
 
92
92
  * Running this plugin as a [Child Bridge](https://github.com/homebridge/homebridge/wiki/Child-Bridges) is **highly recommended**. This prevents Homebridge from crashing if the plugin crashes.
93
- * Installation and use of [Homebridge Config UI X](https://github.com/homebridge/homebridge-config-ui-x) to configure this plugin is **highly recommended**.
93
+ * Installation and use of [Homebridge UI](https://github.com/homebridge/homebridge-config-ui-x) to configure this plugin is **highly recommended**.
94
94
  * The `sample-config.json` can be edited and used as an alternative for advanced users.
95
95
 
96
96
  <p align="center">
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",
5
+ "version": "10.3.1-beta.0",
6
6
  "description": "Homebridge p7ugin for Photovoltaic Energy System manufactured by Enphase.",
7
7
  "license": "MIT",
8
8
  "author": "grzegorz914",
@@ -1554,22 +1554,6 @@ export default (api) => {
1554
1554
  }
1555
1555
  Characteristic.EncAggSoc = EncAggSoc;
1556
1556
 
1557
- class EncAggRatedPower extends Characteristic {
1558
- constructor() {
1559
- super('ENC rated power', '00000208-000B-1000-8000-0026BB765291');
1560
- this.setProps({
1561
- format: Formats.FLOAT,
1562
- unit: 'kW',
1563
- maxValue: 1000,
1564
- minValue: -1000,
1565
- minStep: 0.001,
1566
- perms: [Perms.PAIRED_READ, Perms.NOTIFY]
1567
- });
1568
- this.value = this.getDefaultValue();
1569
- }
1570
- }
1571
- Characteristic.EncAggRatedPower = EncAggRatedPower;
1572
-
1573
1557
  class EncAggBackupEnergy extends Characteristic {
1574
1558
  constructor() {
1575
1559
  super('ENC backup energy', '00000209-000B-1000-8000-0026BB765291');
package/src/envoydata.js CHANGED
@@ -412,7 +412,7 @@ class EnvoyData extends EventEmitter {
412
412
  .on('updateEnsemble', () => this.handleWithLock('updateEnsemble', async () => {
413
413
  const updateEnsemble = this.feature.ensemble.inventory.supported ? await this.updateEnsembleInventory() : false;
414
414
  if (updateEnsemble && this.feature.ensemble.status.supported) await this.updateEnsembleStatus();
415
- if (updateEnsemble && this.feature.inventory.esubs.encharges.power.supported) await this.updateEnsemblePower();
415
+ if (updateEnsemble && this.feature.ensemble.power.supported) await this.updateEnsemblePower();
416
416
 
417
417
  const updateEnchargeSettings = updateEnsemble && this.feature.inventory.esubs.encharges.settings.supported ? await this.updateEnchargesSettings() : false;
418
418
  if (updateEnchargeSettings && this.feature.inventory.esubs.encharges.tariff.supported) await this.updateTariff();
@@ -2038,20 +2038,19 @@ class EnvoyData extends EventEmitter {
2038
2038
 
2039
2039
  try {
2040
2040
  const response = await this.axiosInstance.get(ApiUrls.EnsemblePower);
2041
- const responseData = response.data;
2041
+ const responseData = response.data ?? {};
2042
2042
  if (this.logDebug) this.emit('debug', `Ensemble power response:`, responseData);
2043
2043
 
2044
- const devices = responseData.devices ?? [];
2044
+ const devices = responseData.devices || [];
2045
2045
  if (devices.length === 0) return false;
2046
2046
 
2047
2047
  // update encharges
2048
2048
  const enchargesRealPowerSummary = [];
2049
2049
  const encharges = this.pv.inventory.esubs.encharges.devices || [];
2050
- for (const device of devices) {
2051
- const serialNumber = device.serial_num;
2052
- const encharge = encharges.find(device => device.serialNumber === serialNumber);
2050
+ for (const encharge of encharges) {
2051
+ const device = devices.find(device => device.serial_num === encharge.serialNumber);
2053
2052
  if (this.logDebug) this.emit('debug', `Ensemble device power:`, device);
2054
- if (!encharge) continue;
2053
+ if (!device) continue;
2055
2054
 
2056
2055
  encharge.power = {
2057
2056
  serialNumber: device.serial_num,
@@ -2060,8 +2059,8 @@ class EnvoyData extends EventEmitter {
2060
2059
  soc: device.soc,
2061
2060
  };
2062
2061
 
2063
- if (this.functions.isValidValue(encharge.power.realPower)) enchargesRealPowerSummary.push(encharge.power.realPower);
2064
2062
  this.feature.inventory.esubs.encharges.power.supported = true;
2063
+ if (this.functions.isValidValue(encharge.power.realPower)) enchargesRealPowerSummary.push(encharge.power.realPower);
2065
2064
  }
2066
2065
 
2067
2066
  // Calculate encharges real power summary in kW
@@ -2091,7 +2090,7 @@ class EnvoyData extends EventEmitter {
2091
2090
  const enchargesSettingsSupported = 'enc_settings' in enchargesSettings;
2092
2091
  if (!enchargesSettingsSupported) return false;
2093
2092
 
2094
- const settings = {
2093
+ const settings = {
2095
2094
  enable: enchargesSettings.enc_settings.enable, // boolean
2096
2095
  country: enchargesSettings.enc_settings.country, // string
2097
2096
  currentLimit: enchargesSettings.enc_settings.current_limit, // float
@@ -2772,12 +2771,16 @@ class EnvoyData extends EventEmitter {
2772
2771
  const getEnsemble = tokenRequired && this.feature.inventory.esubs.supported ? await this.updateEnsembleInventory() : false;
2773
2772
  if (getEnsemble) {
2774
2773
  await this.updateEnsembleStatus();
2775
- if (this.feature.inventory.esubs.encharges.installed) await this.updateEnsemblePower();
2776
- const getEnchargeSettings = this.feature.inventory.esubs.encharges.installed ? await this.updateEnchargesSettings() : false;
2777
- if (getEnchargeSettings) await this.updateTariff();
2774
+ if (this.feature.inventory.esubs.encharges.installed) {
2775
+ await this.updateEnsemblePower();
2776
+ await this.updateEnchargesSettings();
2777
+ await this.updateTariff();
2778
+ }
2778
2779
 
2779
- const getDryContacts = this.feature.inventory.esubs.enpowers.installed ? await this.updateDryContacts() : false;
2780
- if (getDryContacts) await this.updateDryContactsSettings();
2780
+ if (this.feature.inventory.esubs.enpowers.installed) {
2781
+ await this.updateDryContacts();
2782
+ await this.updateDryContactsSettings();
2783
+ }
2781
2784
 
2782
2785
  const getGenerator = await this.updateGenerator();
2783
2786
  if (getGenerator && this.feature.inventory.esubs.generator.installed) await this.updateGeneratorSettings();
@@ -2257,22 +2257,14 @@ class EnvoyDevice extends EventEmitter {
2257
2257
  { type: Characteristic.ReadingTime, label: 'reading time', value: encharge.readingTime },
2258
2258
  ];
2259
2259
 
2260
- if (gridProfileSupported) {
2261
- characteristics.push(
2262
- { type: Characteristic.GridProfile, label: 'grid profile', value: encharge.gridProfile }
2263
- );
2264
- }
2265
-
2260
+ if (gridProfileSupported) characteristics.push({ type: Characteristic.GridProfile, label: 'grid profile', value: encharge.gridProfile });
2266
2261
  if (enchargesStatusSupported && encharge.status) {
2267
2262
  characteristics.push(
2268
2263
  { type: Characteristic.CommInterface, label: 'comm interface', value: encharge.status.commInterfaceStr },
2269
2264
  { type: Characteristic.RatedPower, label: 'rated power', value: encharge.status.ratedPowerKw, unit: 'kW' }
2270
2265
  );
2271
2266
  }
2272
-
2273
- if (enchargesPowerSupported && encharge.power) {
2274
- characteristics.push({ type: Characteristic.RealPower, label: 'real power', value: encharge.power.realPowerKw, unit: 'kW' });
2275
- }
2267
+ if (enchargesPowerSupported && encharge.power) characteristics.push({ type: Characteristic.RealPower, label: 'real power', value: encharge.power.realPowerKw, unit: 'kW' });
2276
2268
 
2277
2269
  for (const { type, label, value, unit = '', postfix = '' } of characteristics) {
2278
2270
  if (!this.functions.isValidValue(value)) continue;
@@ -3630,7 +3622,7 @@ class EnvoyDevice extends EventEmitter {
3630
3622
  };
3631
3623
 
3632
3624
  if (this.logDebug) {
3633
- this.emit('debug', `Q-Rela state:`, nsrbData.relay);
3625
+ this.emit('debug', `Q-Relay state:`, nsrbData.relay);
3634
3626
  this.emit('debug', `Q-Relay lines:`, nsrbData.linesCount);
3635
3627
  }
3636
3628