homebridge-enphase-envoy 9.3.6 → 9.3.7-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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/envoydevice.js +31 -31
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": "9.3.6",
5
+ "version": "9.3.7-beta.0",
6
6
  "description": "Homebridge plugin for Photovoltaic Energy System manufactured by Enphase.",
7
7
  "license": "MIT",
8
8
  "author": "grzegorz914",
@@ -2423,17 +2423,17 @@ class EnvoyDevice extends EventEmitter {
2423
2423
  energy: (acBatteries.whNow + this.acBatterieStorageOffset) ?? 0,
2424
2424
  energyKw: (acBatteries.whNow + this.acBatterieStorageOffset) / 1000 ?? 0,
2425
2425
  chargeStatus: CONSTANTS.ApiCodes[acBatteries.state] ?? 'Unknown',
2426
- energyState: acBatteries.whNow > 0 ?? false,
2427
- percentFull: 0
2426
+ energyStateSum: acBatteries.whNow > 0 ?? false,
2427
+ percentFullSum: 0
2428
2428
  };
2429
2429
  //add ac batterie summary to pv object
2430
2430
  this.pv.production.ct.acBatterie = acBatterie;
2431
2431
 
2432
2432
  //update chaaracteristics
2433
- if (this.enphaseAcBatterieSummaryLevelAndStateService) {
2434
- this.enphaseAcBatterieSummaryLevelAndStateService
2435
- .updateCharacteristic(Characteristic.On, acBatterie.energyState)
2436
- .updateCharacteristic(Characteristic.Brightness, acBatterie.percentFull)
2433
+ if (this.acBatteriesSummaryLevelAndStateService) {
2434
+ this.acBatteriesSummaryLevelAndStateService
2435
+ .updateCharacteristic(Characteristic.On, acBatterie.energyStateSum)
2436
+ .updateCharacteristic(Characteristic.Brightness, acBatterie.percentFullSum)
2437
2437
  }
2438
2438
 
2439
2439
  if (this.acBatterieSummaryService) {
@@ -2441,7 +2441,7 @@ class EnvoyDevice extends EventEmitter {
2441
2441
  .updateCharacteristic(Characteristic.enphaseAcBatterieSummaryReadingTime, acBatterie.readingTime)
2442
2442
  .updateCharacteristic(Characteristic.enphaseAcBatterieSummaryPower, acBatterie.powerKw)
2443
2443
  .updateCharacteristic(Characteristic.enphaseAcBatterieSummaryEnergy, acBatterie.energyKw)
2444
- .updateCharacteristic(Characteristic.enphaseAcBatterieSummaryPercentFull, acBatterie.percentFull)
2444
+ .updateCharacteristic(Characteristic.enphaseAcBatterieSummaryPercentFull, acBatterie.percentFullSum)
2445
2445
  .updateCharacteristic(Characteristic.enphaseAcBatterieSummaryActiveCount, acBatterie.activeCount)
2446
2446
  .updateCharacteristic(Characteristic.enphaseAcBatterieSummaryState, acBatterie.chargeStatus);
2447
2447
  }
@@ -2604,12 +2604,12 @@ class EnvoyDevice extends EventEmitter {
2604
2604
 
2605
2605
  //calculate encharges percent full summ
2606
2606
  this.ensemble.encharges.percentFullSum = (enchargesPercentFullSummary.reduce((total, num) => total + num, 0) / enchargesData.length) ?? 0;
2607
- this.ensemble.encharges.energyState = this.ensemble.encharges.percentFullSum > 0;
2607
+ this.ensemble.encharges.energyStateSum = this.ensemble.encharges.percentFullSum > 0;
2608
2608
 
2609
2609
  //update services
2610
- if (this.enphaseEnchargesSummaryLevelAndStateService) {
2611
- this.enphaseEnchargesSummaryLevelAndStateService
2612
- .updateCharacteristic(Characteristic.On, this.ensemble.encharges.energyState)
2610
+ if (this.enchargesSummaryLevelAndStateService) {
2611
+ this.enchargesSummaryLevelAndStateService
2612
+ .updateCharacteristic(Characteristic.On, this.ensemble.encharges.energyStateSum)
2613
2613
  .updateCharacteristic(Characteristic.Brightness, this.ensemble.encharges.percentFullSum)
2614
2614
  }
2615
2615
 
@@ -4192,10 +4192,10 @@ class EnvoyDevice extends EventEmitter {
4192
4192
  this.emit('devInfo', `Time: ${this.pv.envoy.time}`);
4193
4193
  const displayLog = this.envoyFirmware7xx && this.envoyFirmware7xxTokenGenerationMode === 0 ? this.emit('devInfo', `Token Valid: ${new Date(this.jwtToken.expires_at * 1000).toLocaleString()}`) : false;
4194
4194
  this.emit('devInfo', `------------------------------`);
4195
- this.emit('devInfo', `Q-Relays: ${this.feature.qRelays.count}`);
4195
+ const displayLog12 = this.feature.qRelays.installed ? this.emit('devInfo', `Q-Relays: ${this.feature.qRelays.count}`) : false;
4196
4196
  this.emit('devInfo', `Inverters: ${this.feature.microinverters.count}`);
4197
- const displayLog12 = this.feature.acBatteries.installed ? this.emit('devInfo', `AC Batteries: ${this.feature.acBatteries.count}`) : false;
4198
- this.emit('devInfo', `--------------------------------`);
4197
+ const displayLog13 = this.feature.acBatteries.installed ? this.emit('devInfo', `AC Batteries: ${this.feature.acBatteries.count}`) : false;
4198
+ const displayLog14 = this.feature.qRelays.installed || this.feature.acBatteries.installed ? this.emit('devInfo', `--------------------------------`) : false;
4199
4199
  const displayLog0 = this.feature.meters.installed ? this.emit('devInfo', `Meters: Yes`) : false;
4200
4200
  const displayLog1 = this.feature.meters.installed && this.feature.meters.production.supported ? this.emit('devInfo', `Production: ${this.feature.meters.production.enabled ? `Enabled` : `Disabled`}`) : false;
4201
4201
  const displayLog2 = this.feature.meters.installed && this.feature.meters.consumption.supported ? this.emit('devInfo', `Consumption: ${this.feature.meters.consumption.enabled ? `Enabled` : `Disabled`}`) : false;
@@ -4834,26 +4834,26 @@ class EnvoyDevice extends EventEmitter {
4834
4834
  if (productionCtAcBatterieSupported) {
4835
4835
  //ac batteries summary level and state
4836
4836
  const debug2 = this.enableDebugMode ? this.emit('debug', `Prepare AC Batteries Summary Service`) : false;
4837
- this.enphaseAcBatterieSummaryLevelAndStateService = accessory.addService(Service.Lightbulb, `AC Batteries`, `enphaseAcBatterieSummaryLevelAndStateService`);
4838
- this.enphaseAcBatterieSummaryLevelAndStateService.addOptionalCharacteristic(Characteristic.ConfiguredName);
4839
- this.enphaseAcBatterieSummaryLevelAndStateService.setCharacteristic(Characteristic.ConfiguredName, `AC Batteries`);
4840
- this.enphaseAcBatterieSummaryLevelAndStateService.getCharacteristic(Characteristic.On)
4837
+ this.acBatteriesSummaryLevelAndStateService = accessory.addService(Service.Lightbulb, `AC Batteries`, `acBatteriesSummaryLevelAndStateService`);
4838
+ this.acBatteriesSummaryLevelAndStateService.addOptionalCharacteristic(Characteristic.ConfiguredName);
4839
+ this.acBatteriesSummaryLevelAndStateService.setCharacteristic(Characteristic.ConfiguredName, `AC Batteries`);
4840
+ this.acBatteriesSummaryLevelAndStateService.getCharacteristic(Characteristic.On)
4841
4841
  .onGet(async () => {
4842
- const state = this.pv.production.ct.acBatterie.energyState;
4842
+ const state = this.pv.production.ct.acBatterie.energyStateSum;
4843
4843
  const info = this.disableLogInfo ? false : this.emit('message', `AC Batteries energy state: ${state ? 'Charged' : 'Discharged'}`);
4844
4844
  return state;
4845
4845
  })
4846
4846
  .onSet(async (state) => {
4847
- this.enphaseAcBatterieSummaryLevelAndStateService.updateCharacteristic(Characteristic.On, this.pv.production.ct.acBatterie.energyState);
4847
+ this.acBatteriesSummaryLevelAndStateService.updateCharacteristic(Characteristic.On, this.pv.production.ct.acBatterie.energyStateSum);
4848
4848
  })
4849
- this.enphaseAcBatterieSummaryLevelAndStateService.getCharacteristic(Characteristic.Brightness)
4849
+ this.acBatteriesSummaryLevelAndStateService.getCharacteristic(Characteristic.Brightness)
4850
4850
  .onGet(async () => {
4851
- const state = this.pv.production.ct.acBatterie.percentFull;
4852
- const info = this.disableLogInfo ? false : this.emit('message', `AC Batteries energy level: ${this.pv.production.ct.acBatterie.percentFull} %`);
4851
+ const state = this.pv.production.ct.acBatterie.percentFullSum;
4852
+ const info = this.disableLogInfo ? false : this.emit('message', `AC Batteries energy level: ${this.pv.production.ct.acBatterie.percentFullSum} %`);
4853
4853
  return state;
4854
4854
  })
4855
4855
  .onSet(async (value) => {
4856
- this.enphaseAcBatterieSummaryLevelAndStateService.updateCharacteristic(Characteristic.Brightness, this.pv.production.ct.acBatterie.percentFull);
4856
+ this.acBatteriesSummaryLevelAndStateService.updateCharacteristic(Characteristic.Brightness, this.pv.production.ct.acBatterie.percentFullSum);
4857
4857
  })
4858
4858
 
4859
4859
 
@@ -5796,10 +5796,10 @@ class EnvoyDevice extends EventEmitter {
5796
5796
  if (enchargesInstalled) {
5797
5797
  //encharges summary level and state
5798
5798
  const debug2 = this.enableDebugMode ? this.emit('debug', `Prepare Encharges Summary Service`) : false;
5799
- this.enphaseEnchargesSummaryLevelAndStateService = accessory.addService(Service.Lightbulb, `Encharges`, `enphaseEnchargesSummaryLevelAndStateService`);
5800
- this.enphaseEnchargesSummaryLevelAndStateService.addOptionalCharacteristic(Characteristic.ConfiguredName);
5801
- this.enphaseEnchargesSummaryLevelAndStateService.setCharacteristic(Characteristic.ConfiguredName, 'Encharges');
5802
- this.enphaseEnchargesSummaryLevelAndStateService.getCharacteristic(Characteristic.On)
5799
+ this.enchargesSummaryLevelAndStateService = accessory.addService(Service.Lightbulb, `Encharges`, `enchargesSummaryLevelAndStateService`);
5800
+ this.enchargesSummaryLevelAndStateService.addOptionalCharacteristic(Characteristic.ConfiguredName);
5801
+ this.enchargesSummaryLevelAndStateService.setCharacteristic(Characteristic.ConfiguredName, 'Encharges');
5802
+ this.enchargesSummaryLevelAndStateService.getCharacteristic(Characteristic.On)
5803
5803
  .onGet(async () => {
5804
5804
  const state = this.ensemble.encharges.energyStateSum;
5805
5805
  const info = this.disableLogInfo ? false : this.emit('message', `Encharges energy state: ${state ? 'Charged' : 'Discharged'}`);
@@ -5807,12 +5807,12 @@ class EnvoyDevice extends EventEmitter {
5807
5807
  })
5808
5808
  .onSet(async (state) => {
5809
5809
  try {
5810
- this.enphaseEnchargesSummaryLevelAndStateService.updateCharacteristic(Characteristic.On, this.ensemble.encharges.energyStateSum);
5810
+ this.enchargesSummaryLevelAndStateService.updateCharacteristic(Characteristic.On, this.ensemble.encharges.energyStateSum);
5811
5811
  } catch (error) {
5812
5812
  this.emit('warn', `Set Encharges energy state error: ${error}`);
5813
5813
  };
5814
5814
  });
5815
- this.enphaseEnchargesSummaryLevelAndStateService.getCharacteristic(Characteristic.Brightness)
5815
+ this.enchargesSummaryLevelAndStateService.getCharacteristic(Characteristic.Brightness)
5816
5816
  .onGet(async () => {
5817
5817
  const state = this.ensemble.encharges.percentFullSum;
5818
5818
  const info = this.disableLogInfo ? false : this.emit('message', `Encharges energy level: ${this.ensemble.encharges.percentFullSum} %`);
@@ -5820,7 +5820,7 @@ class EnvoyDevice extends EventEmitter {
5820
5820
  })
5821
5821
  .onSet(async (value) => {
5822
5822
  try {
5823
- this.enphaseEnchargesSummaryLevelAndStateService.updateCharacteristic(Characteristic.Brightness, this.ensemble.encharges.percentFullSum);
5823
+ this.enchargesSummaryLevelAndStateService.updateCharacteristic(Characteristic.Brightness, this.ensemble.encharges.percentFullSum);
5824
5824
  } catch (error) {
5825
5825
  this.emit('warn', `Set Encharges energy level error: ${error}`);
5826
5826
  };