homebridge-enphase-envoy 10.2.6-beta.7 → 10.2.6-beta.9

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "displayName": "Enphase Envoy",
4
4
  "name": "homebridge-enphase-envoy",
5
- "version": "10.2.6-beta.7",
5
+ "version": "10.2.6-beta.9",
6
6
  "description": "Homebridge p7ugin for Photovoltaic Energy System manufactured by Enphase.",
7
7
  "license": "MIT",
8
8
  "author": "grzegorz914",
package/src/envoydata.js CHANGED
@@ -2040,11 +2040,11 @@ class EnvoyData extends EventEmitter {
2040
2040
 
2041
2041
  try {
2042
2042
  const response = await this.axiosInstance.get(ApiUrls.EnsemblePower);
2043
- const devices = response.data.devices || [];
2044
- if (this.logDebug) this.emit('debug', `Ensemble power response:`, devices);
2043
+ const responseData = response.data;
2044
+ if (this.logDebug) this.emit('debug', `Ensemble power response:`, responseData);
2045
2045
 
2046
- const devicesSupported = devices.length > 0;
2047
- if (!devicesSupported) return false;
2046
+ const devices = responseData.devices ?? [];
2047
+ if (!devices.length === 0) return false;
2048
2048
 
2049
2049
  // update encharges
2050
2050
  const enchargesRealPowerSummary = [];
@@ -2083,10 +2083,10 @@ class EnvoyDevice extends EventEmitter {
2083
2083
  if (this.logDebug) this.emit('debug', `Prepare ${enchargeName} Backup Level Summary Service`);
2084
2084
 
2085
2085
  const control = this.enchargeBackupLevelSummaryAccessory;
2086
- const { namePrefix, name, serviceType, characteristicType, characteristicType1 } = control;
2086
+ const { namePrefix, serviceType, characteristicType, characteristicType1 } = control;
2087
2087
  const serviceName = namePrefix ? `${accessoryName} ${enchargeName}` : enchargeName;
2088
2088
 
2089
- const controlService = accessory.addService(serviceType, serviceName, `enchargeSummaryLevelAndStateService`);
2089
+ const controlService = accessory.addService(serviceType, serviceName, `enchargeBackupLevelSummaryAccessoryService`);
2090
2090
  controlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
2091
2091
  controlService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
2092
2092
  controlService.getCharacteristic(characteristicType)
@@ -2128,14 +2128,14 @@ class EnvoyDevice extends EventEmitter {
2128
2128
  }
2129
2129
  });
2130
2130
 
2131
- this.enchargeSummaryLevelAndStateService = controlService;
2131
+ this.enchargeBackupLevelSummaryAccessoryService = controlService;
2132
2132
  }
2133
2133
 
2134
2134
  //backup level summary sensors
2135
2135
  if (this.enchargeBackupLevelSummarySensors.length > 0) {
2136
2136
  if (this.logDebug) this.emit('debug', `Prepare ${enchargeName} Backup Level Sensor Services`);
2137
2137
 
2138
- this.enchargeBackupLevelSensorServices = [];
2138
+ this.enchargeBackupLevelSummarySensorServices = [];
2139
2139
  for (let i = 0; i < this.enchargeBackupLevelSummarySensors.length; i++) {
2140
2140
  const sensor = this.enchargeBackupLevelSummarySensors[i];
2141
2141
  const { namePrefix, name, serviceType, characteristicType } = sensor;
@@ -2151,13 +2151,13 @@ class EnvoyDevice extends EventEmitter {
2151
2151
  return currentState;
2152
2152
  });
2153
2153
 
2154
- this.enchargeBackupLevelSensorServices.push(sensorService);
2154
+ this.enchargeBackupLevelSummarySensorServices.push(sensorService);
2155
2155
  }
2156
2156
  }
2157
2157
 
2158
2158
  //devices
2159
2159
  this.enchargeServices = [];
2160
- this.enchargeLevelAndStateServices = [];
2160
+ this.enchargeBackupLevelAndStatServices = [];
2161
2161
 
2162
2162
  for (const encharge of this.pv.inventoryData.esubs.encharges.devices) {
2163
2163
  const serialNumber = encharge.serialNumber;
@@ -2208,7 +2208,7 @@ class EnvoyDevice extends EventEmitter {
2208
2208
  return currentChargeState;
2209
2209
  });
2210
2210
 
2211
- this.enchargeLevelAndStateServices.push(controlService);
2211
+ this.enchargeBackupLevelAndStatServices.push(controlService);
2212
2212
  }
2213
2213
 
2214
2214
  if (this.logDebug) this.emit('debug', `Prepare ${enchargeName} ${serialNumber} Service`);
@@ -4272,7 +4272,7 @@ class EnvoyDevice extends EventEmitter {
4272
4272
 
4273
4273
  // Create characteristics
4274
4274
  const characteristics = [
4275
- { type: characteristicType, value: state, valueKey: 'stste' },
4275
+ { type: characteristicType, value: state, valueKey: 'state' },
4276
4276
  { type: characteristicType1, value: backupLevel, valueKey: 'backupLevel' },
4277
4277
  ];
4278
4278
 
@@ -4280,7 +4280,7 @@ class EnvoyDevice extends EventEmitter {
4280
4280
  for (const { type, value, valueKey } of characteristics) {
4281
4281
  if (!this.functions.isValidValue(value)) continue;
4282
4282
  accessory[valueKey] = value;
4283
- this.enchargeSummaryLevelAndStateService?.updateCharacteristic(type, value);
4283
+ this.enchargeBackupLevelSummaryAccessoryService?.updateCharacteristic(type, value);
4284
4284
  }
4285
4285
  }
4286
4286
 
@@ -4299,7 +4299,7 @@ class EnvoyDevice extends EventEmitter {
4299
4299
  for (const { type, value, valueKey } of characteristics) {
4300
4300
  if (!this.functions.isValidValue(value)) continue;
4301
4301
  sensor[valueKey] = value;
4302
- this.enchargeBackupLevelSensorServices?.[i]?.updateCharacteristic(type, value);
4302
+ this.enchargeBackupLevelSummarySensorServices?.[i]?.updateCharacteristic(type, value);
4303
4303
  };
4304
4304
  }
4305
4305
  }
@@ -4623,7 +4623,7 @@ class EnvoyDevice extends EventEmitter {
4623
4623
  for (const { type, value, valueKey } of characteristics) {
4624
4624
  if (!this.functions.isValidValue(value)) continue;
4625
4625
  accessory[valueKey] = value;
4626
- this.enchargeLevelAndStateServices?.[index]?.updateCharacteristic(type, value);
4626
+ this.enchargeBackupLevelAndStatServices?.[index]?.updateCharacteristic(type, value);
4627
4627
  }
4628
4628
  }
4629
4629
 
@@ -5551,7 +5551,7 @@ class EnvoyDevice extends EventEmitter {
5551
5551
 
5552
5552
  // Create characteristics
5553
5553
  const characteristics = [
5554
- { type: characteristicType, value: state, valueKey: 'stste' },
5554
+ { type: characteristicType, value: state, valueKey: 'state' },
5555
5555
  { type: characteristicType1, value: backupLevel, valueKey: 'backupLevel' },
5556
5556
  ];
5557
5557
 
@@ -5559,7 +5559,7 @@ class EnvoyDevice extends EventEmitter {
5559
5559
  for (const { type, value, valueKey } of characteristics) {
5560
5560
  if (!this.functions.isValidValue(value)) continue;
5561
5561
  accessory[valueKey] = value;
5562
- this.enchargeSummaryLevelAndStateService?.updateCharacteristic(type, value);
5562
+ this.enchargeBackupLevelSummaryAccessoryService?.updateCharacteristic(type, value);
5563
5563
  }
5564
5564
  }
5565
5565
 
@@ -5578,7 +5578,7 @@ class EnvoyDevice extends EventEmitter {
5578
5578
  for (const { type, value, valueKey } of characteristics) {
5579
5579
  if (!this.functions.isValidValue(value)) continue;
5580
5580
  sensor[valueKey] = value;
5581
- this.enchargeBackupLevelSensorServices?.[i]?.updateCharacteristic(type, value);
5581
+ this.enchargeBackupLevelSummarySensorServices?.[i]?.updateCharacteristic(type, value);
5582
5582
  };
5583
5583
  }
5584
5584
  }